Skip to content
Snippets Groups Projects
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 <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 6801eb5c
No related branches found
No related tags found
No related merge requests found
......@@ -2086,6 +2086,7 @@ def FinalizeExport(instance, snap_disks):
config.set(constants.INISECT_INS, 'vcpus', '%d' %
instance.beparams[constants.BE_VCPUS])
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
config.add_section(constants.INISECT_HYP)
for name, value in instance.hvparams.items():
if name not in constants.HVC_GLOBALS:
config.set(constants.INISECT_HYP, name, str(value))
config.add_section(constants.INISECT_BEP)
for name, value in instance.beparams.items():
config.set(constants.INISECT_BEP, name, str(value))
utils.WriteFile(utils.PathJoin(destdir, constants.EXPORT_CONF_FILE),
data=config.Dumps())
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment