Commit 3c8954ad authored by Iustin Pop's avatar Iustin Pop
Browse files

Export more instance parameters in instance export

Currently the backend parameters are not exported automatically, but
only a few directly in the '[instance]' section. Hypervisor type and
hypervisor parameters are not exported at all.

This patch creates two separate sections for the be and hv parameters,
and stores the parameters (including ones that come from the cluster
defaults, but not the hypervisor globals for example) in the export.
The import code is not changed yet.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 6801eb5c
......@@ -2086,6 +2086,7 @@ def FinalizeExport(instance, snap_disks):
config.set(constants.INISECT_INS, 'vcpus', '%d' %
config.set(constants.INISECT_INS, 'disk_template', instance.disk_template)
config.set(constants.INISECT_INS, 'hypervisor', instance.hypervisor)
nic_total = 0
for nic_count, nic in enumerate(instance.nics):
......@@ -2112,6 +2113,17 @@ def FinalizeExport(instance, snap_disks):
config.set(constants.INISECT_INS, 'disk_count' , '%d' % disk_total)
# New-style hypervisor/backend parameters
for name, value in instance.hvparams.items():
if name not in constants.HVC_GLOBALS:
config.set(constants.INISECT_HYP, name, str(value))
for name, value in instance.beparams.items():
config.set(constants.INISECT_BEP, name, str(value))
utils.WriteFile(utils.PathJoin(destdir, constants.EXPORT_CONF_FILE),
shutil.rmtree(finaldestdir, ignore_errors=True)
......@@ -313,6 +313,8 @@ FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
# import/export config options
INISECT_EXP = "export"
INISECT_INS = "instance"
INISECT_HYP = "hypervisor"
INISECT_BEP = "backend"
# dynamic device modification
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