Commit e86e6b3e authored by Klaus Aehlig's avatar Klaus Aehlig

Fix building of shell command in export

Commit 3d835f7d made two incorrect assumptions that
lead to instance moves failing for plain instances.
- The Import/Export interface is available at the level
  of block devices, not (as was assumed in the said
  commit) at the level of configuration objects.
- The Import/Export functions provide an argv vector
  not a single string; also the quoted version thereof
  is not a parameter so be substituted into a shell
  template (the quoted string does contain several
  characters with special meaning to the shell, e.g.,
  spaces).
Fix this now.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 4e1b1f74
......@@ -4971,12 +4971,13 @@ def _GetImportExportIoCommand(instance, mode, ieio, ieargs):
elif ieio == constants.IEIO_RAW_DISK:
(disk, ) = ieargs
real_disk = _OpenRealBD(disk)
if mode == constants.IEM_IMPORT:
suffix = utils.BuildShellCmd("| %s", disk.Import())
suffix = "| %s" % utils.ShellQuoteArgs(real_disk.Import())
elif mode == constants.IEM_EXPORT:
prefix = utils.BuildShellCmd("%s |", disk.Export())
prefix = "%s |" % utils.ShellQuoteArgs(real_disk.Export())
exp_size = disk.size
elif ieio == constants.IEIO_SCRIPT:
......
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