[libvirt] [BUG] intermediate snapshot deleted
by Philipp Hahn
Hello,
I encountered another problem: snapshots are linked to there parent snapshot.
If the parent snapshot is deleted, the chain gets broken and deleting the
child snapshot terminates with an error message:
> error: Domain snapshot not found: no domain snapshot parent with matching
name '1291813671'
I can reproduce this using the following sequence of commands for my
test-domain called "test" using a singel qcow2 image:
# virsh snapshot-create test # 1291813670
# virsh snapshot-create test # 1291813671
# virsh snapshot-create test # 1291813672
# virsh snapshot-delete test 1291813671
# virsh snapshot-delete test 1291813672
Is this problem known (libvirt-0.8.3)?
Reverting to such an unlinked snapshot is still possible, but deleting it is
not.
Sincerely
Philipp Hahn
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 28359 Bremen fax: +49 421 22 232-99
http://www.univention.de
13 years, 11 months
[libvirt] [PATCH] Set bitmap size when allocating a bitmap
by Jim Fehlig
I began noticing a race when reserving VNC ports as described here
https://www.redhat.com/archives/libvir-list/2010-November/msg00379.html
Turns out that we were not initializing the size field of bitmap
struct when allocating the bitmap. This subsequently caused
virBitmapSetBit() to fail since bitmap->size is 0, hence we never
actually reserved the port.
---
src/util/bitmap.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/bitmap.c b/src/util/bitmap.c
index 1b0c9da..9741668 100644
--- a/src/util/bitmap.c
+++ b/src/util/bitmap.c
@@ -73,6 +73,7 @@ virBitmapPtr virBitmapAlloc(size_t size)
return NULL;
}
+ bitmap->size = size;
return bitmap;
}
--
1.7.3.1
13 years, 11 months
[libvirt] [PATCH] esx: Add support for storage volume deletion
by Matthias Bolte
---
src/esx/esx_storage_driver.c | 50 +++++++++++++++++++++++++++++++++++++++-
src/esx/esx_vi_generator.input | 7 +++++
2 files changed, 56 insertions(+), 1 deletions(-)
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index e6803c2..544551c 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -1377,6 +1377,54 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
static int
+esxStorageVolumeDelete(virStorageVolPtr volume, unsigned int flags)
+{
+ int result = -1;
+ esxPrivate *priv = volume->conn->storagePrivateData;
+ char *datastorePath = NULL;
+ esxVI_ManagedObjectReference *task = NULL;
+ esxVI_TaskInfoState taskInfoState;
+ char *taskInfoErrorMessage = NULL;
+
+ virCheckFlags(0, -1);
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ if (virAsprintf(&datastorePath, "[%s] %s", volume->pool, volume->name) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if (esxVI_DeleteVirtualDisk_Task(priv->primary, datastorePath,
+ priv->primary->datacenter->_reference,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->primary, task, NULL,
+ esxVI_Occurrence_None, priv->autoAnswer,
+ &taskInfoState, &taskInfoErrorMessage) < 0) {
+ goto cleanup;
+ }
+
+ if (taskInfoState != esxVI_TaskInfoState_Success) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"),
+ taskInfoErrorMessage);
+ goto cleanup;
+ }
+
+ result = 0;
+
+ cleanup:
+ VIR_FREE(datastorePath);
+ esxVI_ManagedObjectReference_Free(&task);
+ VIR_FREE(taskInfoErrorMessage);
+
+ return result;
+}
+
+
+
+static int
esxStorageVolumeGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
{
int result = -1;
@@ -1574,7 +1622,7 @@ static virStorageDriver esxStorageDriver = {
esxStorageVolumeLookupByPath, /* volLookupByPath */
esxStorageVolumeCreateXML, /* volCreateXML */
esxStorageVolumeCreateXMLFrom, /* volCreateXMLFrom */
- NULL, /* volDelete */
+ esxStorageVolumeDelete, /* volDelete */
NULL, /* volWipe */
esxStorageVolumeGetInfo, /* volGetInfo */
esxStorageVolumeDumpXML, /* volGetXMLDesc */
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index 4018c6e..bd2da11 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -735,6 +735,13 @@ method CreateVirtualDisk_Task returns ManagedObjectReference r
end
+method DeleteVirtualDisk_Task returns ManagedObjectReference r
+ ManagedObjectReference _this:VirtualDiskManager r
+ String name r
+ ManagedObjectReference datacenter o
+end
+
+
method DestroyPropertyFilter
ManagedObjectReference _this r
end
--
1.7.0.4
13 years, 11 months
[libvirt] [PATCH] esx: Add support for storage volume wiping
by Matthias Bolte
---
src/esx/esx_storage_driver.c | 50 +++++++++++++++++++++++++++++++++++++++-
src/esx/esx_vi_generator.input | 7 +++++
2 files changed, 56 insertions(+), 1 deletions(-)
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 544551c..12c8f5e 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -1425,6 +1425,54 @@ esxStorageVolumeDelete(virStorageVolPtr volume, unsigned int flags)
static int
+esxStorageVolumeWipe(virStorageVolPtr volume, unsigned int flags)
+{
+ int result = -1;
+ esxPrivate *priv = volume->conn->storagePrivateData;
+ char *datastorePath = NULL;
+ esxVI_ManagedObjectReference *task = NULL;
+ esxVI_TaskInfoState taskInfoState;
+ char *taskInfoErrorMessage = NULL;
+
+ virCheckFlags(0, -1);
+
+ if (esxVI_EnsureSession(priv->primary) < 0) {
+ return -1;
+ }
+
+ if (virAsprintf(&datastorePath, "[%s] %s", volume->pool, volume->name) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ if (esxVI_ZeroFillVirtualDisk_Task(priv->primary, datastorePath,
+ priv->primary->datacenter->_reference,
+ &task) < 0 ||
+ esxVI_WaitForTaskCompletion(priv->primary, task, NULL,
+ esxVI_Occurrence_None, priv->autoAnswer,
+ &taskInfoState, &taskInfoErrorMessage) < 0) {
+ goto cleanup;
+ }
+
+ if (taskInfoState != esxVI_TaskInfoState_Success) {
+ ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"),
+ taskInfoErrorMessage);
+ goto cleanup;
+ }
+
+ result = 0;
+
+ cleanup:
+ VIR_FREE(datastorePath);
+ esxVI_ManagedObjectReference_Free(&task);
+ VIR_FREE(taskInfoErrorMessage);
+
+ return result;
+}
+
+
+
+static int
esxStorageVolumeGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
{
int result = -1;
@@ -1623,7 +1671,7 @@ static virStorageDriver esxStorageDriver = {
esxStorageVolumeCreateXML, /* volCreateXML */
esxStorageVolumeCreateXMLFrom, /* volCreateXMLFrom */
esxStorageVolumeDelete, /* volDelete */
- NULL, /* volWipe */
+ esxStorageVolumeWipe, /* volWipe */
esxStorageVolumeGetInfo, /* volGetInfo */
esxStorageVolumeDumpXML, /* volGetXMLDesc */
esxStorageVolumeGetPath, /* volGetPath */
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index bd2da11..2d903e4 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -916,3 +916,10 @@ method WaitForUpdates returns UpdateSet r
ManagedObjectReference _this:PropertyCollector r
String version o
end
+
+
+method ZeroFillVirtualDisk_Task returns ManagedObjectReference r
+ ManagedObjectReference _this:VirtualDiskManager r
+ String name r
+ ManagedObjectReference datacenter o
+end
--
1.7.0.4
13 years, 11 months
[libvirt] [PATCH] qemu: Return SPICE ports on domain shutdown
by Jiri Denemark
Commit ed0d9f6c0cdd56f38ce31b8d9b5293162addaa23 added support for
automatic port allocation for SPICE but forgot to mark such ports as
unused when they are not used anymore.
---
src/qemu/qemu_driver.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1a26a50..1de6f4a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2491,6 +2491,19 @@ static int qemudNextFreePort(struct qemud_driver *driver,
}
+static void
+qemudReturnPort(struct qemud_driver *driver,
+ int port)
+{
+ if (port < QEMU_VNC_PORT_MIN)
+ return;
+
+ if (virBitmapClearBit(driver->reservedVNCPorts,
+ port - QEMU_VNC_PORT_MIN) < 0)
+ VIR_DEBUG("Could not mark port %d as unused", port);
+}
+
+
static int
qemuAssignPCIAddresses(virDomainDefPtr def)
{
@@ -2696,6 +2709,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (tlsPort < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Unable to find an unused SPICE TLS port"));
+ qemudReturnPort(driver, port);
goto cleanup;
}
}
@@ -3099,14 +3113,14 @@ retry:
*/
if ((vm->def->ngraphics == 1) &&
vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- vm->def->graphics[0]->data.vnc.autoport &&
- vm->def->graphics[0]->data.vnc.port >= QEMU_VNC_PORT_MIN) {
- if (virBitmapClearBit(driver->reservedVNCPorts,
- vm->def->graphics[0]->data.vnc.port - \
- QEMU_VNC_PORT_MIN) < 0) {
- VIR_DEBUG("virBitmapClearBit failed on bit %d",
- vm->def->graphics[0]->data.vnc.port - QEMU_VNC_PORT_MIN);
- }
+ vm->def->graphics[0]->data.vnc.autoport) {
+ qemudReturnPort(driver, vm->def->graphics[0]->data.vnc.port);
+ }
+ if ((vm->def->ngraphics == 1) &&
+ vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ vm->def->graphics[0]->data.spice.autoport) {
+ qemudReturnPort(driver, vm->def->graphics[0]->data.spice.port);
+ qemudReturnPort(driver, vm->def->graphics[0]->data.spice.tlsPort);
}
vm->pid = -1;
--
1.7.3.4
13 years, 11 months
[libvirt] API break from the VMware player driver
by Chris Lalancette
All,
I'll preface this by saying that I'm not 100% sure I'm correct. But I
still think there may be an API break that was introduced with the VMware
player driver. In include/libvirt/virterror.h, VIR_FROM_VMWARE was added to
the *middle* of the enum for virErrorDomain. If any clients of libvirt happen
to be using hardcoded numbers, then they will now have the wrong number for
everything after VIR_FROM_VMWARE.
Looking back through the history of virErrorDomain, it doesn't seem like this
is the first time this has happened. What's the thinking with virErrorDomain?
Part of the API, or up to the clients to properly use the named enums?
--
Chris Lalancette
13 years, 11 months
[libvirt] boot time delay for domains?
by Harald Dunkel
Hi folks,
Is there a global "boot time delay" configuration parameter
to make sure that the autostart domains are not started all
in parallel at boot time?
Any helpful comment would be highly appreciated.
Harri
13 years, 11 months
[libvirt] Test failures building libvirt 0.8.5 rpm on EL5
by Orion Poplawski
I thought I'd take a look at updating my libvirt stack on EL5.5. Building the
Fedora Rawhide 0.8.5 rpm in mock yields:
make check-TESTS
make[2]: Entering directory `/builddir/build/BUILD/libvirt-0.8.5/tests'
TEST: virshtest
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 40
!!!!!!! 47 FAIL
FAIL: virshtest
...
TEST: interfaceschematest
!!..!.!.....!..... 18 FAILED
FAIL: interfaceschematest
Expected? Cause for concern?
--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA/CoRA Division FAX: 303-415-9702
3380 Mitchell Lane orion(a)cora.nwra.com
Boulder, CO 80301 http://www.cora.nwra.com
13 years, 11 months
[libvirt] [PATCH] docs: fixed typo, added table of contents
by Justin Clift
---
docs/drvopenvz.html.in | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/docs/drvopenvz.html.in b/docs/drvopenvz.html.in
index e446b1a..485d209 100644
--- a/docs/drvopenvz.html.in
+++ b/docs/drvopenvz.html.in
@@ -2,6 +2,8 @@
<body>
<h1>OpenVZ container driver</h1>
+ <ul id="toc"></ul>
+
<p>
The OpenVZ driver for libvirt allows use and management of container
based virtualization on a Linux host OS. Prior to using the OpenVZ
@@ -11,11 +13,11 @@
undue trouble.
</p>
- <h2>Connections to OpenVZ driver</h2>
+ <h2><a name="connections">Connections to OpenVZ driver</a></h2>
<p>
The libvirt OpenVZ driver is a single-instance privileged driver,
- with a driver name of 'openvz'. Some example conection URIs for
+ with a driver name of 'openvz'. Some example connection URIs for
the libvirt driver are:
</p>
@@ -27,7 +29,7 @@ openvz+tcp://example.com/system (remote access, SASl/Kerberos)
openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
</pre>
- <h2>Notes on bridged networking</h2>
+ <h2><a name="notes">Notes on bridged networking</a></h2>
<p>
Bridged networking enables a guest domain (ie container) to have its
@@ -36,7 +38,7 @@ openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
the host OS.
</p>
- <h3>Host network devices</h3>
+ <h3><a name="host">Host network devices</a></h3>
<p>
One or more of the physical devices must be attached to a bridge. The
@@ -47,7 +49,7 @@ openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
physical device "eth0", or a bonding device "bond0".
</p>
- <h3>OpenVZ tools configuration</h3>
+ <h3><a name="tools">OpenVZ tools configuration</a></h3>
<p>
OpenVZ releases later than 3.0.23 ship with a standard network device
@@ -72,7 +74,7 @@ EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
</p>
- <h2>Example guest domain XML configuration</h2>
+ <h2><a name="example">Example guest domain XML configuration</a></h2>
<p>
The current libvirt OpenVZ driver has a restriction that the
--
1.7.3.2
13 years, 11 months
[libvirt] [PATCH] storage: Ignore dangling symbol link for filesystem pool
by Osier Yang
If there is a dangling symbol link in filesystem pool, the pool
will be failed to start or refresh, this patch is to fix it by
ignoring it with a warning log.
* src/storage/storage_backend.c
* src/storage/storage_backend_fs.c (update the comments)
---
src/storage/storage_backend.c | 9 ++++++++-
src/storage/storage_backend_fs.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 10ea33c..9504261 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -977,7 +977,8 @@ virStorageBackendForType(int type) {
/*
* Allows caller to silently ignore files with improper mode
*
- * Returns -1 on error, -2 if file mode is unexpected.
+ * Returns -1 on error, -2 if file mode is unexpected or the file
+ * is symbol link, and it's dangling.
*/
int
virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
@@ -986,6 +987,12 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
struct stat sb;
if ((fd = open(path, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
+ if (areadlink(path) != NULL) {
+ VIR_WARN("cannot open volume '%s': %s", path,
+ strerror(errno));
+ return -2;
+ }
+
virReportSystemError(errno,
_("cannot open volume '%s'"),
path);
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index d916d2d..242508c 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -651,7 +651,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
goto cleanup;
else {
/* Silently ignore non-regular files,
- * eg '.' '..', 'lost+found' */
+ * eg '.' '..', 'lost+found', dangling symbol link */
virStorageVolDefFree(vol);
vol = NULL;
continue;
--
1.7.3.2
13 years, 11 months