Commit 4f0afaf5 authored by Guido Trotter's avatar Guido Trotter
Browse files

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
parent 2557ff82
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment