From f714ff65e71d85a0de1945f6b9702bb6e236a9c7 Mon Sep 17 00:00:00 2001 From: Balamuruhan S Date: Tue, 29 May 2018 15:57:13 +0530 Subject: [PATCH] libvirt_vm: enablement of SAN based guest with LUN id Boot guest with SAN based storage type using LUN id which can be retrieved from /dev/disk/by-id, this enablement helps to use the guest for SAN based migration tests. As LUN id would be same when LUN is shared across multiple host and it is necessary for migration to succeed. Suggested-by: Satheesh Rajendran Signed-off-by: Balamuruhan S --- shared/cfg/guest-hw.cfg | 13 +++++++++++++ virttest/libvirt_vm.py | 9 ++++++--- virttest/storage.py | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/shared/cfg/guest-hw.cfg b/shared/cfg/guest-hw.cfg index 4f2e4111168..6dc7e95eb48 100644 --- a/shared/cfg/guest-hw.cfg +++ b/shared/cfg/guest-hw.cfg @@ -306,6 +306,19 @@ variants image_backend: image_raw_device = yes storage_type = iscsi force_create_image = no + - san: + # Please update image_name and images_base_dir params based on your test env + only raw + storage_type = "san" + drive_format = "scsi" + driver_name = "qemu" + images_base_dir = "/dev/disk/by-id" + image_name = "scsi-360050768028211d8b0000000000000b9" + image_format = "raw" + drive_cache = "none" + image_device = "lun" + image_raw_device = yes + force_create_image = no - remote_nfs: storage_type = nfs nfs_mount_dir = /mnt/nfs_images diff --git a/virttest/libvirt_vm.py b/virttest/libvirt_vm.py index dbc06b46ccd..84c3e69ca13 100644 --- a/virttest/libvirt_vm.py +++ b/virttest/libvirt_vm.py @@ -726,7 +726,7 @@ def check_controller(virt_install_cmd_line, controller): def add_drive(help_text, filename, pool=None, vol=None, device=None, bus=None, perms=None, size=None, sparse=False, - cache=None, fmt=None): + cache=None, fmt=None, driver_name=None): cmd = " --disk" if filename: cmd += " path=%s" % filename @@ -749,6 +749,8 @@ def add_drive(help_text, filename, pool=None, vol=None, device=None, cmd += ",format=%s" % fmt if cache: cmd += ",cache=%s" % cache + if driver_name: + cmd += ",driver_name=%s" % driver_name return cmd def add_floppy(help_text, filename): @@ -1228,13 +1230,14 @@ def add_cputune(vcpu_cputune=""): filename, None, None, - None, + image_params.get("image_device"), _drive_format, None, image_params.get("image_size"), image_params.get("drive_sparse"), image_params.get("drive_cache"), - image_params.get("image_format")) + image_params.get("image_format"), + image_params.get("driver_name")) unattended_integrated = (params.get('unattended_delivery_method') != 'integrated') diff --git a/virttest/storage.py b/virttest/storage.py index 3e69e3b480c..a70cdf098a6 100644 --- a/virttest/storage.py +++ b/virttest/storage.py @@ -234,7 +234,8 @@ def cmp(x, y): image_format = params.get("image_format", "qcow2") if params.get("image_raw_device") == "yes": return image_name - if image_format: + storage_type = params.get("storage_type") + if image_format and storage_type != "san": image_filename = "%s.%s" % (image_name, image_format) else: image_filename = image_name