diff --git a/nova/virt/fusioncomputeapi/constant.py b/nova/virt/fusioncomputeapi/constant.py index 0bd64ff..872d1bb 100644 --- a/nova/virt/fusioncomputeapi/constant.py +++ b/nova/virt/fusioncomputeapi/constant.py @@ -321,8 +321,8 @@ FC_REBOOT_TYPE = { REBOOT_TYPE.SOFT: 'safe' } -HUAWEI_OS_TYPE = '__os_type' -HUAWEI_OS_VERSION = '__os_version' +HUAWEI_OS_TYPE = 'os_type' +HUAWEI_OS_VERSION = 'os_distro' HUAWEI_IMAGE_LOCATION = '__image_location' HUAWEI_IMAGE_TYPE = '__image_source_type' HUAWEI_IS_LINK_CLONE = '__linked_clone' diff --git a/nova/virt/fusioncomputeapi/vmcreation.py b/nova/virt/fusioncomputeapi/vmcreation.py index 034b04c..0403d09 100644 --- a/nova/virt/fusioncomputeapi/vmcreation.py +++ b/nova/virt/fusioncomputeapi/vmcreation.py @@ -589,14 +589,20 @@ class VmCreateWithImage(VmCreateByImport): def get_os_options(self): """get vm os info""" - # get os Type from mata - # os_type = self.image_properties.get(constant.HUAWEI_OS_TYPE) - # os_version = self.image_properties. - # get(constant.HUAWEI_OS_VERSION) - # if os_type: - # return self.get_fc_os_options(os_type, os_version) - # else: - return super(VmCreateWithImage, self).get_os_options() + if self.image_properties.obj_attr_is_set(constant.HUAWEI_OS_TYPE): + os_type = self.image_properties.get(constant.HUAWEI_OS_TYPE) + else: + os_type = "other" + + if self.image_properties.obj_attr_is_set(constant.HUAWEI_OS_VERSION): + os_version = self.image_properties.get(constant.HUAWEI_OS_VERSION) + else: + os_version = "other" + + if os_type: + return self.get_fc_os_options(os_type, os_version) + else: + return super(VmCreateWithImage, self).get_os_options() def _get_image_size(self): """get image size info"""