Skip to content

Commit

Permalink
libvirt_vm: enablement of SAN based guest with LUN id
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Balamuruhan S <[email protected]>
  • Loading branch information
Balamuruhan S committed Jun 18, 2019
1 parent 70b388d commit f9ca016
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
13 changes: 13 additions & 0 deletions shared/cfg/guest-hw.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions virttest/libvirt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion virttest/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9ca016

Please sign in to comment.