@@ -1,4 +1,4 @@
-import logging, time, socket
+import logging, time, socket, re
from autotest_lib.client.common_lib import error
import kvm_utils, kvm_test_utils
@@ -24,6 +24,11 @@ def run_unattended_install(test, params, env):
post_install_delay = 0
install_timeout = float(params.get("timeout", 3000))
+ migrate_background = params.get("migrate_background") == "yes"
+ if migrate_background:
+ mig_timeout = float(params.get("mig_timeout", "3600"))
+ mig_protocol = params.get("migration_protocol", "tcp")
+
logging.info("Starting unattended install watch process. "
"Timeout set to %ds (%d min)", install_timeout,
install_timeout/60)
@@ -46,7 +51,20 @@ def run_unattended_install(test, params, env):
break
except socket.error:
pass
- time.sleep(1)
+
+ if migrate_background:
+ # Drop the params which may break the migration
+ # Better method is to used dnsmasq to do the unattended installation
+ if vm.params.get("initrd"):
+ vm.params["initrd"] = None
+ if vm.params.get("kernel"):
+ vm.params["kernel"] = None
+ if vm.params.get("extra_params"):
+ vm.params["extra_params"] = re.sub("--append '.*'", "",
+ vm.params["extra_params"])
+ vm.migrate(timeout=mig_timeout, protocol=mig_protocol)
+ else:
+ time.sleep(1)
client.close()
end_time = time.time()
time_elapsed = int(end_time - start_time)
@@ -103,6 +103,9 @@ variants:
kernel = vmlinuz
initrd = initrd.img
nic_mode = tap
+ # uncomment the following line to test the migration in parallel
+ # migrate_with_background = yes
+
variants:
# Install guest from cdrom
- cdrom: