Hi,
When I used function esxListDefinedDomains at esx_driver.c to list defined domains and
found that retuned array include some templates.
Template just is a master image of a VM that can be used to create a new VM, maybe our
function should not return this type of VM.
So I changed some code to get config.template property and then discarded the
'true' items. Code changes may look like as following:
if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
esxVI_LookupVirtualMachineList(priv->primary, propertyNameList,
&virtualMachineList) < 0)
Change to
if (esxVI_String_AppendValueListToList(&propertyNameList, "name\0"
"config.template\0"
"runtime.powerState\0") < 0
||
esxVI_LookupVirtualMachineList(priv->primary, propertyNameList,
&virtualMachineList) < 0)
After line 2493,insert
if (esxVI_DomainIsTemplate(virtualMachine, &isTemplate)
< 0) {
goto cleanup;
}
if (isTemplate == esxVI_Boolean_True) {
continue;
}
The function esxVI_DomainIsTemplate looks like this:
int esxVI_DomainIsTemplate(esxVI_ObjectContent *virtualMachine,
esxVI_Boolean *isTemplate) {
esxVI_DynamicProperty *dynamicProperty;
for (dynamicProperty = virtualMachine->propSet; dynamicProperty !=
NULL;
dynamicProperty =
dynamicProperty->_next) {
if (STREQ(dynamicProperty->name,
"config.template")) {
if
(esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Boolean) < 0) {
return -1;
}
*isTemplate =
dynamicProperty->val->boolean;
return 0;
}
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing
'config.template' property"));
return -1;
}
Regards,
Dennis
Show replies by date