[libvirt] [PATCH] esx: Make sure dumpxml outputs proper ID for active domains

--- src/esx/esx_driver.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 4fb357b..c6bd3b8 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2624,6 +2624,8 @@ esxDomainDumpXML(virDomainPtr domain, int flags) esxPrivate *priv = domain->conn->privateData; esxVI_String *propertyNameList = NULL; esxVI_ObjectContent *virtualMachine = NULL; + esxVI_VirtualMachinePowerState powerState; + int id; char *vmPathName = NULL; char *datastoreName = NULL; char *directoryName = NULL; @@ -2640,11 +2642,14 @@ esxDomainDumpXML(virDomainPtr domain, int flags) return NULL; } - if (esxVI_String_AppendValueToList(&propertyNameList, - "config.files.vmPathName") < 0 || + if (esxVI_String_AppendValueListToList(&propertyNameList, + "config.files.vmPathName\0" + "runtime.powerState\0") < 0 || esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid, propertyNameList, &virtualMachine, esxVI_Occurrence_RequiredItem) < 0 || + esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 || + esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0 || esxVI_GetStringValue(virtualMachine, "config.files.vmPathName", &vmPathName, esxVI_Occurrence_RequiredItem) < 0) { goto cleanup; @@ -2693,6 +2698,10 @@ esxDomainDumpXML(virDomainPtr domain, int flags) priv->primary->productVersion); if (def != NULL) { + if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { + def->id = id; + } + xml = virDomainDefFormat(def, flags); } -- 1.7.0.4

On 08/20/2010 01:07 PM, Matthias Bolte wrote:
--- src/esx/esx_driver.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
ACK.
@@ -2693,6 +2698,10 @@ esxDomainDumpXML(virDomainPtr domain, int flags) priv->primary->productVersion);
if (def != NULL) { + if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { + def->id = id; + } + xml = virDomainDefFormat(def, flags); }
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/8/20 Eric Blake <eblake@redhat.com>:
On 08/20/2010 01:07 PM, Matthias Bolte wrote:
--- src/esx/esx_driver.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
ACK.
@@ -2693,6 +2698,10 @@ esxDomainDumpXML(virDomainPtr domain, int flags) priv->primary->productVersion);
if (def != NULL) { + if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { + def->id = id; + } + xml = virDomainDefFormat(def, flags); }
Thanks, pushed. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte