[libvirt] [PATCH] Don't put a semicolon on the end of a VIR_ENUM_IMPL.
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/conf/domain_conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 04c417e..ca4bc6e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -99,7 +99,7 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",
"pci",
"drive",
- "virtio-serial");
+ "virtio-serial")
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
"block",
--
1.7.2
14 years, 3 months
[libvirt] [PATCH] Fix a bogus warning when parsing <hostdev>
by Chris Lalancette
When parsing hostdev, the following message would be emitted:
10:17:19.052: error : virDomainHostdevDefParseXML:3748 : internal error unknown node alias
However, alias is appropriately parsed in
virDomainDeviceInfoParseXML anyway. Disable the error message
in the initial XML parsing loop.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/conf/domain_conf.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8721dd1..04c417e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3723,6 +3723,9 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "address")) {
+ /* address is parsed as part of virDomainDeviceInfoParseXML */
+ } else if (xmlStrEqual(cur->name, BAD_CAST "alias")) {
+ /* alias is parsed as part of virDomainDeviceInfoParseXML */
} else {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown node %s"), cur->name);
--
1.7.2
14 years, 3 months
[libvirt] default storage pool will not start
by Albert Hopkins
Long ago I had a VM that used a qcow image that was in the default
directory-based storage pool. Since then the VM and the image have been
deleted. But now libvirt will not start without the image file:
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/host.py", line 586, in
start_pool
pool.start()
File "/usr/share/virt-manager/virtManager/storagepool.py", line 67, in
start
self.pool.create(0)
File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1039, in
create
if ret == -1: raise libvirtError ('virStoragePoolCreate() failed',
pool=self)
libvirtError: cannot open volume
'/var/lib/libvirt/images/gstable.qcow2': No such file or directory
If I simply "touch" the file, then the pool starts. But I don't want it
around. No other vm's reference this file. I've tried deleting and
re-creating the pool. I've tried removing all the files in the pool,
removing the directory, mkdir'ing the directory and then re-creating the
pool, but it still will not start without that file. I've
grepped /etc/libvirt for the existence of that filename but it doesn't
exist.
For the life of me I can't figure out where libvirt is getting this
information from and why it thinks it needs this file.
14 years, 3 months
[libvirt] OpenBSD crash after "shutdown vm"
by Armando
Good evening all,
firstly I'd like to thank you for your wonderful job: it works nicely
and simplifies a lot my life :)
after saying that, I'd like to expose you a "bug" (not sure if I can
call it this way):
1. scenario:
as host I've configured a Ubuntu 10.04 with KVM + libvirt + LVM; I have
also configured 4 virtual machines, three of wich are OpenBSDs and the
other one is Linux (Fedora 13).
2. issue:
when I issue a shutdown to a OpenBSD guest using "virsh shutdown vm"
what happens is that the guest machine crashes. To be more precise it
seems a kernel panic becuase the vnc session through KVM still works as
the machine is running but every digit I issue does not appear on the
server shell. Also the ssh sessions die;
After having a chat in the #libvirt channel I tried doing this both with
acpibtn enabled (on OpenBSD is the default behaviour) and also with
acpibtn disabled (using the command "boot -c" and then "disable acpi" at
boot time in the OpenBSD server). In both cases the server crashes
At this point I have found an alternative way to automatically shut down
the machine (using ssh) but it would be nice to understand way this
happens. Is this a well-known issue? Is there a way to deeply debug it?
Thanks a lot!
0x412E
14 years, 3 months
[libvirt] [PATCH] Update ID after stopping a domain
by Matthias Bolte
---
src/esx/esx_driver.c | 1 +
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 2 ++
src/vbox/vbox_tmpl.c | 1 +
src/xenapi/xenapi_driver.c | 1 +
5 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 964a3a5..913420c 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1620,6 +1620,7 @@ esxDomainDestroy(virDomainPtr domain)
goto cleanup;
}
+ domain->id = -1;
result = 0;
cleanup:
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 98381fb..c46f3a7 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -531,6 +531,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {
vm->def->id = -1;
vm->state = VIR_DOMAIN_SHUTOFF;
+ dom->id = -1;
ret = 0;
cleanup:
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index e4afc5a..7143933 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3688,6 +3688,8 @@ phypDomainDestroy(virDomainPtr dom)
if (phypUUIDTable_RemLpar(dom->conn, dom->id) == -1)
goto err;
+ dom->id = -1;
+
VIR_FREE(cmd);
VIR_FREE(ret);
return 0;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0a91c7f..31fec67 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1587,6 +1587,7 @@ static int vboxDomainDestroy(virDomainPtr dom) {
}
#endif
VBOX_RELEASE(console);
+ dom->id = -1;
ret = 0;
}
data->vboxSession->vtbl->Close(data->vboxSession);
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 2262cef..fb3c91d 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -830,6 +830,7 @@ xenapiDomainDestroy (virDomainPtr dom)
return -1;
}
xen_vm_set_free(vms);
+ dom->id = -1;
return 0;
}
if (vms) xen_vm_set_free(vms);
--
1.7.0.4
14 years, 4 months
[libvirt] [PATCH] storage: kill dead stores
by Eric Blake
Found by clang. Clang complained that virStorageBackendProbeTarget
could dereference NULL if backingStoreFormat was NULL, but since all
callers passed a valid pointer, I added attributes instead of null
checks.
* src/storage/storage_backend.c
(virStorageBackendQEMUImgBackingFormat): Kill dead store.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Likewise. Skip null checks, by adding attributes.
---
Thankfully, the null dereference scenario noted by clang was never
triggered in the code, which is good since it was introduced as
part of fixing a CVE.
src/storage/storage_backend.c | 3 +--
src/storage/storage_backend_fs.c | 34 +++++++++++++++-------------------
2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index d989743..1fe7ba6 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -581,7 +581,6 @@ static int virStorageBackendQEMUImgBackingFormat(const char *qemuimg)
int newstdout = -1;
char *help = NULL;
enum { MAX_HELP_OUTPUT_SIZE = 1024*8 };
- int len;
char *start;
char *end;
char *tmp;
@@ -591,7 +590,7 @@ static int virStorageBackendQEMUImgBackingFormat(const char *qemuimg)
&child, -1, &newstdout, NULL, VIR_EXEC_CLEAR_CAPS) < 0)
goto cleanup;
- if ((len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help)) < 0) {
+ if (virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help) < 0) {
virReportSystemError(errno,
_("Unable to read '%s -h' output"),
qemuimg);
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 0761bd8..b6b8fdd 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -48,7 +48,7 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
-static int
+static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
virStorageBackendProbeTarget(virStorageVolTargetPtr target,
char **backingStore,
int *backingStoreFormat,
@@ -59,10 +59,8 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
int fd, ret;
virStorageFileMetadata meta;
- if (backingStore)
- *backingStore = NULL;
- if (backingStoreFormat)
- *backingStoreFormat = VIR_STORAGE_FILE_AUTO;
+ *backingStore = NULL;
+ *backingStoreFormat = VIR_STORAGE_FILE_AUTO;
if (encryption)
*encryption = NULL;
@@ -75,7 +73,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
allocation,
capacity)) < 0) {
close(fd);
- return -1;
+ return ret;
}
memset(&meta, 0, sizeof(meta));
@@ -95,20 +93,19 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
close(fd);
if (meta.backingStore) {
- if (backingStore) {
- *backingStore = meta.backingStore;
- meta.backingStore = NULL;
- if (meta.backingStoreFormat == VIR_STORAGE_FILE_AUTO) {
- if ((*backingStoreFormat = virStorageFileProbeFormat(*backingStore)) < 0) {
- close(fd);
- goto cleanup;
- }
- } else {
- *backingStoreFormat = meta.backingStoreFormat;
+ *backingStore = meta.backingStore;
+ meta.backingStore = NULL;
+ if (meta.backingStoreFormat == VIR_STORAGE_FILE_AUTO) {
+ if ((*backingStoreFormat
+ = virStorageFileProbeFormat(*backingStore)) < 0) {
+ close(fd);
+ goto cleanup;
}
} else {
- VIR_FREE(meta.backingStore);
+ *backingStoreFormat = meta.backingStoreFormat;
}
+ } else {
+ VIR_FREE(meta.backingStore);
}
if (capacity && meta.capacity)
@@ -139,8 +136,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
return 0;
cleanup:
- if (backingStore)
- VIR_FREE(*backingStore);
+ VIR_FREE(*backingStore);
return -1;
}
--
1.7.2
14 years, 4 months
[libvirt] [PATCH] network: kill dead store
by Eric Blake
* src/network/bridge_driver.c (networkDefine): Kill dead store.
---
src/network/bridge_driver.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index b7ee880..217cdcc 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1490,14 +1490,13 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
virNetworkDefPtr def;
virNetworkObjPtr network = NULL;
virNetworkPtr ret = NULL;
- int dupNet;
networkDriverLock(driver);
if (!(def = virNetworkDefParseString(xml)))
goto cleanup;
- if ((dupNet = virNetworkObjIsDuplicate(&driver->networks, def, 0)) < 0)
+ if (virNetworkObjIsDuplicate(&driver->networks, def, 0) < 0)
goto cleanup;
if (virNetworkSetBridgeName(&driver->networks, def, 1))
--
1.7.2
14 years, 4 months
[libvirt] [PATCH] xenapi: Update ID after starting a domain
by Matthias Bolte
---
src/xenapi/xenapi_driver.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index e385648..2262cef 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1459,6 +1459,7 @@ xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
xen_vm_set *vms;
xen_vm vm;
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
+ int64_t domid = -1;
virCheckFlags(0, -1);
@@ -1475,6 +1476,10 @@ xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
xen_vm_set_free(vms);
return -1;
}
+
+ xen_vm_get_domid(session, &domid, vm);
+ dom->id = domid;
+
xen_vm_set_free(vms);
} else {
if (vms) xen_vm_set_free(vms);
--
1.7.0.4
14 years, 4 months
[libvirt] [PATCH] esx: Update ID after starting a domain
by Matthias Bolte
---
src/esx/esx_driver.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index eb64556..964a3a5 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -2483,6 +2483,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
esxVI_ObjectContent *virtualMachine = NULL;
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
+ int id = -1;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
@@ -2497,8 +2498,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
esxVI_LookupVirtualMachineByUuidAndPrepareForTask
(priv->primary, domain->uuid, propertyNameList, &virtualMachine,
priv->autoAnswer) < 0 ||
- esxVI_GetVirtualMachinePowerState(virtualMachine,
- &powerState) < 0) {
+ esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 ||
+ esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0) {
goto cleanup;
}
@@ -2521,6 +2522,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
goto cleanup;
}
+ domain->id = id;
result = 0;
cleanup:
--
1.7.0.4
14 years, 4 months