Commit bc696589 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

gnt-backup: Don't show confusing message w/o target node

“gnt-backup export” requires the target node. Until now, the master
daemon would complain that the “parameter
'OP_BACKUP_EXPORT.target_node' fails validation”. With this patch,
an additional check is done in the client program.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarManuel Franceschini <>
parent 85b3901b
......@@ -204,6 +204,8 @@ def RunExportImportTests(instance, pnode):
if qa_config.TestEnabled('instance-export'):
RunTest(qa_instance.TestInstanceExportNoTarget, instance)
expnode = qa_config.AcquireNode(exclude=pnode)
name = RunTest(qa_instance.TestInstanceExport, instance, expnode)
......@@ -280,7 +280,7 @@ def TestReplaceDisks(instance, pnode, snode, othernode):
def TestInstanceExport(instance, node):
"""gnt-backup export"""
"""gnt-backup export -n ..."""
master = qa_config.GetMasterNode()
cmd = ['gnt-backup', 'export', '-n', node['primary'], instance['name']]
......@@ -300,6 +300,15 @@ def TestInstanceExportWithRemove(instance, node):
utils.ShellQuoteArgs(cmd)).wait(), 0)
def TestInstanceExportNoTarget(instance):
"""gnt-backup export (without target node, should fail)"""
master = qa_config.GetMasterNode()
cmd = ["gnt-backup", "export", instance["name"]]
utils.ShellQuoteArgs(cmd)).wait(), 0)
def TestInstanceImport(node, newinst, expnode, name):
"""gnt-backup import"""
master = qa_config.GetMasterNode()
......@@ -31,6 +31,7 @@ import sys
from ganeti.cli import *
from ganeti import opcodes
from ganeti import constants
from ganeti import errors
_VALUE_TRUE = "true"
......@@ -73,6 +74,9 @@ def ExportInstance(opts, args):
ignore_remove_failures = opts.ignore_remove_failures
if not opts.node:
raise errors.OpPrereqError("Target node must be specified")
op = opcodes.OpExportInstance(instance_name=args[0],
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