[libvirt] [PATCH] Fix DMI uuid parsing.
by Chris Lalancette
valgrind was complaining that virUUIDParse was depending on
an uninitialized value. Indeed it was; virSetHostUUIDStr()
didn't initialize the dmiuuid buffer to 0's, meaning that
anything after the string read from /sys was uninitialized.
Clear out the dmiuuid buffer before use, and make sure to
always leave a \0 at the end.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/util/uuid.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/util/uuid.c b/src/util/uuid.c
index f188148..9cafc2a 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -286,7 +286,8 @@ virSetHostUUIDStr(const char *uuid)
return EEXIST;
if (!uuid) {
- if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
+ memset(dmiuuid, 0, sizeof(dmiuuid));
+ if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid) - 1)) {
if (!virUUIDParse(dmiuuid, host_uuid))
return 0;
}
--
1.7.1.1
14 years, 3 months
[libvirt] [PATCH] build: distribute libvirt_qemu.syms
by Eric Blake
* src/Makefile.am (EXTRA_DIST): Ensure 'make distcheck' and
'rpmbuild' can reproduce a build.
* daemon/Makefile.am (DAEMON_SOURCES): Likewise.
---
The recent qemu monitor commands were incomplete.
daemon/Makefile.am | 4 ++++
src/Makefile.am | 4 +++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 6769bab..963d64f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -10,6 +10,10 @@ DAEMON_SOURCES = \
remote_dispatch_table.h \
remote_dispatch_args.h \
remote_dispatch_ret.h \
+ qemu_dispatch_prototypes.h \
+ qemu_dispatch_table.h \
+ qemu_dispatch_args.h \
+ qemu_dispatch_ret.h \
../src/remote/remote_protocol.c \
../src/remote/qemu_protocol.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 64d618b..a66eb2a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -162,7 +162,8 @@ REMOTE_DRIVER_SOURCES = \
remote/qemu_protocol.c \
remote/qemu_protocol.h
-EXTRA_DIST += remote/remote_protocol.x remote/rpcgen_fix.pl
+EXTRA_DIST += remote/remote_protocol.x remote/qemu_protocol.x \
+ remote/rpcgen_fix.pl
# Ensure that we don't change the struct or member names or member ordering
# in remote_protocol.x The embedded perl below needs a few comments, and
@@ -1074,6 +1075,7 @@ libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \
$(AM_LDFLAGS)
libvirt_qemu_la_CFLAGS = $(AM_CFLAGS)
libvirt_qemu_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
+EXTRA_DIST += $(LIBVIRT_QEMU_SYMBOL_FILE)
libexec_PROGRAMS =
--
1.7.2
14 years, 3 months
[libvirt] [PATCH] esx: Switch from name to number checks in the subdrivers
by Matthias Bolte
---
src/esx/esx_device_monitor.c | 2 +-
src/esx/esx_interface_driver.c | 2 +-
src/esx/esx_network_driver.c | 2 +-
src/esx/esx_nwfilter_driver.c | 2 +-
src/esx/esx_secret_driver.c | 2 +-
src/esx/esx_storage_driver.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 5887ba0..d559f96 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -44,7 +44,7 @@ esxDeviceOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index d58e365..4bac3d5 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -44,7 +44,7 @@ esxInterfaceOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 52f5e65..a64bb8e 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -44,7 +44,7 @@ esxNetworkOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
diff --git a/src/esx/esx_nwfilter_driver.c b/src/esx/esx_nwfilter_driver.c
index cc2e73b..a9d046d 100644
--- a/src/esx/esx_nwfilter_driver.c
+++ b/src/esx/esx_nwfilter_driver.c
@@ -43,7 +43,7 @@ esxNWFilterOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index 2d54b3f..1ae7ddc 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -42,7 +42,7 @@ static virDrvOpenStatus
esxSecretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 44d7d85..9f25e02 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -45,7 +45,7 @@ esxStorageOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED)
{
- if (STRNEQ(conn->driver->name, "ESX")) {
+ if (conn->driver->no != VIR_DRV_ESX) {
return VIR_DRV_OPEN_DECLINED;
}
--
1.7.0.4
14 years, 3 months
[libvirt] [PATCH] esx: Improve blocked task detection and fix race condition
by Matthias Bolte
esxVI_WaitForTaskCompletion can take a UUID to lookup the
corresponding domain and check if the current task for it
is blocked by a question. It calls another function to do
this: esxVI_LookupAndHandleVirtualMachineQuestion looks up
the VirtualMachine and checks for a question. If there is
a question it calls esxVI_HandleVirtualMachineQuestion to
handle it.
If there was no question or it has been answered the call
to esxVI_LookupAndHandleVirtualMachineQuestion returns 0.
If any error occurred during the lookup and answering
process -1 is returned. The problem with this is, that -1
is also returned when there was no error but the question
could not be answered. So esxVI_WaitForTaskCompletion cannot
distinguish between this two situations and reports that a
question is blocking the task even when there was actually
another problem.
This inherent problem didn't surface until vSphere 4.1 when
you try to define a new domain. The driver tries to lookup
the domain that is just in the process of being registered.
There seems to be some kind of race condition and the driver
manages to issue a lookup command before the ESX server was
able to register the domain. This used to work before.
Due to the return value problem described above the driver
reported a false error message in that case.
To solve this esxVI_WaitForTaskCompletion now takes an
additional occurrence parameter that describes whether or
not to expect the domain to be existent. Also add a new
parameter to esxVI_LookupAndHandleVirtualMachineQuestion
that allows to distinguish if the call returned -1 because
of an actual error or because the question could not be
answered.
---
src/esx/esx_driver.c | 17 ++++++++++++++-
src/esx/esx_vi.c | 53 ++++++++++++++++++++++++++++++++++++-------------
src/esx/esx_vi.h | 7 ++++-
src/esx/esx_vmx.c | 4 +-
4 files changed, 61 insertions(+), 20 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index f9affea..eb64556 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1409,6 +1409,7 @@ esxDomainSuspend(virDomainPtr domain)
if (esxVI_SuspendVM_Task(priv->primary, virtualMachine->obj, &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -1462,6 +1463,7 @@ esxDomainResume(virDomainPtr domain)
if (esxVI_PowerOnVM_Task(priv->primary, virtualMachine->obj, NULL,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -1607,8 +1609,9 @@ esxDomainDestroy(virDomainPtr domain)
}
if (esxVI_PowerOffVM_Task(ctx, virtualMachine->obj, &task) < 0 ||
- esxVI_WaitForTaskCompletion(ctx, task, domain->uuid, priv->autoAnswer,
- &taskInfoState) < 0) {
+ esxVI_WaitForTaskCompletion(ctx, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
+ priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -1724,6 +1727,7 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
if (esxVI_ReconfigVM_Task(priv->primary, virtualMachine->obj, spec,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -1775,6 +1779,7 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
if (esxVI_ReconfigVM_Task(priv->primary, virtualMachine->obj, spec,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -2104,6 +2109,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
if (esxVI_ReconfigVM_Task(priv->primary, virtualMachine->obj, spec,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -2505,6 +2511,7 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
if (esxVI_PowerOnVM_Task(priv->primary, virtualMachine->obj, NULL,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -2702,6 +2709,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
datastoreRelatedPath, NULL, esxVI_Boolean_False,
resourcePool, hostSystem->obj, &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->host, task, def->uuid,
+ esxVI_Occurrence_OptionalItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -3069,6 +3077,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
if (esxVI_ReconfigVM_Task(priv->primary, virtualMachine->obj, spec,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -3223,6 +3232,7 @@ esxDomainMigratePerform(virDomainPtr domain,
esxVI_VirtualMachinePowerState_Undefined,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->vCenter, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -3465,6 +3475,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
esxVI_Boolean_True,
esxVI_Boolean_False, &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -3721,6 +3732,7 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned int flags)
if (esxVI_RevertToSnapshot_Task(priv->primary, snapshotTree->snapshot, NULL,
&task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, snapshot->domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
@@ -3775,6 +3787,7 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags)
if (esxVI_RemoveSnapshot_Task(priv->primary, snapshotTree->snapshot,
removeChildren, &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->primary, task, snapshot->domain->uuid,
+ esxVI_Occurrence_RequiredItem,
priv->autoAnswer, &taskInfoState) < 0) {
goto cleanup;
}
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 69ba7a9..98b8bcd 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -2217,6 +2217,7 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
esxVI_String *completePropertyNameList = NULL;
esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
esxVI_TaskInfo *pendingTaskInfoList = NULL;
+ esxVI_Boolean blocked = esxVI_Boolean_Undefined;
if (esxVI_String_DeepCopyList(&completePropertyNameList,
propertyNameList) < 0 ||
@@ -2235,7 +2236,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
if (questionInfo != NULL &&
esxVI_HandleVirtualMachineQuestion(ctx, (*virtualMachine)->obj,
- questionInfo, autoAnswer) < 0) {
+ questionInfo, autoAnswer,
+ &blocked) < 0) {
goto cleanup;
}
@@ -2528,7 +2530,9 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
int
esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
- esxVI_Boolean autoAnswer)
+ esxVI_Occurrence occurrence,
+ esxVI_Boolean autoAnswer,
+ esxVI_Boolean *blocked)
{
int result = -1;
esxVI_ObjectContent *virtualMachine = NULL;
@@ -2538,17 +2542,22 @@ esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.question") < 0 ||
esxVI_LookupVirtualMachineByUuid(ctx, uuid, propertyNameList,
- &virtualMachine,
- esxVI_Occurrence_RequiredItem) < 0 ||
- esxVI_GetVirtualMachineQuestionInfo(virtualMachine,
- &questionInfo) < 0) {
+ &virtualMachine, occurrence) < 0) {
goto cleanup;
}
- if (questionInfo != NULL &&
- esxVI_HandleVirtualMachineQuestion(ctx, virtualMachine->obj,
- questionInfo, autoAnswer) < 0) {
- goto cleanup;
+ if (virtualMachine != NULL) {
+ if (esxVI_GetVirtualMachineQuestionInfo(virtualMachine,
+ &questionInfo) < 0) {
+ goto cleanup;
+ }
+
+ if (questionInfo != NULL &&
+ esxVI_HandleVirtualMachineQuestion(ctx, virtualMachine->obj,
+ questionInfo, autoAnswer,
+ blocked) < 0) {
+ goto cleanup;
+ }
}
result = 0;
@@ -2700,7 +2709,7 @@ int
esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
- esxVI_Boolean autoAnswer)
+ esxVI_Boolean autoAnswer, esxVI_Boolean *blocked)
{
int result = -1;
esxVI_ElementDescription *elementDescription = NULL;
@@ -2709,6 +2718,13 @@ esxVI_HandleVirtualMachineQuestion
int answerIndex = 0;
char *possibleAnswers = NULL;
+ if (blocked == NULL || *blocked != esxVI_Boolean_Undefined) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ return -1;
+ }
+
+ *blocked = esxVI_Boolean_False;
+
if (questionInfo->choice->choiceInfo != NULL) {
for (elementDescription = questionInfo->choice->choiceInfo;
elementDescription != NULL;
@@ -2742,6 +2758,8 @@ esxVI_HandleVirtualMachineQuestion
_("Pending question blocks virtual machine execution, "
"question is '%s', no possible answers"),
questionInfo->text);
+
+ *blocked = esxVI_Boolean_True;
goto cleanup;
} else if (answerChoice == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
@@ -2749,6 +2767,8 @@ esxVI_HandleVirtualMachineQuestion
"question is '%s', possible answers are %s, but no "
"default answer is specified"), questionInfo->text,
possibleAnswers);
+
+ *blocked = esxVI_Boolean_True;
goto cleanup;
}
@@ -2774,6 +2794,7 @@ esxVI_HandleVirtualMachineQuestion
questionInfo->text);
}
+ *blocked = esxVI_Boolean_True;
goto cleanup;
}
@@ -2795,6 +2816,7 @@ int
esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
const unsigned char *virtualMachineUuid,
+ esxVI_Occurrence virtualMachineOccurrence,
esxVI_Boolean autoAnswer,
esxVI_TaskInfoState *finalState)
{
@@ -2810,6 +2832,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_PropertyChange *propertyChange = NULL;
esxVI_AnyType *propertyValue = NULL;
esxVI_TaskInfoState state = esxVI_TaskInfoState_Undefined;
+ esxVI_Boolean blocked = esxVI_Boolean_Undefined;
esxVI_TaskInfo *taskInfo = NULL;
version = strdup("");
@@ -2850,7 +2873,8 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
if (virtualMachineUuid != NULL) {
if (esxVI_LookupAndHandleVirtualMachineQuestion
- (ctx, virtualMachineUuid, autoAnswer) < 0) {
+ (ctx, virtualMachineUuid, virtualMachineOccurrence,
+ autoAnswer, &blocked) < 0) {
/*
* FIXME: Disable error reporting here, so possible errors from
* esxVI_LookupTaskInfoByTask() and esxVI_CancelTask()
@@ -2861,12 +2885,13 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
}
if (taskInfo->cancelable == esxVI_Boolean_True) {
- if (esxVI_CancelTask(ctx, task) < 0) {
+ if (esxVI_CancelTask(ctx, task) < 0 &&
+ blocked == esxVI_Boolean_True) {
VIR_ERROR0(_("Cancelable task is blocked by an "
"unanswered question but cancelation "
"failed"));
}
- } else {
+ } else if (blocked == esxVI_Boolean_True) {
VIR_ERROR0(_("Non-cancelable task is blocked by an "
"unanswered question"));
}
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 9eb5094..ef9c6d9 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -367,7 +367,9 @@ int esxVI_LookupPendingTaskInfoListByVirtualMachine
int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
const unsigned char *uuid,
- esxVI_Boolean autoAnswer);
+ esxVI_Occurrence occurrence,
+ esxVI_Boolean autoAnswer,
+ esxVI_Boolean *blocked);
int esxVI_LookupRootSnapshotTreeList
(esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
@@ -382,11 +384,12 @@ int esxVI_HandleVirtualMachineQuestion
(esxVI_Context *ctx,
esxVI_ManagedObjectReference *virtualMachine,
esxVI_VirtualMachineQuestionInfo *questionInfo,
- esxVI_Boolean autoAnswer);
+ esxVI_Boolean autoAnswer, esxVI_Boolean *blocked);
int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
esxVI_ManagedObjectReference *task,
const unsigned char *virtualMachineUuid,
+ esxVI_Occurrence virtualMachineOccurrence,
esxVI_Boolean autoAnswer,
esxVI_TaskInfoState *finalState);
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index c63b159..ee7afb2 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -811,8 +811,8 @@ esxVMX_AutodetectSCSIControllerModel(esxVI_Context *ctx,
/* Search datastore for file */
if (esxVI_SearchDatastore_Task(ctx, hostDatastoreBrowser, datastorePath,
searchSpec, &task) < 0 ||
- esxVI_WaitForTaskCompletion(ctx, task, NULL, esxVI_Boolean_False,
- &taskInfoState) < 0) {
+ esxVI_WaitForTaskCompletion(ctx, task, NULL, esxVI_Occurrence_None,
+ esxVI_Boolean_False, &taskInfoState) < 0) {
goto cleanup;
}
--
1.7.0.4
14 years, 3 months
[libvirt] [PATCH] esx: Fix freeing of heterogeneous lists
by Matthias Bolte
Always call the free function of the base type. The base type
function then dynamically dispatches the call to the free function
for the actual type.
---
src/esx/esx_vi_generator.py | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 82bc9b6..44c3493 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -684,7 +684,10 @@ class Object:
source += "{\n"
if self.features & Object.FEATURE__LIST:
- source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
+ if self.extends is not None:
+ source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends)
+ else:
+ source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
source += self.generate_free_code()
@@ -701,7 +704,10 @@ class Object:
source += "{\n"
if self.features & Object.FEATURE__LIST:
- source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
+ if self.extends is not None:
+ source += " esxVI_%s_Free((esxVI_%s **)&item->_next);\n\n" % (self.extends, self.extends)
+ else:
+ source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
source += self.generate_free_code()
@@ -1126,11 +1132,11 @@ additional_object_features = { "DatastoreInfo" : Object.FEATURE__AN
"FileInfo" : Object.FEATURE__DYNAMIC_CAST,
"FileQuery" : Object.FEATURE__DYNAMIC_CAST,
"HostCpuIdInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
- "HostDatastoreBrowserSearchResults" : Object.FEATURE__ANY_TYPE,
+ "HostDatastoreBrowserSearchResults" : Object.FEATURE__LIST | Object.FEATURE__ANY_TYPE,
"ManagedObjectReference" : Object.FEATURE__ANY_TYPE,
"ObjectContent" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST,
"PerfCounterInfo" : Object.FEATURE__LIST,
- "PerfEntityMetric" : Object.FEATURE__LIST | Object.FEATURE__DYNAMIC_CAST,
+ "PerfEntityMetric" : Object.FEATURE__LIST | Object.FEATURE__DYNAMIC_CAST,
"PerfQuerySpec" : Object.FEATURE__LIST,
"PerfMetricIntSeries" : Object.FEATURE__DYNAMIC_CAST,
"PropertyFilterSpec" : Object.FEATURE__LIST,
--
1.7.0.4
14 years, 3 months
[libvirt] [PATCH 0/2] build: fix bugs detected by newer gcc
by Eric Blake
Rawhide's gcc 4.5.0 got smarter in relation to Fedora 13's gcc 4.4.4,
and exposed a real bug (introduced by commit ed9c14a7 this January)
as well as extra noise that is easy enough to silence.
The new warnings looked like:
esx/esx_vi_types.c:1231:1: warning: logical 'or' of collectively exhaustive tests is always true [-Wlogical-op]
And the esx_vi_types.c case is proof why it is a bad idea to ever
stick -Werror in a spec file - upgrade the compiler, and something
that previously built silently can now fail to build; in contrast,
using -Werror during development is great as it forces you to think
about the issue, and in the case of xen, fix a real bug.
Eric Blake (2):
xen: fix logic bug
esx: silence spurious compiler warning
src/esx/esx_vi_types.c | 6 ++++--
src/xen/xend_internal.c | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
--
1.7.2
14 years, 3 months
[libvirt] "make rpm" failure?
by Justin Clift
Hi Eric,
Have you tried a "make rpm" with libvirt git head since your recent
"build: fix VPATH builds" commit?
commit 4018a026b2b4b50bfc5e4c35dabb828ebf6cc3f7
Author: Eric Blake <eblake(a)redhat.com>
Date: Mon Jul 26 10:38:30 2010 -0600
build: fix VPATH builds
After the recent libvirt-qemu library addition, VPATH builds fail
...
The commit comment indicates it should fix an error where ld can't find
"libvirt_qemu.syms". I'm still getting that the error though:
$ make rpm
...
CCLD libvirt-qemu.la
/usr/bin/ld: cannot open linker script file ./libvirt_qemu.syms: No
such file or directory
collect2: ld returned 1 exit status
make[4]: *** [libvirt-qemu.la] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory `/home/jc/rpmbuild/BUILD/libvirt-0.8.2/src'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/jc/rpmbuild/BUILD/libvirt-0.8.2/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/jc/rpmbuild/BUILD/libvirt-0.8.2'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/jc/rpmbuild/BUILD/libvirt-0.8.2'
error: Bad exit status from /var/tmp/rpm-tmp.xiUlH6 (%build)
In configure.ac, where it's defined as:
LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
The $srcdir seems to be getting turned into a ".", so that this happens:
[jc@host1 libvirt]$ grep -r "libvirt_qemu.syms" .
./gnulib/lib/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./gnulib/tests/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./src/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./tests/xencapsdata/Makefile:LIBVIRT_QEMU_SYMBOL_FILE =
./libvirt_qemu.syms
./tests/xml2sexprdata/Makefile:LIBVIRT_QEMU_SYMBOL_FILE =
./libvirt_qemu.syms
./tests/sexpr2xmldata/Makefile:LIBVIRT_QEMU_SYMBOL_FILE =
./libvirt_qemu.syms
./tests/xmconfigdata/Makefile:LIBVIRT_QEMU_SYMBOL_FILE =
./libvirt_qemu.syms
./tests/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./tests/confdata/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./include/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./include/libvirt/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./proxy/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
./python/tests/Makefile:LIBVIRT_QEMU_SYMBOL_FILE = ./libvirt_qemu.syms
It looks like the $srcdir needs to be resolved to an absolute path,
rather than a relative one, but I have no idea how in autoconf stuff.
Any ideas off the top of your head? :)
Regards and best wishes,
Justin Clift
14 years, 3 months
[libvirt] Failed when client connects to the hypervisor running on Server using TLS
by Xiaoqiang Hu
Hi all,
Failed when client connects to the hypervisor running on Server using TLS and the details can be seen as follows:
I Test Procedures:
On server (10.66.92.154)
1. Set up a Certificate Authority (CA)
1.1 # certtool --generate-privkey > cakey.pem
1.2 self-sign cakey.pem by creating a file with the signature details called ca.info containing:
cn=10.66.92.154
ca
cert_signing_key
1.3 # certtool --generate-self-signed --load-privkey cakey.pem --template ca.info --outfile cacert.pem
2. Create server certificates
2.1 certtool --generate-privkey > serverkey.pem
2.2 sign that key with the CA's private key by first creating a template file called server.info
organization=Red Hat
cn=10.66.92.154
tls_www_server
encryption_key
signing_key
2.3 # certtool --generate-certificate --load-privkey serverkey.pem --load-ca-certificate cacert.pem \
--load-ca-privkey cakey.pem --template server.info --outfile servercert.pem
3. Copy CA key and server key to correct directory
3.1 # cp cakey.pem cacert.pem /etc/pki/CA
3.2 # mkdir -p /etc/pki/libvirt/private
3.3 # cp serverkey.pem /etc/pki/libvirt/private
3.4 # cp servercert.pem /etc/pki/libvirt
4. Copy CA key to client(10.66.93.205) into correct directory
4.1 # scp cakey.pem cacert.pem root@10.66.93.205:/etc/pki/CA
5. Turn on libvird monitor listening in /etc/sysconfig/libvirtd
-- uncomment LIBVIRTD_ARGS="--listen"
6. Edit /etc/libvirt/libvirtd.conf
-- enbale listen_tls = 1
7. # service libvirtd restart
8. # service iptables stop
On client (10.66.93.205)
9. Create client certificates
9.1 # certtool --generate-privkey > clientkey.pem
9.2 Act as CA and sign the certificate. Create client.info containing:
9.1 # certtool --generate-privkey > clientkey.pem
9.2 Act as CA and sign the certificate. Create client.info containing:
country=GB
state=London
locality=London
organization=Red Hat
cn=10.66.93.205
tls_www_client
encryption_key
signing_key
9.3 # certtool --generate-certificate --load-privkey clientkey.pem --load-ca-certificate /etc/pki/CA/cacert.pem \
--load-ca-privkey /etc/pki/CA/cakey.pem --template client.info --outfile clientcert.pem
10. Copy client key to correct directory
10.1 # mkdir -p /etc/pki/libvirt/private
10.2 # cp clientkey.pem /etc/pki/libvirt/private
10.3 # cp clientcert.pem /etc/pki/libvirt/
11. Conect to server hypervisor
# virsh -c qemu+tls://10.66.92.154/system
II Test Result:
[root@dhcp-93-205 images]# virsh -c qemu+tls://10.66.92.154/system
error: server verification (of our certificate or IP address) failed
error: failed to connect to the hypervisor
Note:
if I Step 9 as above on server and then the client can connect to the hypervisor running on Server using TLS successfully.
Regards!
Johnson
14 years, 3 months
[libvirt] A error about live migration with --copy-storage-all
by 姚远
In fedora-13, libvirt is libvirt-0.8.2 and qemu is qemu-kvm-0.12.3. In
virsh , the command of "migrate --live fedora-13 qemu+ssh://
10.1.10.54/system" is going well. but when I use the command of "migrate
--live --copy-storage-all fedora-13 qemu+ssh://10.1.10.54/system", it show
the error:
internal errorqemu: could not open disk image /home/images/fedora-13.img: No
such file or directory
qemu: could not open disk image /home/images/fedora-13.img: No such file or
directory
"10.1.10.54" is the ip of destination, and fedora-13 is my VM.
I don't know why. My VM "fedora-13" can going well with "virsh start
fedora-13" by "/usr/bin/qemu-kvm". Who do live migration with
"--copy-storage-all" successfully can help me.
What is "--copy-storage-inc migration with non-shared storage with
incremental copy (same base image shared between source and destination)"?
do that means I also need a shared storage?
The document of this I can find out is too less.
thank you!
14 years, 3 months