[libvirt] [PATCHv2] util: bitmap: Tolerate NULL bitmaps in virBitmapEqual
by Peter Krempa
After virBitmapEqual is able to compare NULL bitmaps few bits of code
can be cleaned up.
---
Version 2 cleans up code paths that would do a duplicate check now.
src/conf/domain_conf.c | 40 ++++++++++------------------------------
src/conf/numatune_conf.c | 3 ---
src/util/virbitmap.c | 6 ++++++
src/util/virbitmap.h | 3 +--
4 files changed, 17 insertions(+), 35 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9ff3819..d364d3c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15625,18 +15625,10 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
goto error;
}
- if (src_huge->nodemask && dst_huge->nodemask) {
- if (!virBitmapEqual(src_huge->nodemask, dst_huge->nodemask)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Target huge page nodemask does not match source"));
- goto error;
- }
- } else {
- if (src_huge->nodemask || dst_huge->nodemask) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Target huge page nodemask does not match source"));
- goto error;
- }
+ if (!virBitmapEqual(src_huge->nodemask, dst_huge->nodemask)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target huge page nodemask does not match source"));
+ goto error;
}
}
@@ -19126,20 +19118,12 @@ virDomainIsAllVcpupinInherited(virDomainDefPtr def)
{
size_t i;
- if (!def->cpumask) {
- if (def->cputune.nvcpupin)
+ for (i = 0; i < def->cputune.nvcpupin; i++) {
+ if (!virBitmapEqual(def->cputune.vcpupin[i]->cpumask, def->cpumask))
return false;
- else
- return true;
- } else {
- for (i = 0; i < def->cputune.nvcpupin; i++) {
- if (!virBitmapEqual(def->cputune.vcpupin[i]->cpumask,
- def->cpumask))
- return false;
- }
+ }
- return true;
- }
+ return true;
}
@@ -19477,9 +19461,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
for (i = 0; i < def->cputune.nvcpupin; i++) {
char *cpumask;
/* Ignore the vcpupin which inherit from "cpuset of "<vcpu>." */
- if (def->cpumask &&
- virBitmapEqual(def->cpumask,
- def->cputune.vcpupin[i]->cpumask))
+ if (virBitmapEqual(def->cpumask, def->cputune.vcpupin[i]->cpumask))
continue;
virBufferAsprintf(buf, "<vcpupin vcpu='%u' ",
@@ -19506,9 +19488,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
for (i = 0; i < def->cputune.niothreadspin; i++) {
char *cpumask;
/* Ignore the iothreadpin which inherit from "cpuset of "<vcpu>." */
- if (def->cpumask &&
- virBitmapEqual(def->cpumask,
- def->cputune.iothreadspin[i]->cpumask))
+ if (virBitmapEqual(def->cpumask, def->cputune.iothreadspin[i]->cpumask))
continue;
virBufferAsprintf(buf, "<iothreadpin iothread='%u' ",
diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c
index ad928e0..323cd59 100644
--- a/src/conf/numatune_conf.c
+++ b/src/conf/numatune_conf.c
@@ -542,9 +542,6 @@ virDomainNumatuneNodesEqual(virDomainNumatunePtr n1,
if (!nd1->nodeset && !nd2->nodeset)
continue;
- if (!nd1->nodeset || !nd2->nodeset)
- return false;
-
if (nd1->mode != nd2->mode)
return false;
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 05c50e4..d5b0035 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -504,6 +504,12 @@ bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2)
virBitmapPtr tmp;
size_t i;
+ if (!b1 && !b2)
+ return true;
+
+ if (!b1 || !b2)
+ return false;
+
if (b1->max_bit > b2->max_bit) {
tmp = b1;
b1 = b2;
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 565264c..a347f0a 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -84,8 +84,7 @@ virBitmapPtr virBitmapNewData(void *data, int len) ATTRIBUTE_NONNULL(1);
int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2);
size_t virBitmapSize(virBitmapPtr bitmap)
ATTRIBUTE_NONNULL(1);
--
2.2.1
9 years, 9 months
[libvirt] [PATCH] libvirt.spec: remove vbox storage and network .so files
by Pavel Hrdina
Commit 55ea7be7 removed separated modules for vbox_network and
vbox_storage drivers but forget to update libvirt.spec.in file. This
patch will fix rpm build.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed under trivial rule.
libvirt.spec.in | 2 --
1 file changed, 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b2db80e..7f8be38 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2117,8 +2117,6 @@ exit 0
%files daemon-driver-vbox
%defattr(-, root, root)
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so
-%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox_network.so
-%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox_storage.so
%endif
%endif # %{with_driver_modules}
--
2.0.5
9 years, 9 months
[libvirt] [PATCHv2 0/6] Resolve issues in disk pool backend
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1138516
v1: http://www.redhat.com/archives/libvir-list/2015-January/msg00465.html
In my previous attempt to resolve the issue, I created a stateDir and
saved the volume XML for each pool in order to attempt to preserve the
volume "name" and "target format type". However, it was pointed out during
review that having a different "name" was not the original design intention.
The intention was the name would be the partition name rather than something
the user fabricates and expects to be saved/used. Since partition naming
is handled by parted, the control over the name is not ours. Additionally,
a pool refresh or libvirtd restart/reload would use the 'default' of the
source device path and the partition number from the partition table.
The "simple" fix to the issue is in patch 6; however, as I was going through
fixing this I realized a few things and found a few other issues along the
way, namely:
Patches #1 & #2:
After creating the partition if we fail something within the callback to
virStorageBackendDiskMakeDataVol as a result of parsing the partition table
from libvirt_parthelper, then the partition wasn't removed. So, patches
1 & 2 work at moving the DeleteVol code and then calling it if something
in virStorageBackendDiskReadPartitions fails.
Patch #3:
When determining what type of partitions currently exist in the pool we
compared against the target.format which is supposed to be the file system
format type of the partition on the target rather than whether the partition
is a primary, extended, or logical partition on the source. Since we set
the partType on the source while reading the partitions, that's what we
should use.
Patch #4:
During a refresh of the pool, we use virStorageBackendDiskReadPartitions
in order to determine what types of partitions exist; however, if we
have an extended partition and have created either a logical partition
within or another primary partition after the extended one, then the
open() will fail with ENXIO. So I special cased that.
Patch #5:
When we delete an extended partition, any logical partitions that existed
in the pool would still be listed even though as part of the delete
partition logic all the logical partitions were also deleted.
Patch #6:
So here is essentially the replacement for the previous patch series.
Since the theory is one is supposed to know what they are doing and
will provide the correct vol->name, make sure that they do so and cause
a failure if they don't (indicating what the name should be). As an
alternative we could just "overwrite" the name like we did anyway with
pool refresh or libvirtd restart/reload by doing the following instead:
/* Like the reload/restart/refresh path - use the name created by
* parted rather than the API/user provided name
*/
if (STRNEQ(vol->name, partname)) {
VIR_FREE(vol->name);
if (VIR_STRDUP(vol->name, partname) < 0)
return -1;
}
I also added details to the virsh.pod and formatstorage.html.in for
the 'name' and the intersting "side effect" I found using 'virsh
vol-create-as $pool $name $size --format extended'. I'd remove it,
but I fear that someone else found this and has made use of it. The
reality is that '--format' is supposed to be the file system format
of the partition. However, the way it's used in the code will take
what is supposed to be target format and allow creation of an extended
partition. In virStorageBackendDiskPartFormat, if the pool source.format
is DOS and the vol->target.format is VIR_STORAGE_VOL_DISK_EXTENDED, then
we create an extended source partition as long as one doesn't already exist.
John Ferlan (6):
storage: Move virStorageBackendDiskDeleteVol
storage: Attempt error recovery in virStorageBackendDiskCreateVol
storage: Fix check for partition type for disk backing volumes
storage: Adjust how to refresh extended partition disk data
storage: When delete extended partition, need to refresh pool
storage: Check the partition name against provided name
docs/formatstorage.html.in | 12 +-
src/storage/storage_backend.c | 4 +
src/storage/storage_backend_disk.c | 235 +++++++++++++++++++++++--------------
tools/virsh.pod | 17 ++-
4 files changed, 174 insertions(+), 94 deletions(-)
--
2.1.0
9 years, 9 months
[libvirt] [PATCH v2 0/9] qemu: Add quorum support to libvirt
by Matthias Gatto
The purpose of these patches is to introduce quorum for libvirt
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
This feature ask for 6 task:
1) Allow a _virStorageSource
to contain more than one backing store.
Therefore we have to treat the field virStorageSourcePtr backingStores
as an array instead of a pointer.
But doing that, most of the backingStore field would be an array contening
only one element.
So I've decide to allocate the array only if there is more than 1
backing store in a _virStorageSource.
Because all the actual libvirt code use the backingStore field
as a pointer and we needs want to change that, I've decide to encapsulate
the backingStore field to simplifie the array manipulation.
2) Add the missing field a quorum need in _virStorageSource and
the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
their respectives enums.
3) Parse and format the xml
Because a quorum allows to have more than one backing store at the same level
we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
in a loop.
virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
call themself recursively in a loop because a quorum can contain another
quorum
4) Add nodename
We need to add nodename support in _virStorageSource because qemu
use them for their child.
5) Build qemu string
As for the xml, we have to call the function which create quorum recursively.
But this task have the problem explained here:
http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
The _virStorageSource missing some informations that can be passed to
a child, and therefore this version of quorum is incomplet.
6) Allow to hotplug/change a disk in a quorum
This part is not present in these patches because for this task
we have to use blockdev-add, and currently libvirt use
device_add for hotpluging that doesn't allow to hotplug quorum childs.
There is 3 way to handle this problem:
1) create a virDomainBlockDevAdd function in libvirt witch call
blockdev-add.
2) use blockdev-add instead of device_add in qemuMonitorJSONAddDevice
3) write a hack which uses blockdev-add when only attaching quorum
(but i'm pretty sure this solution is not the good one)
V2:
-Rebase on master
-Add Documentation
Matthias Gatto (9):
virstoragefile: Add virStorageSourceGetBackingStore
virstoragefile: Always use virStorageSourceGetBackingStore to get
backing store
virstoragefile: Add virStorageSourceSetBackingStore
virstoragefile: Always use virStorageSourceSetBackingStore to set
backing store
virstoragefile: Treat backingStore as a pointer or an array
virstoragefile: Add quorum in virstoragefile
domain_conf: Read and Write quorum config
qemu: Add quorum support in qemuBuildDriveDevStr
virstoragefile: Add node-name
docs/formatdomain.html.in | 27 ++++-
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 193 ++++++++++++++++++++++++++--------
src/conf/storage_conf.c | 25 +++--
src/libvirt_private.syms | 3 +
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 114 ++++++++++++++++++++
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 20 ++--
src/qemu/qemu_migration.c | 1 +
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.c | 30 +++---
src/storage/storage_backend_fs.c | 35 +++---
src/storage/storage_backend_gluster.c | 8 +-
src/storage/storage_backend_logical.c | 8 +-
src/storage/storage_driver.c | 2 +-
src/util/virstoragefile.c | 138 +++++++++++++++++++++---
src/util/virstoragefile.h | 12 +++
tests/virstoragetest.c | 18 ++--
22 files changed, 518 insertions(+), 132 deletions(-)
--
1.8.3.1
9 years, 9 months
[libvirt] [PATCHv2 0/2] Really fix the crash on qemu crash on chardev hotplug
by Ján Tomko
An alternative solution that only adds the chardev to the definition
after the command succeeded.
Ján Tomko (2):
Split qemuDomainChrInsert into two parts
hotplug: only add a chardev to vmdef after monitor call
src/conf/domain_conf.c | 18 ++++++++--
src/conf/domain_conf.h | 7 ++--
src/libvirt_private.syms | 3 +-
src/qemu/qemu_hotplug.c | 88 +++++++++++++++++++++++++++++++-----------------
4 files changed, 79 insertions(+), 37 deletions(-)
--
2.0.5
9 years, 9 months
[libvirt] [PATCHv2 0/2] add support for btrfs COW copy
by Chen Hanxiao
If VIR_STORAGE_VOL_CREATE_REFLINK is specified,
try to use btrfs COW copy;
v2: check BTRFS_IOC_CLONE in configure.ac
error out if COW copy is not supported
Chen Hanxiao (2):
storage: introduce btrfsCloneFile() for COW copy
storage: try to perform btrfs clone if possible
configure.ac | 12 +++++++
include/libvirt/libvirt-storage.h | 1 +
src/storage/storage_backend.c | 67 +++++++++++++++++++++++++++++++++++----
src/storage/storage_backend_fs.c | 8 +++--
src/storage/storage_driver.c | 4 ++-
5 files changed, 82 insertions(+), 10 deletions(-)
--
2.1.0
9 years, 9 months
[libvirt] [PATCH] Fix shadowed variable warning
by Ján Tomko
libvirtd.c: In function 'daemonSetupAccessManager':
libvirtd.c:730:18: error: declaration of 'driver' shadows
a global declaration [-Werror=shadow]
const char **driver = (const char **)config->access_drivers;
^
In file included from libvirtd.c:95:0:
../src/node_device/node_device_driver.h:43:36: error: shadowed
declaration is here [-Werror=shadow]
extern virNodeDeviceDriverStatePtr driver;
^
---
daemon/libvirtd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Pushed as a build breaker fix.
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 5ccfcdd..86accaa 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -727,13 +727,13 @@ daemonSetupAccessManager(struct daemonConfig *config)
{
virAccessManagerPtr mgr;
const char *none[] = { "none", NULL };
- const char **driver = (const char **)config->access_drivers;
+ const char **drv = (const char **)config->access_drivers;
- if (!driver ||
- !driver[0])
- driver = none;
+ if (!drv ||
+ !drv[0])
+ drv = none;
- if (!(mgr = virAccessManagerNewStack(driver)))
+ if (!(mgr = virAccessManagerNewStack(drv)))
return -1;
virAccessManagerSetDefault(mgr);
--
2.0.5
9 years, 9 months
[libvirt] [PATCH tck 0/5] Misc. TCK cleanups
by Mike Latimer
While running TCK on qemu, lxc and xen, I've ran into a few issues worth
fixing upstream. The patches in this series are mainly focused on fixing
minor typos, or safeguarding against failures in non-qemu environments.
Depending on how interested people are in running TCK with xen, I can
provide a few additional patches.
Mike Latimer (5):
hooks_051-return0
nwfilter_050-handle-failures
hooks_qemu-only_skip
TCK-check_uri
TCK-eval-snapshots-list
lib/Sys/Virt/TCK.pm | 3 ++-
lib/Sys/Virt/TCK/Capabilities.pm | 6 ++++--
scripts/hooks/051-daemon-hook.t | 6 +++++-
scripts/hooks/052-domain-hook.t | 2 +-
scripts/nwfilter/nwfilter2vmtest.sh | 4 +++-
5 files changed, 15 insertions(+), 6 deletions(-)
--
1.8.4.5
9 years, 9 months
[libvirt] [PATCH 0/7] qemu: Job handling fixes
by Peter Krempa
While reviewing Martin's reference counting series I've noticed a few qemu API
impls that don't properly handle jobs.
Peter Krempa (7):
qemu: Fix job handling in qemuDomainPinVcpuFlags
qemu: Fix job handling in qemuDomainPinEmulator
qemu: Fix job handling in qemuDomainSetAutostart
qemu: Fix job handling in qemuDomainSetMemoryParameters
qemu: Fix job handling in qemuDomainSetSchedulerParametersFlags
qemu: Fix job type in qemuDomainGetBlockIoTune
qemu: Fix job handling in qemuDomainSetMetadata
src/qemu/qemu_driver.c | 135 +++++++++++++++++++++++++++++++------------------
1 file changed, 87 insertions(+), 48 deletions(-)
--
2.2.1
9 years, 9 months