def upload_image(self, context, session, instance, image_id, vdi_uuids): params = self._make_params(context, session, image_id) params['vdi_uuids'] = vdi_uuids props = params['properties'] = {} props['auto_disk_config'] = instance['auto_disk_config'] props['os_type'] = instance.get( 'os_type', None) or (CONF.xenserver.default_os_type) compression_level = vm_utils.get_compression_level() if compression_level: props['xenapi_image_compression_level'] = compression_level auto_disk_config = utils.get_auto_disk_config_from_instance(instance) if utils.is_auto_disk_config_disabled(auto_disk_config): props["auto_disk_config"] = "disabled" try: self._call_glance_plugin(context, instance, session, 'upload_vhd', params) except exception.PluginRetriesExceeded: raise exception.CouldNotUploadImage(image_id=image_id)
def upload_image(self, context, session, instance, image_id, vdi_uuids): params = self._make_params(context, session, image_id) params['vdi_uuids'] = vdi_uuids props = params['properties'] = {} props['auto_disk_config'] = instance['auto_disk_config'] props['os_type'] = instance.get('os_type', None) or ( CONF.xenserver.default_os_type) compression_level = vm_utils.get_compression_level() if compression_level: props['xenapi_image_compression_level'] = compression_level auto_disk_config = utils.get_auto_disk_config_from_instance(instance) if utils.is_auto_disk_config_disabled(auto_disk_config): props["auto_disk_config"] = "disabled" try: self._call_glance_plugin(context, instance, session, 'upload_vhd', params) except exception.PluginRetriesExceeded: raise exception.CouldNotUploadImage(image_id=image_id)
def test_is_auto_disk_config_disabled_false(self): self.assertFalse(utils.is_auto_disk_config_disabled("false"))
def test_is_auto_disk_config_disabled_none(self): self.assertFalse(utils.is_auto_disk_config_disabled(None))
def test_is_auto_disk_config_disabled(self): self.assertTrue(utils.is_auto_disk_config_disabled("Disabled "))