def find_compatible_virtual_datacenters(context, template): """ Find a virtual datacenter compatible with the template. """ cloud = context.getCloudService() all = cloud.listVirtualDatacenters( VirtualDatacenterPredicates.datacenter(template.getDatacenter())) def compatible(vdc): type = vdc.getHypervisorType() res = type.isCompatible(template.getDiskFormatType()) log.debug("%s compatible with source format: %s" % (vdc.getName(), res)) if not res: conv = template.listConversions(type, ConversionState.FINISHED) res = len(conv) > 0 log.debug("%s compatible with conversions: %s" % (vdc.getName(), res)) return res return filter(compatible, all)
def find_compatible_virtual_datacenters(context, template): """ Find a virtual datacenter compatible with the template. """ cloud = context.getCloudService() all = cloud.listVirtualDatacenters( VirtualDatacenterPredicates.datacenter(template.getDatacenter())) def compatible(vdc): type = vdc.getHypervisorType() res = type.isCompatible(template.getDiskFormatType()) log.debug("%s compatible with source format: %s" % (vdc.getName(), res)) if not res: conv = template.listConversions(type, ConversionState.FINISHED) res = len(conv) > 0 log.debug("%s compatible with conversions: %s" % (vdc.getName(), res)) return res return filter(compatible, all)
def find_compatible_virtual_datacenters(context, type, datacenter): """ Find a virtual datacenter compatible with the type and datacenter.. """ cloud = context.getCloudService() all = cloud.listVirtualDatacenters( VirtualDatacenterPredicates.datacenter(datacenter)) return filter(lambda vdc: vdc.getHypervisorType().isCompatible(type), all)
def find_compatible_virtual_datacenters(context, type, datacenter): """ Find a virtual datacenter compatible with the type and datacenter. """ cloud = context.getCloudService() all = cloud.listVirtualDatacenters( VirtualDatacenterPredicates.datacenter(datacenter)) return filter(lambda vdc: vdc.getHypervisorType().isCompatible(type), all)