Bug Reports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]