diff --git a/shared/cfg/base.cfg b/shared/cfg/base.cfg index 738f5afdb77..83c23d3c59f 100644 --- a/shared/cfg/base.cfg +++ b/shared/cfg/base.cfg @@ -268,6 +268,17 @@ image_unbootable_pattern = "Hard Disk.*not a bootable disk" # export_ip: optional. # export_options: optional. +# SAN support related params. Please fill the params based on the environment +# storage_type = "SAN" +# storage_lun_id can be retrieved from /dev/disk/by-id for the lun +# that has to be given to the guest +# storage_lun_id = "scsi-360050768028211d8b0000000000000b9" +# image_device = "lun" +# image_bus = "scsi" +# drive_cache = "none" +# image_format = "raw" +# driver_name = "qemu" + # # List of hypervisor-monitor object names (one per guest), # used to communicate with hypervisor to control guests. diff --git a/virttest/libvirt_vm.py b/virttest/libvirt_vm.py index dadd0e22d99..44a5b3fcb58 100644 --- a/virttest/libvirt_vm.py +++ b/virttest/libvirt_vm.py @@ -684,7 +684,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 @@ -707,6 +707,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): @@ -1151,6 +1153,21 @@ def add_kernel(help_text, cmdline, kernel_path=None, initrd_path=None, filename = storage.get_image_filename(image_params, base_dir) + if image_params.get("storage_type", None) == "SAN": + filename = image_params.get("storage_lun_id") + filename = os.path.join("/dev/disk/by-id", filename) + virt_install_cmd += add_drive(help_text, + filename, + None, + None, + image_params.get("image_device"), + image_params.get("image_bus"), + None, + None, + None, + image_params.get("drive_cache"), + image_params.get("image_format"), + image_params.get("driver_name")) if image_params.get("use_storage_pool") == "yes": filename = None virt_install_cmd += add_drive(help_text, @@ -1167,7 +1184,7 @@ def add_kernel(help_text, cmdline, kernel_path=None, initrd_path=None, if image_params.get("boot_drive") == "no": continue - if filename: + if filename and image_params.get("storage_type", None) != "SAN": libvirt_controller = image_params.get( "libvirt_controller", None) _drive_format = image_params.get("drive_format")