From 4f0afaf5e89ca23c02ff0ece8293c58f84d91a89 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 14 Aug 2008 10:27:07 +0000 Subject: [PATCH] Pass hypervisor type to the OS scripts It's handy to make the os scripts know which hypervisor the instance is going to run under. In order not to change the os API we pass this information in the environment, where the os scripts can access it if they're hypervisor-aware. Reviewed-by: imsnah --- lib/backend.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 68cfe5280..b993f9d5c 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -530,8 +530,9 @@ def AddOSToInstance(instance, os_disk, swap_disk): inst_os.path, create_script, instance.name, real_os_dev.dev_path, real_swap_dev.dev_path, logfile) + env = {'HYPERVISOR': ssconf.SimpleStore().GetHypervisorType()} - result = utils.RunCmd(command) + result = utils.RunCmd(command, env=env) if result.failed: logging.error("os create command '%s' returned error: %s, logfile: %s," " output: %s", command, result.fail_reason, logfile, @@ -1486,8 +1487,9 @@ def ImportOSIntoInstance(instance, os_disk, swap_disk, src_node, src_image): logfile) command = '|'.join([utils.ShellQuoteArgs(remotecmd), comprcmd, impcmd]) + env = {'HYPERVISOR': ssconf.SimpleStore().GetHypervisorType()} - result = utils.RunCmd(command) + result = utils.RunCmd(command, env=env) if result.failed: logging.error("os import command '%s' returned error: %s" -- GitLab