def create_data_volume_template(image_creation_option): ''' Create Data Volume Template from a data volume ''' action = api_actions.CreateDataVolumeTemplateFromVolumeAction() action.volumeUuid = image_creation_option.get_data_volume_uuid() action.backupStorageUuids = image_creation_option.get_backup_storage_uuid_list( ) name = image_creation_option.get_name() if not name: action.name = 'test_template_image' else: action.name = name description = image_creation_option.get_description() if not description: action.description = "test create template from volume" else: action.description = description test_util.action_logger( 'Create Data Volume Template from [data Volume:] %s in [backup Storage:] %s' % (action.volumeUuid, action.backupStorageUuids)) evt = account_operations.execute_action_with_session( action, image_creation_option.get_session_uuid()) return evt.inventory
def create_volume_template(volume_uuid, backup_storage_uuid_list, name = None, \ session_uuid = None): action = api_actions.CreateDataVolumeTemplateFromVolumeAction() action.volumeUuid = volume_uuid if name: action.name = name else: action.name = 'new_template_from_volume_%s' % volume_uuid action.backupStorageUuids = backup_storage_uuid_list test_util.action_logger('Create [Volume Template] for [Volume:] %s on [Backup Storages:] %s' % (volume_uuid, backup_storage_uuid_list)) evt = account_operations.execute_action_with_session(action, session_uuid) test_util.test_logger('[Volume Templated:] %s is created.' % evt.inventory.uuid) return evt.inventory