mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
esx: Make sure dumpxml outputs proper ID for active domains
This commit is contained in:
parent
d6fdde23f7
commit
a8cc67a44b
@ -2624,6 +2624,8 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
|
|||||||
esxPrivate *priv = domain->conn->privateData;
|
esxPrivate *priv = domain->conn->privateData;
|
||||||
esxVI_String *propertyNameList = NULL;
|
esxVI_String *propertyNameList = NULL;
|
||||||
esxVI_ObjectContent *virtualMachine = NULL;
|
esxVI_ObjectContent *virtualMachine = NULL;
|
||||||
|
esxVI_VirtualMachinePowerState powerState;
|
||||||
|
int id;
|
||||||
char *vmPathName = NULL;
|
char *vmPathName = NULL;
|
||||||
char *datastoreName = NULL;
|
char *datastoreName = NULL;
|
||||||
char *directoryName = NULL;
|
char *directoryName = NULL;
|
||||||
@ -2640,11 +2642,14 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esxVI_String_AppendValueToList(&propertyNameList,
|
if (esxVI_String_AppendValueListToList(&propertyNameList,
|
||||||
"config.files.vmPathName") < 0 ||
|
"config.files.vmPathName\0"
|
||||||
|
"runtime.powerState\0") < 0 ||
|
||||||
esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
|
esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
|
||||||
propertyNameList, &virtualMachine,
|
propertyNameList, &virtualMachine,
|
||||||
esxVI_Occurrence_RequiredItem) < 0 ||
|
esxVI_Occurrence_RequiredItem) < 0 ||
|
||||||
|
esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0 ||
|
||||||
|
esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, NULL) < 0 ||
|
||||||
esxVI_GetStringValue(virtualMachine, "config.files.vmPathName",
|
esxVI_GetStringValue(virtualMachine, "config.files.vmPathName",
|
||||||
&vmPathName, esxVI_Occurrence_RequiredItem) < 0) {
|
&vmPathName, esxVI_Occurrence_RequiredItem) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2693,6 +2698,10 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
|
|||||||
priv->primary->productVersion);
|
priv->primary->productVersion);
|
||||||
|
|
||||||
if (def != NULL) {
|
if (def != NULL) {
|
||||||
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
||||||
|
def->id = id;
|
||||||
|
}
|
||||||
|
|
||||||
xml = virDomainDefFormat(def, flags);
|
xml = virDomainDefFormat(def, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user