diff --git a/qemu/tests/cfg/usb.cfg b/qemu/tests/cfg/usb.cfg index a20836f5e57d40eac83d7c5e533bf8dbd1aad43e..25234b7af70475112f012678f2143fc25d0b35e5 100644 --- a/qemu/tests/cfg/usb.cfg +++ b/qemu/tests/cfg/usb.cfg @@ -187,6 +187,7 @@ - usb_storage: type = usb_storage images += " stg" + blk_extra_params_stg = "serial=TARGET_DISK0" image_boot_image1 = yes image_name_stg = "images/usbdevice" image_format_stg = "qcow2" diff --git a/qemu/tests/format_disk.py b/qemu/tests/format_disk.py index 4d1a11dd49ce3d77406763dae9b96d879094b9aa..c184515160ae00ccd70a94ae0659ee8dc2f347a9 100644 --- a/qemu/tests/format_disk.py +++ b/qemu/tests/format_disk.py @@ -37,6 +37,12 @@ def run(test, params, env): if params.get("os_type") == 'linux': drive_name = params.objects("images")[-1] drive_id = params["blk_extra_params_%s" % drive_name].split("=")[1] + # If a device option(bool/str) in qemu cmd line doesn't have a value, + # qemu assigns the value as "on". + if drive_id == "NO_EQUAL_STRING": + drive_id = "on" + elif drive_id == "EMPTY_STRING": + drive_id = "" drive_path = utils_misc.get_linux_drive_path(session, drive_id) if not drive_path: raise error.TestError("Failed to get '%s' drive path" % drive_name) diff --git a/qemu/tests/usb_storage.py b/qemu/tests/usb_storage.py index 8ecbc8e2785073c4144ac16f8dd7bdba72fae83b..9285224a8b1d3b8d4174b85b06e9fa3fcc68284e 100644 --- a/qemu/tests/usb_storage.py +++ b/qemu/tests/usb_storage.py @@ -95,11 +95,10 @@ def run(test, params, env): if vm.is_alive(): vm.destroy() - new_params = params.copy() for option, value in options.iteritems(): - new_params[option] = value + params[option] = value error.context("Restarting VM") - vm.create(params=new_params) + vm.create(params=params) vm.verify_alive() def _login(): @@ -123,7 +122,7 @@ def run(test, params, env): @error.context_aware def _check_serial_option(serial, regex_str, expect_str): error.context("Set serial option to '%s'" % serial, logging.info) - _restart_vm({"drive_serial_stg": serial}) + _restart_vm({"blk_extra_params_stg": "serial=" + serial}) error.context("Check serial option in monitor", logging.info) output = str(vm.monitor.info("qtree"))