[libvirt] [PATCH] storage: dir: adapts .wipeVol for ploop volumes
by Olga Krishtal
The modification of .volWipe callback wipes ploop volume using one of
given wiping algorithm: dod, nnsa, etc.
However, in case of ploop volume we need to reinitialize root.hds and DiskDescriptor.xml.
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
src/storage/storage_backend.c | 58 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 6 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index d47a76a..367a887 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -2295,6 +2295,45 @@ virStorageBackendWipeLocal(virStorageVolDefPtr vol,
return ret;
}
+static int
+virStorageBackendVolWipePloop(virStorageVolDefPtr vol)
+{
+ virCommandPtr cmd = NULL;
+ char *target_path = NULL;
+ char *disk_desc = NULL;
+ int ret = -1;
+
+ if (virAsprintf(&target_path, "%s/root.hds", vol->target.path) < 0)
+ goto cleanup;
+
+ if (virAsprintf(&disk_desc, "%s/DiskDescriptor.xml", vol->target.path) < 0)
+ goto cleanup;
+
+ if (virFileRemove(disk_desc, 0, 0) < 0) {
+ virReportError(errno, _("Failed to delete DiskDescriptor.xml of volume '%s'"),
+ vol->target.path);
+ goto cleanup;
+ }
+ if (virFileRemove(target_path, 0, 0) < 0) {
+ virReportError(errno, _("failed to delete root.hds of volume '%s'"),
+ vol->target.path);
+ goto cleanup;
+ }
+
+ cmd = virCommandNewArgList("ploop", "init", "-s", NULL);
+
+ virCommandAddArgFormat(cmd, "%lluM", VIR_DIV_UP(vol->target.capacity,
+ (1024 * 1024)));
+ virCommandAddArgList(cmd, "-t", "ext4", NULL);
+ virCommandAddArgFormat(cmd, "%s/root.hds", vol->target.path);
+ ret = virCommandRun(cmd, NULL);
+
+ cleanup:
+ VIR_FREE(disk_desc);
+ VIR_FREE(target_path);
+ virCommandFree(cmd);
+ return ret;
+}
int
virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -2307,6 +2346,8 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *alg_char = NULL;
struct stat st;
virCommandPtr cmd = NULL;
+ char *path = NULL;
+ char *target_path = vol->target.path;
virCheckFlags(0, -1);
@@ -2314,12 +2355,12 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
vol->target.path, algorithm);
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("wiping for ploop volumes is not supported"));
- goto cleanup;
+ if (virAsprintf(&path, "%s/root.hds", vol->target.path) < 0)
+ goto cleanup;
+ target_path = path;
}
- fd = open(vol->target.path, O_RDWR);
+ fd = open(target_path, O_RDWR);
if (fd == -1) {
virReportSystemError(errno,
_("Failed to open storage volume with path '%s'"),
@@ -2376,13 +2417,12 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
if (algorithm != VIR_STORAGE_VOL_WIPE_ALG_ZERO) {
cmd = virCommandNew(SCRUB);
virCommandAddArgList(cmd, "-f", "-p", alg_char,
- vol->target.path, NULL);
+ target_path, NULL);
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
ret = 0;
- goto cleanup;
} else {
if (S_ISREG(st.st_mode) && st.st_blocks < (st.st_size / DEV_BSIZE)) {
ret = virStorageBackendVolZeroSparseFileLocal(vol, st.st_size, fd);
@@ -2392,10 +2432,16 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
vol->target.allocation,
st.st_blksize);
}
+ if (ret < 0)
+ goto cleanup;
}
+ if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
+ ret = virStorageBackendVolWipePloop(vol);
+
cleanup:
virCommandFree(cmd);
+ VIR_FREE(path);
VIR_FORCE_CLOSE(fd);
return ret;
}
--
1.8.3.1
8 years, 6 months
[libvirt] [PATCH 0/5] Allow disjunct ranges in VIR_TEST_RANGE
by Ján Tomko
Now you can do:
VIR_TEST_RANGE=7-14,^10,1024 ./virschematest
Ján Tomko (5):
Do not return number of set bits in virBitmapParse
Introduce virBitmapParseSeparator
Remove separator argument from virBitmapParse
Introduce virBitmapParseUnlimited
Allow disjunct ranges in VIR_TEST_RANGE
src/conf/domain_conf.c | 15 +++--
src/conf/network_conf.c | 2 +-
src/conf/numa_conf.c | 7 +--
src/libvirt_private.syms | 2 +
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_native.c | 4 +-
src/nodeinfo.c | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 2 +-
src/util/virbitmap.c | 149 ++++++++++++++++++++++++++++++++++++++++++---
src/util/virbitmap.h | 12 +++-
src/util/virhostcpu.c | 2 +-
src/vz/vz_sdk.c | 2 +-
src/xen/xend_internal.c | 5 +-
src/xenconfig/xen_common.c | 2 +-
src/xenconfig/xen_sxpr.c | 3 +-
tests/qemuxml2argvtest.c | 2 +-
tests/testutils.c | 30 ++-------
tests/virbitmaptest.c | 31 ++++++----
tests/vircapstest.c | 2 +-
tools/virsh-domain.c | 2 +-
22 files changed, 205 insertions(+), 77 deletions(-)
--
2.7.3
8 years, 6 months
[libvirt] [PATCH] qemu: restore non-pci hostdev labels after detach
by Ján Tomko
Commit 409de00 changed the logic to only match PCI devices
while moving this before Remove*HostDevice calls.
https://bugzilla.redhat.com/show_bug.cgi?id=1342874
---
src/qemu/qemu_hotplug.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e1c3de7..39d49d4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2952,10 +2952,16 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
char *drivestr = NULL;
+ bool is_vfio = false;
VIR_DEBUG("Removing host device %s from domain %p %s",
hostdev->info->alias, vm, vm->def->name);
+ if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
+ int backend = hostdev->source.subsys.u.pci.backend;
+ is_vfio = backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+ }
+
if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) {
/* build the actual drive id string as generated during
* qemuBuildSCSIHostdevDrvStr that is passed to qemu */
@@ -2993,13 +2999,10 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
virDomainAuditHostdev(vm, hostdev, "detach", true);
- if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
- hostdev->source.subsys.u.pci.backend !=
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
- if (virSecurityManagerRestoreHostdevLabel(driver->securityManager,
- vm->def, hostdev, NULL) < 0)
- VIR_WARN("Failed to restore host device labelling");
- }
+ if (!is_vfio &&
+ virSecurityManagerRestoreHostdevLabel(driver->securityManager,
+ vm->def, hostdev, NULL) < 0)
+ VIR_WARN("Failed to restore host device labelling");
if (qemuTeardownHostdevCgroup(vm, hostdev) < 0)
VIR_WARN("Failed to remove host device cgroup ACL");
--
2.7.3
8 years, 6 months
[libvirt] [PATCH 1/2] Add new elements source, access and allocation
by Safka, JaroslavX
This change introduces support for preallocated shared file descriptor based memory backing.
It allows vhost-user to be used without hugepages. This is achieved by introducing 3 new
sub elements to the memoryBacking element: source, access & allocation
which will configure qemu commandline during VM startup accordingly.
First patch adds parsing of elements and storing the values in mem structure.
Second patch configures the qemu commandline on the base of values in mem structure.
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
8 years, 6 months
[libvirt] [PATCH 0/3] configure: fix building with mpath
by Ján Tomko
Recently we've started adding --with-storage-mpath unconditionally
in the specfile.
This exposed a bug in our configure script where we would
define the WITH_STORAGE_MPATH pre-processor macro
only if we checked for mpath, not if it was requested.
Ján Tomko (3):
configure: define preprocessor macros for SCSI and MPATH
configure: error out when asked for mpath on non-Linux
configure: remove definition of HAVE_GLIBC_RPCGEN
configure.ac | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
--
2.7.3
8 years, 6 months
[libvirt] [PATCH] qemu: Fix alignment in virDomainDefAddController() call
by Andrea Bolognani
---
Pushed as oh-so-very-trivial.
src/qemu/qemu_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2fe59d7..1eb5644 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1957,7 +1957,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
*/
if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1) < 0 &&
!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
- VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
+ VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
goto cleanup;
}
--
2.5.5
8 years, 6 months
[libvirt] [PATCH 0/2] Perf event fixes follow up
by Peter Krempa
Add/fix at least some virsh documentation for the perf events and remove the
rather useless schema-test XML.
Peter Krempa (2):
docs: virsh: Add minimal documentation for 'mbmt' and 'mbml' perf
events
tests: schema: Remove useless perf schema data
tests/domainschemadata/domain-perf-simple.xml | 20 --------------------
tools/virsh.pod | 11 ++++++++---
2 files changed, 8 insertions(+), 23 deletions(-)
delete mode 100644 tests/domainschemadata/domain-perf-simple.xml
--
2.8.3
8 years, 6 months
[libvirt] [PATCH 00/10] Add new CPU model for Skylake CPUs
by Jiri Denemark
This series applies on top of "Another round of CPU driver patches" I
sent earlier today.
Jiri Denemark (10):
qemumonitorjsontest: Add getcpu test data
cpu_x86: Prepare for ecx_in CPUID parameter
cpu_x86: Add full support for ecx_in CPUID parameter
cpu: Shorten eax_in values in CPU map
cpu: Sort CPU map features on eax_in
cpu: Add x86 feature flags for CPUID leaf 0xd, sub leaf 1
cpu: Add ARAT x86 CPU feature
cpu: Add Skylake-Client x86 CPU model
cputest: Rename nehalem-force to penryn-force
cpu_x86: Use signature in CPU detection code
src/cpu/cpu_map.xml | 341 +++++++++------
src/cpu/cpu_x86.c | 476 +++++++++++++++++++--
src/cpu/cpu_x86_data.h | 1 +
src/qemu/qemu_monitor_json.c | 4 +
tests/cputest.c | 4 +-
tests/cputestdata/x86-cpuid-A10-5800K-guest.xml | 2 +-
tests/cputestdata/x86-cpuid-A10-5800K-host.xml | 2 +-
tests/cputestdata/x86-cpuid-A10-5800K-json.xml | 4 +-
tests/cputestdata/x86-cpuid-Core-i5-2500-guest.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i5-2500-host.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i5-2500-json.xml | 2 +
.../cputestdata/x86-cpuid-Core-i5-2540M-guest.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i5-2540M-host.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i5-2540M-json.xml | 2 +
.../cputestdata/x86-cpuid-Core-i5-4670T-guest.xml | 3 +-
tests/cputestdata/x86-cpuid-Core-i5-4670T-host.xml | 3 +-
tests/cputestdata/x86-cpuid-Core-i5-4670T-json.xml | 3 +-
tests/cputestdata/x86-cpuid-Core-i5-6600-guest.xml | 10 +-
tests/cputestdata/x86-cpuid-Core-i5-6600-host.xml | 10 +-
tests/cputestdata/x86-cpuid-Core-i5-6600-json.xml | 10 +-
tests/cputestdata/x86-cpuid-Core-i7-2600-guest.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i7-2600-host.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i7-2600-json.xml | 1 +
.../cputestdata/x86-cpuid-Core-i7-3520M-guest.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i7-3520M-host.xml | 2 +
.../cputestdata/x86-cpuid-Core-i7-3740QM-guest.xml | 1 +
.../cputestdata/x86-cpuid-Core-i7-3740QM-host.xml | 1 +
.../cputestdata/x86-cpuid-Core-i7-3740QM-json.xml | 1 +
tests/cputestdata/x86-cpuid-Core-i7-3770-guest.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i7-3770-host.xml | 2 +
tests/cputestdata/x86-cpuid-Core-i7-3770-json.xml | 1 +
.../cputestdata/x86-cpuid-Core-i7-4600U-guest.xml | 4 +-
tests/cputestdata/x86-cpuid-Core-i7-4600U-host.xml | 4 +-
tests/cputestdata/x86-cpuid-Core-i7-4600U-json.xml | 4 +-
.../cputestdata/x86-cpuid-Core-i7-5600U-guest.xml | 4 +-
tests/cputestdata/x86-cpuid-Core-i7-5600U-host.xml | 4 +-
tests/cputestdata/x86-cpuid-Core-i7-5600U-json.xml | 11 +-
tests/cputestdata/x86-cpuid-Core2-E6850-guest.xml | 5 +-
tests/cputestdata/x86-cpuid-Core2-E6850-host.xml | 5 +-
tests/cputestdata/x86-cpuid-Opteron-6234-json.xml | 3 +-
.../cputestdata/x86-cpuid-Pentium-P6100-guest.xml | 1 +
tests/cputestdata/x86-cpuid-Pentium-P6100-host.xml | 1 +
tests/cputestdata/x86-cpuid-Xeon-5110-guest.xml | 5 +-
tests/cputestdata/x86-cpuid-Xeon-5110-host.xml | 5 +-
tests/cputestdata/x86-cpuid-Xeon-E3-1245-guest.xml | 10 +-
tests/cputestdata/x86-cpuid-Xeon-E3-1245-host.xml | 10 +-
tests/cputestdata/x86-cpuid-Xeon-E3-1245-json.xml | 9 +-
tests/cputestdata/x86-cpuid-Xeon-E5-2630-guest.xml | 4 +-
tests/cputestdata/x86-cpuid-Xeon-E5-2630-host.xml | 4 +-
tests/cputestdata/x86-cpuid-Xeon-E5-2630-json.xml | 3 +-
tests/cputestdata/x86-cpuid-Xeon-E5-2650-guest.xml | 4 +-
tests/cputestdata/x86-cpuid-Xeon-E5-2650-host.xml | 4 +-
tests/cputestdata/x86-cpuid-Xeon-E7-4820-guest.xml | 1 +
tests/cputestdata/x86-cpuid-Xeon-E7-4820-host.xml | 1 +
tests/cputestdata/x86-cpuid-Xeon-E7-4820-json.xml | 2 +-
tests/cputestdata/x86-cpuid-Xeon-W3520-json.xml | 2 +-
.../cputestdata/x86-host+nehalem-force-result.xml | 4 -
tests/cputestdata/x86-host+penryn-force-result.xml | 6 +
...{x86-nehalem-force.xml => x86-penryn-force.xml} | 0
.../qemumonitorjson-getcpu-ecx.data | 7 +
.../qemumonitorjson-getcpu-ecx.json | 57 +++
.../qemumonitorjson-getcpu-full.data | 6 +-
.../qemumonitorjson-getcpu-host.data | 8 +-
tests/qemumonitorjsontest.c | 1 +
64 files changed, 853 insertions(+), 248 deletions(-)
delete mode 100644 tests/cputestdata/x86-host+nehalem-force-result.xml
create mode 100644 tests/cputestdata/x86-host+penryn-force-result.xml
rename tests/cputestdata/{x86-nehalem-force.xml => x86-penryn-force.xml} (100%)
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.data
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.json
--
2.8.4
8 years, 6 months
[libvirt] [PATCH 0/2] conf: Tweak how we calculate memory sizes
by Peter Krempa
Patches that allowed to use memory hotplug without NUMA introduced a problem
where the size in <memory> wouldn't be right after memory cold unplug.
See patch 1/2 for explanation.
Peter Krempa (2):
conf: Remove pre-calculation of initial memory size
conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal
src/bhyve/bhyve_driver.c | 2 +-
src/conf/domain_audit.c | 2 +-
src/conf/domain_conf.c | 103 ++++++++++++++++++++++++---------------------
src/conf/domain_conf.h | 5 +--
src/libvirt_private.syms | 3 +-
src/libxl/libxl_driver.c | 6 +--
src/lxc/lxc_driver.c | 10 ++---
src/lxc/lxc_fuse.c | 6 +--
src/openvz/openvz_driver.c | 2 +-
src/qemu/qemu_domain.c | 12 +++---
src/qemu/qemu_driver.c | 16 +++----
src/qemu/qemu_hotplug.c | 4 +-
src/qemu/qemu_process.c | 4 +-
src/test/test_driver.c | 6 +--
src/uml/uml_driver.c | 6 +--
src/vmware/vmware_driver.c | 2 +-
src/vmx/vmx.c | 10 ++---
src/vz/vz_driver.c | 4 +-
src/vz/vz_sdk.c | 6 +--
src/xen/xm_internal.c | 8 ++--
src/xenapi/xenapi_utils.c | 4 +-
src/xenconfig/xen_common.c | 2 +-
src/xenconfig/xen_sxpr.c | 6 +--
23 files changed, 116 insertions(+), 113 deletions(-)
--
2.8.3
8 years, 6 months
[libvirt] [PATCH 0/3] perf: Unbreak virsh and XML parser
by Peter Krempa
Yet another breakage in the perf event code. Add missing docs, fix schemas and
rewrite the XML parser since it was broken.
Peter Krempa (3):
qemu: perf: Don't set state of first event for every other event
docs: Add at least some docs and fix schema entry for perf events
conf: Fix perf event parser
docs/formatdomain.html.in | 44 +++++++++++++++++++++++++++
docs/schemas/domaincommon.rng | 2 ++
src/conf/domain_conf.c | 47 ++++++++++++-----------------
src/qemu/qemu_driver.c | 2 +-
tests/genericxml2xmlindata/generic-perf.xml | 22 ++++++++++++++
tests/genericxml2xmltest.c | 2 ++
6 files changed, 90 insertions(+), 29 deletions(-)
create mode 100644 tests/genericxml2xmlindata/generic-perf.xml
--
2.8.3
8 years, 6 months