[libvirt] [PATCH] ESX: Unify naming of VI API utility and convenience functions.
by Matthias Bolte
Unified function naming scheme:
- 'lookup' functions query the ESX or vCenter for information
- 'get' functions return information from a local object
* src/esx/esx_driver.c, src/esx/esx_vi.[ch]: unify function naming
---
src/esx/esx_driver.c | 95 ++++++++++++++++++++++++++++----------------------
src/esx/esx_vi.c | 77 +++++++++++++++++++++++-----------------
src/esx/esx_vi.h | 32 +++++++++-------
3 files changed, 116 insertions(+), 88 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index a0efa5d..93fb5a9 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -90,9 +90,10 @@ esxSupportsLongMode(virConnectPtr conn)
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"hardware.cpuFeature") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
@@ -522,9 +523,10 @@ esxSupportsVMotion(virConnectPtr conn)
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"capability.vmotionSupported") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
@@ -653,9 +655,10 @@ esxGetHostname(virConnectPtr conn)
(conn, &propertyNameList,
"config.network.dnsConfig.hostName\0"
"config.network.dnsConfig.domainName\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
@@ -750,9 +753,10 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
"hardware.memorySize\0"
"hardware.numaInfo.numNodes\0"
"summary.hardware.cpuModel\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->hostFolder,
- "HostSystem", propertyNameList,
- esxVI_Boolean_True, &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ priv->host->hostFolder,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_True, &hostSystem) < 0) {
goto failure;
}
@@ -914,9 +918,10 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -970,7 +975,7 @@ esxNumberOfDomains(virConnectPtr conn)
return -1;
}
- return esxVI_GetNumberOfDomainsByPowerState
+ return esxVI_LookupNumberOfDomainsByPowerState
(conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_False);
}
@@ -999,9 +1004,10 @@ esxDomainLookupByID(virConnectPtr conn, int id)
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -1082,9 +1088,10 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -1168,9 +1175,10 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
"name\0"
"runtime.powerState\0"
"config.uuid\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -2042,10 +2050,10 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
"capability.maxSupportedVcpus") < 0 ||
- esxVI_GetObjectContent(domain->conn, priv->host,
- priv->host->hostFolder, "HostSystem",
- propertyNameList, esxVI_Boolean_True,
- &hostSystem) < 0) {
+ esxVI_LookupObjectContentByType(domain->conn, priv->host,
+ priv->host->hostFolder, "HostSystem",
+ propertyNameList, esxVI_Boolean_True,
+ &hostSystem) < 0) {
goto failure;
}
@@ -2270,9 +2278,10 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, priv->host->vmFolder,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_True, &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -2337,7 +2346,7 @@ esxNumberOfDefinedDomains(virConnectPtr conn)
return -1;
}
- return esxVI_GetNumberOfDomainsByPowerState
+ return esxVI_LookupNumberOfDomainsByPowerState
(conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
esxVI_Boolean_True);
}
@@ -2550,8 +2559,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
goto failure;
}
- if (esxVI_GetResourcePool(conn, priv->host, hostSystem,
- &resourcePool) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ &resourcePool) < 0) {
goto failure;
}
@@ -3071,8 +3080,8 @@ esxDomainMigratePerform(virDomainPtr domain,
goto failure;
}
- if (esxVI_GetResourcePool(domain->conn, priv->vCenter, hostSystem,
- &resourcePool) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(domain->conn, priv->vCenter,
+ hostSystem, &resourcePool) < 0) {
goto failure;
}
@@ -3172,8 +3181,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
goto failure;
}
- if (esxVI_GetResourcePool(conn, priv->host, hostSystem,
- &managedObjectReference) < 0) {
+ if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+ &managedObjectReference) < 0) {
goto failure;
}
@@ -3182,9 +3191,11 @@ esxNodeGetFreeMemory(virConnectPtr conn)
/* Get memory usage of resource pool */
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.memory") < 0 ||
- esxVI_GetObjectContent(conn, priv->host, managedObjectReference,
- "ResourcePool", propertyNameList,
- esxVI_Boolean_False, &resourcePool) < 0) {
+ esxVI_LookupObjectContentByType(conn, priv->host,
+ managedObjectReference,
+ "ResourcePool", propertyNameList,
+ esxVI_Boolean_False,
+ &resourcePool) < 0) {
goto failure;
}
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index fa971d8..dc51e20 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -374,9 +374,10 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
}
/* Get pointer to Datacenter for later use */
- if (esxVI_GetObjectContent(conn, ctx, ctx->service->rootFolder,
- "Datacenter", propertyNameList,
- esxVI_Boolean_True, &datacenterList) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, ctx->service->rootFolder,
+ "Datacenter", propertyNameList,
+ esxVI_Boolean_True,
+ &datacenterList) < 0) {
goto failure;
}
@@ -1061,6 +1062,10 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Utility and Convenience Functions
+ *
+ * Function naming scheme:
+ * - 'lookup' functions query the ESX or vCenter for information
+ * - 'get' functions get information from a local object
*/
int
@@ -1301,9 +1306,11 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
#else
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"currentSession") < 0 ||
- esxVI_GetObjectContent(conn, ctx, ctx->service->sessionManager,
- "SessionManager", propertyNameList,
- esxVI_Boolean_False, &sessionManager) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx,
+ ctx->service->sessionManager,
+ "SessionManager", propertyNameList,
+ esxVI_Boolean_False,
+ &sessionManager) < 0) {
goto failure;
}
@@ -1358,11 +1365,12 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
int
-esxVI_GetObjectContent(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *root,
- const char *type, esxVI_String *propertyNameList,
- esxVI_Boolean recurse,
- esxVI_ObjectContent **objectContentList)
+esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *root,
+ const char *type,
+ esxVI_String *propertyNameList,
+ esxVI_Boolean recurse,
+ esxVI_ObjectContent **objectContentList)
{
int result = 0;
esxVI_ObjectSpec *objectSpec = NULL;
@@ -1479,9 +1487,9 @@ esxVI_GetVirtualMachinePowerState(virConnectPtr conn,
int
-esxVI_GetNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_VirtualMachinePowerState powerState,
- esxVI_Boolean inverse)
+esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_VirtualMachinePowerState powerState,
+ esxVI_Boolean inverse)
{
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *virtualMachineList = NULL;
@@ -1492,9 +1500,10 @@ esxVI_GetNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"runtime.powerState") < 0 ||
- esxVI_GetObjectContent(conn, ctx, ctx->vmFolder, "VirtualMachine",
- propertyNameList, esxVI_Boolean_True,
- &virtualMachineList) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx, ctx->vmFolder,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_True,
+ &virtualMachineList) < 0) {
goto failure;
}
@@ -1646,9 +1655,10 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
-int esxVI_GetResourcePool(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ObjectContent *hostSystem,
- esxVI_ManagedObjectReference **resourcePool)
+int
+esxVI_LookupResourcePoolByHostSystem
+ (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+ esxVI_ManagedObjectReference **resourcePool)
{
int result = 0;
esxVI_String *propertyNameList = NULL;
@@ -1684,9 +1694,10 @@ int esxVI_GetResourcePool(virConnectPtr conn, esxVI_Context *ctx,
if (esxVI_String_AppendValueToList(conn, &propertyNameList,
"resourcePool") < 0 ||
- esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "ComputeResource", propertyNameList,
- esxVI_Boolean_False, &computeResource) < 0) {
+ esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "ComputeResource", propertyNameList,
+ esxVI_Boolean_False,
+ &computeResource) < 0) {
goto failure;
}
@@ -1751,9 +1762,9 @@ esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
goto failure;
}
- if (esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "HostSystem", propertyNameList,
- esxVI_Boolean_False, hostSystem) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "HostSystem", propertyNameList,
+ esxVI_Boolean_False, hostSystem) < 0) {
goto failure;
}
@@ -1803,9 +1814,10 @@ esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
}
}
- if (esxVI_GetObjectContent(conn, ctx, managedObjectReference,
- "VirtualMachine", propertyNameList,
- esxVI_Boolean_False, virtualMachine) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+ "VirtualMachine", propertyNameList,
+ esxVI_Boolean_False,
+ virtualMachine) < 0) {
goto failure;
}
@@ -1852,9 +1864,10 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
goto failure;
}
- if (esxVI_GetObjectContent(conn, ctx, ctx->datacenter,
- "Datastore", completePropertyNameList,
- esxVI_Boolean_True, &datastoreList) < 0) {
+ if (esxVI_LookupObjectContentByType(conn, ctx, ctx->datacenter,
+ "Datastore", completePropertyNameList,
+ esxVI_Boolean_True,
+ &datastoreList) < 0) {
goto failure;
}
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 6ba6bed..4892fde 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -192,29 +192,33 @@ int esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node,
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Utility and Convenience Functions
+ *
+ * Function naming scheme:
+ * - 'lookup' functions query the ESX or vCenter for information
+ * - 'get' functions get information from a local object
*/
-int
-esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
+int esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
-int
-esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
- esxVI_Boolean required);
+int esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
+ esxVI_Boolean required);
int esxVI_BuildFullTraversalSpecItem
(virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList,
const char *name, const char *type, const char *path,
const char *selectSetNames);
+
int esxVI_BuildFullTraversalSpecList
(virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList);
int esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx);
-int esxVI_GetObjectContent(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ManagedObjectReference *root,
- const char *type, esxVI_String *propertyNameList,
- esxVI_Boolean recurse,
- esxVI_ObjectContent **objectContentList);
+int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *root,
+ const char *type,
+ esxVI_String *propertyNameList,
+ esxVI_Boolean recurse,
+ esxVI_ObjectContent **objectContentList);
int esxVI_GetManagedEntityStatus
(virConnectPtr conn, esxVI_ObjectContent *objectContent,
@@ -225,7 +229,7 @@ int esxVI_GetVirtualMachinePowerState
(virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
esxVI_VirtualMachinePowerState *powerState);
-int esxVI_GetNumberOfDomainsByPowerState
+int esxVI_LookupNumberOfDomainsByPowerState
(virConnectPtr conn, esxVI_Context *ctx,
esxVI_VirtualMachinePowerState powerState, esxVI_Boolean inverse);
@@ -233,9 +237,9 @@ int esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
esxVI_ObjectContent *virtualMachine,
int *id, char **name, unsigned char *uuid);
-int esxVI_GetResourcePool(virConnectPtr conn, esxVI_Context *ctx,
- esxVI_ObjectContent *hostSystem,
- esxVI_ManagedObjectReference **resourcePool);
+int esxVI_LookupResourcePoolByHostSystem
+ (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+ esxVI_ManagedObjectReference **resourcePool);
int esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
const char *ipAddress,
--
1.6.0.4
15 years, 5 months
[libvirt] [PATCH] ESX: Fix memory leak in list handling functions.
by Matthias Bolte
If an error occurs between the allocation of an item and appending it
to the list, the item leaks. Free such orphaned items in error cases.
* src/esx/esx_vi.c: free orphaned items in error cases
---
src/esx/esx_vi.c | 24 ++++++++----------------
1 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index bcf110f..04860e2 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -959,28 +959,22 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
esxVI_AnyType_Free(&childAnyType);
- if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0) {
+ if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0 ||
+ castFromAnyTypeFunc(conn, childAnyType, &item) < 0 ||
+ esxVI_List_Append(conn, list, item) < 0) {
goto failure;
}
item = NULL;
-
- if (castFromAnyTypeFunc(conn, childAnyType, &item) < 0) {
- goto failure;
- }
-
- if (esxVI_List_Append(conn, list, item) < 0) {
- goto failure;
- }
}
-
cleanup:
esxVI_AnyType_Free(&childAnyType);
return result;
failure:
+ freeFunc(&item);
freeFunc(list);
result = -1;
@@ -1039,20 +1033,18 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
goto failure;
}
- item = NULL;
-
- if (deserializeFunc(conn, node, &item) < 0) {
+ if (deserializeFunc(conn, node, &item) < 0 ||
+ esxVI_List_Append(conn, list, item) < 0) {
goto failure;
}
- if (esxVI_List_Append(conn, list, item) < 0) {
- goto failure;
- }
+ item = NULL;
}
return 0;
failure:
+ freeFunc(&item);
freeFunc(list);
return -1;
--
1.6.0.4
15 years, 5 months
[libvirt] [PATCH 0/4] Support for SPICE graphics
by Daniel P. Berrange
This series of patches adds minimal support for SPICE graphics
which is newly introduced in RHEL-5.4's fork of KVM. Since this
is not yet merged in upstream QEMU/KVM, I'm not proposing to merge
all these patches. The two XML schema patches are straightforward
to merge.
The two implementation ones are RHEL5 specific and I want to
avoid declaring them supported until we have a sign of what the
upstream merge will look like, since previous attempst to support
KVM args prior to QEMU acceptance have been very painful long
term.
Daniel
15 years, 5 months
[libvirt] [PATCH] libvirt-devel should only require libvirt-client
by Mark McLoughlin
There's a long known issue where if you install libvirt in a guest,
the default virtual network will conflict with the default virtual
network in the host.
That's one of the reasons we have the libvirt-client RPM - it allows
you to install the client library without having the host side
installed.
Rich Jones points out that if you install libvirt-devel in a guest,
then you get libvirtd installed and the network conflict:
https://bugzilla.redhat.com/531200
libvirt-devel should only require libvirt-client - e.g. nothing in
the devel package pertains to anything in the libvirt RPM. The Fedora
packaging guidelines say:
https://fedoraproject.org/wiki/Packaging/Guidelines#Devel_Packages
Devel packages must require the base package using a fully versioned
dependency ...
But for all intents and purposes, libvirt-client is our base RPM.
* libvirt.spec.in: make libvirt-devel require libvirt-client
---
libvirt.spec.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 6cd0888..7e1550e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -341,7 +341,7 @@ virtualization capabilities of recent versions of Linux (and other OSes).
%package devel
Summary: Libraries, includes, etc. to compile with the libvirt library
Group: Development/Libraries
-Requires: libvirt = %{version}-%{release}
+Requires: libvirt-client = %{version}-%{release}
Requires: pkgconfig
%if %{with_xen}
Requires: xen-devel
--
1.6.2.5
15 years, 5 months
[libvirt] [PATCH] qemu: Fix an error message in GetVcpus
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 082cb04..a3beedb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3481,7 +3481,8 @@ qemudDomainGetVcpus(virDomainPtr dom,
if (!virDomainIsActive(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s",_("cannot pin vcpus on an inactive domain"));
+ "%s",
+ _("cannot list vcpu pinning for an inactive domain"));
goto cleanup;
}
--
1.6.5.rc2
15 years, 5 months
[libvirt] [PATCH] Fix p2p migration without a passed uri.
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/libvirt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 926c539..126675e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3217,7 +3217,7 @@ virDomainMigrate (virDomainPtr domain,
char *dstURI = NULL;
if (uri == NULL) {
dstURI = virConnectGetURI(dconn);
- if (!uri)
+ if (!dstURI)
return NULL;
}
--
1.6.5.rc2
15 years, 5 months
[libvirt] [PATCH] virterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/util/virterror.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 657cb3f..10f979c 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1082,6 +1082,7 @@ virErrorMsg(virErrorNumber error, const char *info)
errmsg = _("Invalid secret");
else
errmsg = _("Invalid secret: %s");
+ break;
case VIR_ERR_NO_SECRET:
if (info == NULL)
errmsg = _("Secret not found");
--
1.6.5.rc2
15 years, 5 months
[libvirt] [PATCH] qemu: migrate: Don't require manual URI to specify a port
by Cole Robinson
The xen driver will generate a migration port if only a hostname is passed
in the optional migrate URI, so let's do the same in qemu.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fb952d8..3ef29a6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6304,15 +6304,32 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
/* Get the port number. */
p = strrchr (uri_in, ':');
- p++; /* definitely has a ':' in it, see above */
- this_port = virParseNumber (&p);
- if (this_port == -1 || p-uri_in != strlen (uri_in)) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("URI did not have ':port' at the end"));
- goto cleanup;
+ if (p == strchr(uri_in, ':')) {
+ /* Generate a port */
+ this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
+ if (port == QEMUD_MIGRATION_NUM_PORTS)
+ port = 0;
+
+ /* Caller frees */
+ if (virAsprintf(uri_out, "%s:%d", uri_in, this_port) < 0) {
+ virReportOOMError (dconn);
+ goto cleanup;
+ }
+
+ } else {
+ p++; /* definitely has a ':' in it, see above */
+ this_port = virParseNumber (&p);
+ if (this_port == -1 || p-uri_in != strlen (uri_in)) {
+ qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
+ "%s", _("URI ended with incorrect ':port'"));
+ goto cleanup;
+ }
}
}
+ if (uri_out && *uri_out)
+ VIR_DEBUG("Generated uri_out=%s", *uri_out);
+
/* Parse the domain XML. */
if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
VIR_DOMAIN_XML_INACTIVE))) {
--
1.6.5.rc2
15 years, 5 months
[libvirt] [PATCH 0/4] test: Support virStorageFindPoolSources
by Cole Robinson
The following series refactors the storage pool parsing code to better
facilitate FindPoolSources (both for the test driver, and future pool backend
implementations). The last patch implements a FindPoolSources for the test
driver, with hardcoded results for test:///default.
Thanks,
Cole
Cole Robinson (4):
storage: Break out pool source parsing to a separate function.
storage: Break out function to add pool source to a SourceList.
storage: Add ParseSourceString function for use with FindPoolSources.
test: Support virStorageFindPoolSources
src/conf/storage_conf.c | 259 +++++++++++++++++++++++----------
src/conf/storage_conf.h | 7 +
src/libvirt_private.syms | 2 +
src/storage/storage_backend_fs.c | 65 ++++-----
src/storage/storage_backend_logical.c | 9 +-
src/test/test_driver.c | 75 +++++++++-
6 files changed, 291 insertions(+), 126 deletions(-)
15 years, 5 months
[libvirt] [PATCH] Update the documentation for virDomainMigrateToURI
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/libvirt.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 9e87900..5787f22 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3154,7 +3154,7 @@ virDomainMigrateDirect (virDomainPtr domain,
* XML includes details of the support URI schemes. If omitted
* the dconn will be asked for a default URI.
*
- * In either case it is typically only neccessary to specify a
+ * In either case it is typically only necessary to specify a
* URI if the destination host has multiple interfaces and a
* specific interface is required to transmit migration data.
*
@@ -3273,7 +3273,7 @@ error:
/**
* virDomainMigrateToURI:
* @domain: a domain object
- * @duri: mandatory URI for the destination host
+ * @duri: mandatory URI for the destination host (see below)
* @flags: flags
* @dname: (optional) rename domain to this at destination
* @bandwidth: (optional) specify migration bandwidth limit in Mbps
@@ -3285,28 +3285,31 @@ error:
* VIR_MIGRATE_LIVE Do not pause the VM during migration
* VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts
* VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel
+ * VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain
+ * on the destination host.
+ * VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the
+ * domain on the source host.
*
- * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
- * Applications using the VIR_MIGRATE_PEER2PEER flag will probably
- * prefer to invoke virDomainMigrateToURI, avoiding the need to
- * open connection to the destination host themselves.
- *
- * If a hypervisor supports renaming domains during migration,
- * then you may set the dname parameter to the new name (otherwise
- * it keeps the same name). If this is not supported by the
- * hypervisor, dname must be NULL or else you will get an error.
- *
- * If the VIR_MIGRATE_PEER2PEER flag is set, the duri parameter
- * must be a valid libvirt connection URI, by which the source
- * libvirt driver can connect to the destination libvirt.
- *
+ * The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
* If the VIR_MIGRATE_PEER2PEER flag is NOT set, the duri parameter
* takes a hypervisor specific format. The hypervisor capabilities
- * XML includes details of the support URI schemes. Not all hypervisors
+ * XML includes details of the supported URI schemes. Not all hypervisors
* will support this mode of migration, so if the VIR_MIGRATE_PEER2PEER
- * flag is not set, then it may be neccessary to use the alternative
+ * flag is not set, then it may be necessary to use the alternative
* virDomainMigrate API providing an explicit virConnectPtr for the
- * destination host
+ * destination host.
+ *
+ * If the VIR_MIGRATE_PEER2PEER flag IS set, the duri parameter
+ * must be a valid libvirt connection URI, by which the source
+ * libvirt driver can connect to the destination libvirt.
+ *
+ * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
+ *
+ * If a hypervisor supports renaming domains during migration,
+ * the dname parameter specifies the new name for the domain.
+ * Setting dname to NULL keeps the domain name the same. If domain
+ * renaming is not supported by the hypervisor, dname must be NULL or
+ * else an error will be returned.
*
* The maximum bandwidth (in Mbps) that will be used to do migration
* can be specified with the bandwidth parameter. If set to 0,
--
1.6.0.6
15 years, 5 months