Skip to content

Commit

Permalink
add convert disk test
Browse files Browse the repository at this point in the history
Convert small raw disk to qcow with incremental backup enabled

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
  • Loading branch information
bennyz committed Apr 18, 2022
1 parent eee6584 commit d1bddca
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions basic-suite-master/test-scenarios/test_004_basic_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
DISK2_NAME = '%s_disk2' % VM2_NAME
DISK3_NAME = '%s_disk3' % VM1_NAME
FLOATING_DISK_NAME = 'floating_disk'
CONVERT_DISK_NAME = 'convert_disk'
BACKUP_DISK_NAME = '%s_disk' % BACKUP_VM_NAME

SD_TEMPLATES_NAME = 'templates'
Expand Down Expand Up @@ -138,6 +139,7 @@
"test_offline_snapshot_restore",
"test_import_template",
"test_live_storage_migration",
"test_convert_disk",
"test_verify_offline_snapshot_restore",
"test_remove_vm2_lease",
"test_hotunplug_disk",
Expand Down Expand Up @@ -735,6 +737,35 @@ def test_live_storage_migration(engine_api):
assert assert_utils.equals_within_long(lambda: disk_service.get().status, types.DiskStatus.OK)


@order_by(_TEST_LIST)
def test_convert_disk(engine_api):
engine = engine_api.system_service()
correlation_id = 'convert_disk'

disks_service = engine.disks_service()
disks_service.add(
types.Disk(
name=CONVERT_DISK_NAME,
format=types.DiskFormat.RAW,
provisioned_size=2 * MB,
storage_domains=[types.StorageDomain(name=SD_ISCSI_NAME)],
),
query={'correlation_id': correlation_id},
)

disk_service = test_utils.get_disk_service(engine, CONVERT_DISK_NAME)
assert assert_utils.equals_within_short(lambda: disk_service.get().status, types.DiskStatus.OK)

disk_service.convert(
format=types.DiskFormat.COW,
backup=types.DiskBackup.INCREMENTAL,
query={'correlation_id': correlation_id},
)

assert assert_utils.equals_within_short(lambda: disk_service.get().status, types.DiskStatus.OK)
assert assert_utils.equals_within_short(lambda: disk_service.get().format, types.DiskFormat.COW)


@order_by(_TEST_LIST)
def test_export_vm2(engine_api):
engine = engine_api.system_service()
Expand Down

0 comments on commit d1bddca

Please sign in to comment.