[libvirt] Reproducible live disk detach bug
by Frank Schreuder
Hey guys,
I am currently running into a reproducible libvirt bug when I detach a
disk from a running VM using libvirt 1.2.18 and qemu 2.3.0.
I can attach a disk to a running VM without any problems.
During the attach operation I don't create a disk alias name, which
results in libvirt generating an unique alias.
Using virsh dumpxml I get the following output(snippet):
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/local/mnt/test-storage/test-storage.raw'/>
<backingStore/>
<target dev='vde' bus='virtio'/>
<iotune>
<read_bytes_sec>94371840</read_bytes_sec>
<write_bytes_sec>31457280</write_bytes_sec>
<read_iops_sec>1000</read_iops_sec>
<write_iops_sec>200</write_iops_sec>
</iotune>
<alias name='virtio-disk4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09'
function='0x0'/>
</disk>
As you can see, libvirt generates 'virtio-disk4' as an alias. But as
soon as I try to detach the disk from the running VM, I will receive the
following two errors in my libvirt log:
2015-08-06 10:48:59.943+0000: 11657: warning :
qemuMonitorJSONHandleDeviceDeleted:939 : missing device in device
deleted event
2015-08-06 10:48:59.945+0000: 11662: error :
qemuMonitorTextDriveDel:2594 : operation failed: deleting
drive-virtio-disk4 drive failed: 2015-08-06T10:48:59.945058Z Device
'drive-virtio-disk4' not found
Apparently libvirt tries to detach the disk with a drive- prefix, which
doesn't exist? The drive seems to detach correctly though.
I hope somebody with more extensive knowledge about libvirt can help me
solve this issue. If more information is needed, feel free to contact me.
Thanks,
Frank
9 years, 3 months
[libvirt] PING-2: [PATCH v5 0/4] qemu: Allow PCI virtio on ARM "virt" machine
by Pavel Fedin
Hello! Can anybody tell me what is wrong with this? Ignored for a long time.
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
> -----Original Message-----
> From: libvir-list-bounces(a)redhat.com [mailto:libvir-list-bounces@redhat.com] On Behalf Of Pavel
> Fedin
> Sent: Friday, July 17, 2015 2:28 PM
> To: libvir-list(a)redhat.com
> Cc: Peter Krempa
> Subject: [libvirt] [PATCH v5 0/4] qemu: Allow PCI virtio on ARM "virt" machine
>
> Virt machine in qemu since v2.3.0 has PCI generic host controller, and
> can use PCI devices. This provides performance improvement as well as
> vhost-net with irqfd support for virtio-net. However libvirt currently
> does not allow ARM virt machine to have PCI devices. This patchset adds
> the necessary support.
>
> Changes since v4:
> - Rebased onto current master
> - Added possibility to plug virtio-net-pci adapter directly into PCIe bus.
> This is necessary for irqfds to work in qemu.
> Changes since v3:
> - Capability is based not on qemu version but on support of "gpex-pcihost"
> device by qemu
> - Added a workaround, allowing to pass "make check". The problem is that
> test suite does not build capabilities cache. Unfortunately this means
> that correct unit-test for the new functionality currently cannot be
> written. Test suite framework needs to be improved.
> Changes since v2:
> Complete rework, use different approach
> - Correctly model PCI Express bus on the machine. It is now possible to
> explicitly specify <address-type='pci'> with attributes. This allows to
> attach not only virtio, but any other PCI device to the model.
> - Default is not changed and still mmio, for backwards compatibility with
> existing installations. PCI bus has to be explicitly specified.
> - Check for the capability in correct place, in v2 it actually did not
> work
> Changes since v1:
> - Added capability based on qemu version number
> - Recognize also "virt-" prefix
>
> Pavel Fedin (4):
> qemu: Introduce QEMU_CAPS_OBJECT_GPEX
> Add PCI-Express root to ARM virt machine
> Build correct command line for PCI NICs on ARM
> Allow to plug virtio-net-pci into PCIe slot
>
> src/qemu/qemu_capabilities.c | 10 ++++++++++
> src/qemu/qemu_capabilities.h | 1 +
> src/qemu/qemu_command.c | 11 ++++++++++-
> src/qemu/qemu_domain.c | 17 +++++++++++++----
> 4 files changed, 34 insertions(+), 5 deletions(-)
>
> --
> 1.9.5.msysgit.0
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
9 years, 3 months
[libvirt] [PATCH] Allow vfio hotplug of a device to the domain which owns the iommu
by Shivaprasad G Bhat
The commit 7e72de4 didn't consider the hotplug scenarios. The patch addresses
the hotplug case whereby if atleast one of the pci function is owned by a
guest, the hotplug of other functions/devices in the same iommu group to the
same guest goes through successfully.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/util/virhostdev.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 809caed..529753c 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -54,23 +54,35 @@ static virClassPtr virHostdevManagerClass;
static void virHostdevManagerDispose(void *obj);
static virHostdevManagerPtr virHostdevManagerNew(void);
+struct virHostdevIsPCINodeDeviceUsedData {
+ virHostdevManagerPtr hostdev_mgr;
+ const char *domainName;
+ const bool usesVfio;
+};
+
static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddressPtr devAddr, void *opaque)
{
virPCIDevicePtr other;
int ret = -1;
virPCIDevicePtr pci = NULL;
- virHostdevManagerPtr hostdev_mgr = opaque;
+ struct virHostdevIsPCINodeDeviceUsedData *helperData = opaque;
if (!(pci = virPCIDeviceNew(devAddr->domain, devAddr->bus,
devAddr->slot, devAddr->function)))
goto cleanup;
- other = virPCIDeviceListFind(hostdev_mgr->activePCIHostdevs, pci);
+ other = virPCIDeviceListFind(helperData->hostdev_mgr->activePCIHostdevs,
+ pci);
if (other) {
const char *other_drvname = NULL;
const char *other_domname = NULL;
virPCIDeviceGetUsedBy(other, &other_drvname, &other_domname);
+ if (helperData->usesVfio &&
+ (other_domname && helperData->domainName) &&
+ (STREQ(other_domname, helperData->domainName)))
+ goto iommu_owner;
+
if (other_drvname && other_domname)
virReportError(VIR_ERR_OPERATION_INVALID,
_("PCI device %s is in use by "
@@ -83,6 +95,7 @@ static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddressPtr devAddr, void *o
virPCIDeviceGetName(pci));
goto cleanup;
}
+ iommu_owner:
ret = 0;
cleanup:
virPCIDeviceFree(pci);
@@ -562,6 +575,9 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
bool strict_acs_check = !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK);
+ bool usesVfio = STREQ(virPCIDeviceGetStubDriver(dev), "vfio-pci");
+ struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, dom_name,
+ usesVfio};
if (!virPCIDeviceIsAssignable(dev, strict_acs_check)) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -579,12 +595,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
* belonging to same iommu group can't be shared
* across guests.
*/
- if (STREQ(virPCIDeviceGetStubDriver(dev), "vfio-pci")) {
+ if (usesVfio) {
if (virPCIDeviceAddressIOMMUGroupIterate(devAddr,
virHostdevIsPCINodeDeviceUsed,
- hostdev_mgr) < 0)
+ &data) < 0)
goto cleanup;
- } else if (virHostdevIsPCINodeDeviceUsed(devAddr, hostdev_mgr)) {
+ } else if (virHostdevIsPCINodeDeviceUsed(devAddr, &data)) {
goto cleanup;
}
}
@@ -1544,6 +1560,8 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci)
{
virPCIDeviceAddressPtr devAddr = NULL;
+ struct virHostdevIsPCINodeDeviceUsedData data = { hostdev_mgr, NULL,
+ false };
int ret = -1;
virObjectLock(hostdev_mgr->activePCIHostdevs);
@@ -1552,7 +1570,7 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
if (!(devAddr = virPCIDeviceGetAddress(pci)))
goto out;
- if (virHostdevIsPCINodeDeviceUsed(devAddr, hostdev_mgr))
+ if (virHostdevIsPCINodeDeviceUsed(devAddr, &data))
goto out;
if (virPCIDeviceDetach(pci, hostdev_mgr->activePCIHostdevs,
@@ -1573,6 +1591,8 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
virPCIDevicePtr pci)
{
virPCIDeviceAddressPtr devAddr = NULL;
+ struct virHostdevIsPCINodeDeviceUsedData data = {hostdev_mgr, NULL,
+ false};
int ret = -1;
virObjectLock(hostdev_mgr->activePCIHostdevs);
@@ -1581,7 +1601,7 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
if (!(devAddr = virPCIDeviceGetAddress(pci)))
goto out;
- if (virHostdevIsPCINodeDeviceUsed(devAddr, hostdev_mgr))
+ if (virHostdevIsPCINodeDeviceUsed(devAddr, &data))
goto out;
virPCIDeviceReattachInit(pci);
9 years, 3 months
[libvirt] Reproducible live disk detach bug
by Frank Schreuder
Hey guys,
I am currently running into a reproducible libvirt bug when I detach a
disk from a running VM using libvirt 1.2.18 and qemu 2.3.0.
I can attach a disk to a running VM without any problems.
During the attach operation I don't create a disk alias name, which
results in libvirt generating an unique alias.
Using virsh dumpxml I get the following output(snippet):
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/local/mnt/test-storage/test-storage.raw'/>
<backingStore/>
<target dev='vde' bus='virtio'/>
<iotune>
<read_bytes_sec>94371840</read_bytes_sec>
<write_bytes_sec>31457280</write_bytes_sec>
<read_iops_sec>1000</read_iops_sec>
<write_iops_sec>200</write_iops_sec>
</iotune>
<alias name='virtio-disk4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>
As you can see, libvirt generates 'virtio-disk4' as an alias. But as
soon as I try to detach the disk from the running VM, I will receive the
following two errors in my libvirt log:
2015-08-06 10:48:59.943+0000: 11657: warning :
qemuMonitorJSONHandleDeviceDeleted:939 : missing device in device
deleted event
2015-08-06 10:48:59.945+0000: 11662: error :
qemuMonitorTextDriveDel:2594 : operation failed: deleting
drive-virtio-disk4 drive failed: 2015-08-06T10:48:59.945058Z Device
'drive-virtio-disk4' not found
Apparently libvirt tries to detach the disk with a drive- prefix, which
doesn't exist? The drive seems to detach correctly though.
I hope somebody with more extensive knowledge about libvirt can help me
solve this issue. If more information is needed, feel free to contact me.
Thanks,
Frank
9 years, 3 months
[libvirt] [PATCH] qemuDomainDefPostParse: Adjust indent
by Michal Privoznik
While reviewing e8d551725 I've noticed a few unaligned lines.
Fix this.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
src/qemu/qemu_domain.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 560929a..ad9a8ac 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1024,10 +1024,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
}
if (STRPREFIX(def->os.machine, "pc-q35") ||
STREQ(def->os.machine, "q35")) {
- addPCIeRoot = true;
- addDefaultUSB = false;
- addImplicitSATA = true;
- break;
+ addPCIeRoot = true;
+ addDefaultUSB = false;
+ addImplicitSATA = true;
+ break;
}
if (!STRPREFIX(def->os.machine, "pc-0.") &&
!STRPREFIX(def->os.machine, "pc-1.") &&
--
2.4.6
9 years, 3 months
[libvirt] [PATCH] bootstrap: Don't require python-config
by Michal Privoznik
We've split the python bindings a long time ago. However,
we are still requiring python-config (as an obfuscation to
python-devel). This does not make any sense. The only thing
we need is python, not python-devel.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
bootstrap.conf | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index c06ee4c..783b3a3 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -196,10 +196,7 @@ local_gl_dir=gnulib/local
# Build prerequisites
# Note that some of these programs are only required for 'make dist' to
# succeed from a fresh git checkout; not all of these programs are
-# required to run 'make dist' on a tarball. As a special case, we want
-# to require the equivalent of the Fedora python-devel package, but
-# RHEL 5 lacks the witness python-config package; we hack around that
-# old environment below.
+# required to run 'make dist' on a tarball.
buildreq="\
autoconf 2.59
automake 1.9.6
@@ -212,19 +209,11 @@ patch -
perl 5.5
perl::XML::XPath -
pkg-config -
-python-config -
rpcgen -
tar -
xmllint -
xsltproc -
"
-# Use rpm as a fallback to bypass the bootstrap probe for python-config,
-# for the sake of RHEL 5; without requiring it on newer systems that
-# have python-config to begin with.
-if `(${PYTHON_CONFIG-python-config} --version;
- test $? -lt 126 || rpm -q python-devel) >/dev/null 2>&1`; then
- PYTHON_CONFIG=true
-fi
# Automake requires that ChangeLog and AUTHORS exist.
touch AUTHORS ChangeLog || exit 1
--
2.3.6
9 years, 3 months
[libvirt] 'stack smashing detected' in 1.2.18 (caused by virNetDevGFeatureAvailable)
by Brian Rak
I recently compiled 1.2.18 to start testing with it, and was getting
this error on startup:
*** stack smashing detected ***: libvirtd terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7fe1ac631527]
/lib64/libc.so.6(__fortify_fail+0x0)[0x7fe1ac6314f0]
//lib/libvirt.so.0(+0xa7927)[0x7fe1aeda2927]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0x947d)[0x7fe1958a047d]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0xa6c2)[0x7fe1958a16c2]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0xaf4e)[0x7fe1958a1f4e]
//lib/libvirt.so.0(virStateInitialize+0xb8)[0x7fe1aee6d0a8]
libvirtd(+0x15120)[0x7fe1afae6120]
//lib/libvirt.so.0(+0xd4975)[0x7fe1aedcf975]
/lib64/libpthread.so.0(+0x30316079d1)[0x7fe1ada8c9d1]
/lib64/libc.so.6(clone+0x6d)[0x7fe1ac6178fd]
(gdb) bt
#0 0x00007ffff4a8f625 in raise () from /lib64/libc.so.6
#1 0x00007ffff4a90e05 in abort () from /lib64/libc.so.6
#2 0x00007ffff4acd537 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff4b5f527 in __fortify_fail () from /lib64/libc.so.6
#4 0x00007ffff4b5f4f0 in __stack_chk_fail () from /lib64/libc.so.6
#5 0x00007ffff72d0927 in virNetDevGetFeatures (ifname=<value optimized
out>, out=<value optimized out>) at util/virnetdev.c:3200
#6 0x00007fffdddce47d in udevProcessNetworkInterface
(device=0x7fffd4071f70, def=0x6) at node_device/node_device_udev.c:694
#7 udevGetDeviceDetails (device=0x7fffd4071f70, def=0x6) at
node_device/node_device_udev.c:1272
#8 0x00007fffdddcf6c2 in udevAddOneDevice (device=0x7fffd4071f70) at
node_device/node_device_udev.c:1394
#9 0x00007fffdddcff4e in udevProcessDeviceListEntry (privileged=<value
optimized out>, callback=<value optimized out>, opaque=<value optimized
out>)
at node_device/node_device_udev.c:1433
#10 udevEnumerateDevices (privileged=<value optimized out>,
callback=<value optimized out>, opaque=<value optimized out>) at
node_device/node_device_udev.c:1463
#11 nodeStateInitialize (privileged=<value optimized out>,
callback=<value optimized out>, opaque=<value optimized out>) at
node_device/node_device_udev.c:1773
#12 0x00007ffff739b0a8 in virStateInitialize (privileged=true,
callback=0x555555569070 <daemonInhibitCallback>, opaque=0x5555557f1db0)
at libvirt.c:777
#13 0x0000555555569120 in daemonRunStateInit (opaque=<value optimized
out>) at libvirtd.c:947
#14 0x00007ffff72fd975 in virThreadHelper (data=<value optimized out>)
at util/virthread.c:206
#15 0x00007ffff5fba9d1 in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff4b458fd in clone () from /lib64/libc.so.6
In IRC, we tracked this down to this bit of code:
g_cmd.cmd = ETHTOOL_GFEATURES;
g_cmd.size = GFEATURES_SIZE;
if (virNetDevGFeatureAvailable(ifname, &g_cmd))
ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
GFEATURES_SIZE is currently defined as 2, but this value needs to be
higher in order to support newer kernels. It looks like this code was
added in ac3ed2085fcbeecaf5aa347c0b1bffaf94fff293
ethtool calculates this value based on the number of supported features:
http://lxr.free-electrons.com/source/net/core/ethtool.c#L55
I don't know enough about this to properly fix this, but raising
GFEATURES_SIZE to 3 has fixed this issue for me (though, this will
obviously need to go higher as more features get added)
This crash was occurring on a CentOS 6 system, running a the ELRepo
kernel-ml kernel. The stock CentOS 6 kernel (2.6.32) does not appear to
have sufficient features available to trigger this.
9 years, 3 months
[libvirt] [libvirt-php][PATCH v1] snapshot flags
by Vasiliy Tolstov
* add more snapshot flag constants
* add flags support to snapshot functions
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 61 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 49 insertions(+), 12 deletions(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index d13e5b4..a2949f1 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1240,6 +1240,31 @@ PHP_MINIT_FUNCTION(libvirt)
/* Domain snapshot constants */
REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_CHILDREN", VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_METADATA_ONLY", VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_CHILDREN_ONLY", VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_REDEFINE", VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_CURRENT", VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_NO_METADATA", VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_HALT", VIR_DOMAIN_SNAPSHOT_CREATE_HALT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_DISK_ONLY", VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_REUSE_EXT", VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_QUIESCE", VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_ATOMIC", VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_LIVE", VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_DESCENDANTS", VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_ROOTS", VIR_DOMAIN_SNAPSHOT_LIST_ROOTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_METADATA", VIR_DOMAIN_SNAPSHOT_LIST_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_LEAVES", VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_NO_LEAVES", VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_NO_METADATA", VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_INACTIVE", VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_ACTIVE", VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_DISK_ONLY", VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_INTERNAL", VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_EXTERNAL", VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_RUNNING", VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_PAUSED", VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_FORCE", VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, CONST_CS | CONST_PERSISTENT);
/* Memory constants */
REGISTER_LONG_CONSTANT("VIR_MEMORY_VIRTUAL", 1, CONST_CS | CONST_PERSISTENT);
@@ -6568,6 +6593,7 @@ PHP_FUNCTION(libvirt_domain_get_job_info)
* Since version: 0.4.1(-2)
* Description: Function is used to get the information whether domain has the current snapshot
* Arguments: @res [resource]: libvirt domain resource
+ * @flags [int]: libvirt snapshot flags
* Returns: TRUE is domain has the current snapshot, otherwise FALSE (you may need to check for error using libvirt_get_last_error())
*/
PHP_FUNCTION(libvirt_domain_has_current_snapshot)
@@ -6575,10 +6601,11 @@ PHP_FUNCTION(libvirt_domain_has_current_snapshot)
php_libvirt_domain *domain=NULL;
zval *zdomain;
int retval;
+ long flags = 0;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- retval=virDomainHasCurrentSnapshot(domain->domain, 0);
+ retval=virDomainHasCurrentSnapshot(domain->domain, flags);
if (retval <= 0) RETURN_FALSE;
RETURN_TRUE;
}
@@ -6589,6 +6616,7 @@ PHP_FUNCTION(libvirt_domain_has_current_snapshot)
* Description: This functions is used to lookup for the snapshot by it's name
* Arguments: @res [resource]: libvirt domain resource
* @name [string]: name of the snapshot to get the resource
+ * @flags [int]: libvirt snapshot flags
* Returns: domain snapshot resource
*/
PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
@@ -6597,13 +6625,14 @@ PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
zval *zdomain;
int name_len;
char *name=NULL;
+ long flags = 0;
php_libvirt_snapshot *res_snapshot;
virDomainSnapshotPtr snapshot = NULL;
- GET_DOMAIN_FROM_ARGS("rs",&zdomain,&name,&name_len);
+ GET_DOMAIN_FROM_ARGS("rs|l",&zdomain,&name,&name_len,&flags);
if ( (name == NULL) || (name_len<1)) RETURN_FALSE;
- snapshot=virDomainSnapshotLookupByName(domain->domain, name, 0);
+ snapshot=virDomainSnapshotLookupByName(domain->domain, name, flags);
if (snapshot==NULL) RETURN_FALSE;
res_snapshot = (php_libvirt_snapshot *)emalloc(sizeof(php_libvirt_snapshot));
@@ -6620,6 +6649,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
* Since version: 0.4.1(-2)
* Description: This function creates the domain snapshot for the domain identified by it's resource
* Arguments: @res [resource]: libvirt domain resource
+ * @flags [int]: libvirt snapshot flags
* Returns: domain snapshot resource
*/
PHP_FUNCTION(libvirt_domain_snapshot_create)
@@ -6628,10 +6658,11 @@ PHP_FUNCTION(libvirt_domain_snapshot_create)
php_libvirt_snapshot *res_snapshot;
zval *zdomain;
virDomainSnapshotPtr snapshot = NULL;
+ long flags = 0;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- snapshot=virDomainSnapshotCreateXML(domain->domain, "<domainsnapshot/>", 0);
+ snapshot=virDomainSnapshotCreateXML(domain->domain, "<domainsnapshot/>", flags);
DPRINTF("%s: virDomainSnapshotCreateXML(%p, <xml>) returned %p\n", PHPFUNC, domain->domain, snapshot);
if (snapshot == NULL) RETURN_FALSE;
@@ -6649,6 +6680,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_create)
* Since version: 0.4.1(-2)
* Description: Function is used to get the XML description of the snapshot identified by it's resource
* Arguments: @res [resource]: libvirt snapshot resource
+ * @flags [int]: libvirt snapshot flags
* Returns: XML description string for the snapshot
*/
PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
@@ -6657,10 +6689,11 @@ PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
char *xml_out;
zval *zsnapshot;
php_libvirt_snapshot *snapshot;
+ long flags = 0;
- GET_SNAPSHOT_FROM_ARGS("r",&zsnapshot);
+ GET_SNAPSHOT_FROM_ARGS("r|l",&zsnapshot, &flags);
- xml = virDomainSnapshotGetXMLDesc(snapshot->snapshot, 0);
+ xml = virDomainSnapshotGetXMLDesc(snapshot->snapshot, flags);
if (xml==NULL) RETURN_FALSE;
RECREATE_STRING_WITH_E(xml_out,xml);
@@ -6673,6 +6706,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
* Since version: 0.4.1(-2)
* Description: Function is used to revert the domain state to the state identified by the snapshot
* Arguments: @res [resource]: libvirt snapshot resource
+ * @flags [int]: libvirt snapshot flags
* Returns: TRUE on success, FALSE on error
*/
PHP_FUNCTION(libvirt_domain_snapshot_revert)
@@ -6680,10 +6714,11 @@ PHP_FUNCTION(libvirt_domain_snapshot_revert)
zval *zsnapshot;
php_libvirt_snapshot *snapshot;
int ret;
+ long flags = 0;
- GET_SNAPSHOT_FROM_ARGS("r",&zsnapshot);
+ GET_SNAPSHOT_FROM_ARGS("r|l",&zsnapshot, &flags);
- ret = virDomainRevertToSnapshot(snapshot->snapshot, 0);
+ ret = virDomainRevertToSnapshot(snapshot->snapshot, flags);
DPRINTF("%s: virDomainRevertToSnapshot(%p, 0) returned %d\n", PHPFUNC, snapshot->snapshot, ret);
if (ret == -1) RETURN_FALSE;
RETURN_TRUE;
@@ -6717,6 +6752,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_delete)
* Since version: 0.4.1(-2)
* Description: Function is used to list domain snapshots for the domain specified by it's resource
* Arguments: @res [resource]: libvirt domain resource
+ * @flags [int]: libvirt snapshot flags
* Returns: libvirt domain snapshot names array
*/
PHP_FUNCTION(libvirt_list_domain_snapshots)
@@ -6726,11 +6762,12 @@ PHP_FUNCTION(libvirt_list_domain_snapshots)
int count=-1;
int expectedcount=-1;
char **names;
+ long flags = 0;
int i;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- expectedcount=virDomainSnapshotNum(domain->domain, 0);
+ expectedcount=virDomainSnapshotNum(domain->domain, flags);
DPRINTF("%s: virDomainSnapshotNum(%p, 0) returned %d\n", PHPFUNC, domain->domain, expectedcount);
if (expectedcount != -1 ) {
--
2.3.3
9 years, 3 months
[libvirt] 'stack smashing detected' in 1.2.18 (caused by virNetDevGFeatureAvailable)
by Brian Rak
I recently compiled 1.2.18 to start testing with it, and was getting
this error on startup:
*** stack smashing detected ***: libvirtd terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7fe1ac631527]
/lib64/libc.so.6(__fortify_fail+0x0)[0x7fe1ac6314f0]
//lib/libvirt.so.0(+0xa7927)[0x7fe1aeda2927]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0x947d)[0x7fe1958a047d]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0xa6c2)[0x7fe1958a16c2]
//lib/libvirt/connection-driver/libvirt_driver_nodedev.so(+0xaf4e)[0x7fe1958a1f4e]
//lib/libvirt.so.0(virStateInitialize+0xb8)[0x7fe1aee6d0a8]
libvirtd(+0x15120)[0x7fe1afae6120]
//lib/libvirt.so.0(+0xd4975)[0x7fe1aedcf975]
/lib64/libpthread.so.0(+0x30316079d1)[0x7fe1ada8c9d1]
/lib64/libc.so.6(clone+0x6d)[0x7fe1ac6178fd]
(gdb) bt
#0 0x00007ffff4a8f625 in raise () from /lib64/libc.so.6
#1 0x00007ffff4a90e05 in abort () from /lib64/libc.so.6
#2 0x00007ffff4acd537 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff4b5f527 in __fortify_fail () from /lib64/libc.so.6
#4 0x00007ffff4b5f4f0 in __stack_chk_fail () from /lib64/libc.so.6
#5 0x00007ffff72d0927 in virNetDevGetFeatures (ifname=<value optimized
out>, out=<value optimized out>) at util/virnetdev.c:3200
#6 0x00007fffdddce47d in udevProcessNetworkInterface
(device=0x7fffd4071f70, def=0x6) at node_device/node_device_udev.c:694
#7 udevGetDeviceDetails (device=0x7fffd4071f70, def=0x6) at
node_device/node_device_udev.c:1272
#8 0x00007fffdddcf6c2 in udevAddOneDevice (device=0x7fffd4071f70) at
node_device/node_device_udev.c:1394
#9 0x00007fffdddcff4e in udevProcessDeviceListEntry (privileged=<value
optimized out>, callback=<value optimized out>, opaque=<value optimized
out>)
at node_device/node_device_udev.c:1433
#10 udevEnumerateDevices (privileged=<value optimized out>,
callback=<value optimized out>, opaque=<value optimized out>) at
node_device/node_device_udev.c:1463
#11 nodeStateInitialize (privileged=<value optimized out>,
callback=<value optimized out>, opaque=<value optimized out>) at
node_device/node_device_udev.c:1773
#12 0x00007ffff739b0a8 in virStateInitialize (privileged=true,
callback=0x555555569070 <daemonInhibitCallback>, opaque=0x5555557f1db0)
at libvirt.c:777
#13 0x0000555555569120 in daemonRunStateInit (opaque=<value optimized
out>) at libvirtd.c:947
#14 0x00007ffff72fd975 in virThreadHelper (data=<value optimized out>)
at util/virthread.c:206
#15 0x00007ffff5fba9d1 in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff4b458fd in clone () from /lib64/libc.so.6
In IRC, we tracked this down to this bit of code:
g_cmd.cmd = ETHTOOL_GFEATURES;
g_cmd.size = GFEATURES_SIZE;
if (virNetDevGFeatureAvailable(ifname, &g_cmd))
ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
GFEATURES_SIZE is currently defined as 2, but this value needs to be
higher in order to support newer kernels. It looks like this code was
added in ac3ed2085fcbeecaf5aa347c0b1bffaf94fff293
ethtool calculates this value based on the number of supported features:
http://lxr.free-electrons.com/source/net/core/ethtool.c#L55
I don't know enough about this to properly fix this, but raising
GFEATURES_SIZE to 3 has fixed this issue for me (though, this will
obviously need to go higher as more features get added)
This crash was occurring on a CentOS 6 system, running a the ELRepo
kernel-ml kernel. The stock CentOS 6 kernel (2.6.32) does not appear to
have sufficient features available to trigger this.
9 years, 3 months
[libvirt] [PATCH] qemu: Forbid image pre-creation for non-shared storage migration
by Peter Krempa
Libvirt doesn't reliably know the location of the backing chain when
pre-creating images for non-shared migration. This isn't a problem for
full copy, but incremental copy requires the information.
Forbid pre-creating the image in cases where incremental migration is
required. This limitation can perhaps be lifted once libvirt will fully
support loading of backing chain information from the XML.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1249587
---
src/qemu/qemu_migration.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 458b269..ff89ab5 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1613,7 +1613,8 @@ qemuMigrationPrecreateStorage(virConnectPtr conn,
virDomainObjPtr vm,
qemuMigrationCookieNBDPtr nbd,
size_t nmigrate_disks,
- const char **migrate_disks)
+ const char **migrate_disks,
+ bool incremental)
{
int ret = -1;
size_t i = 0;
@@ -1644,6 +1645,13 @@ qemuMigrationPrecreateStorage(virConnectPtr conn,
continue;
}
+ if (incremental) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("pre-creation of storage targets for incremental "
+ "storage migration is not supported"));
+ goto cleanup;
+ }
+
VIR_DEBUG("Proceeding with disk source %s", NULLSTR(diskSrcPath));
if (qemuMigrationPrecreateDisk(conn, disk, nbd->disks[i].capacity) < 0)
@@ -3339,7 +3347,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
}
if (qemuMigrationPrecreateStorage(dconn, driver, vm, mig->nbd,
- nmigrate_disks, migrate_disks) < 0)
+ nmigrate_disks, migrate_disks,
+ !!(flags & VIR_MIGRATE_NON_SHARED_INC)) < 0)
goto cleanup;
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
--
2.4.5
9 years, 3 months