gnt-node: Add instance policy to migrate
[ganeti-local] / lib / client / gnt_backup.py
index 3d13d40..dcde5d7 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 
 """Backup related commands"""
 
-# pylint: disable-msg=W0401,W0613,W0614,C0103
+# pylint: disable=W0401,W0613,W0614,C0103
 # W0401: Wildcard import ganeti.cli
 # W0613: Unused argument, since all functions follow the same API
 # W0614: Unused import %s from wildcard import (since we need cli)
@@ -32,9 +32,6 @@ from ganeti import constants
 from ganeti import errors
 
 
-_VALUE_TRUE = "true"
-
-
 def PrintExportList(opts, args):
   """Prints a list of all the exported system images.
 
@@ -76,12 +73,12 @@ def ExportInstance(opts, args):
     raise errors.OpPrereqError("Target node must be specified",
                                errors.ECODE_INVAL)
 
-  op = opcodes.OpExportInstance(instance_name=args[0],
-                                target_node=opts.node,
-                                shutdown=opts.shutdown,
-                                shutdown_timeout=opts.shutdown_timeout,
-                                remove_instance=opts.remove_instance,
-                                ignore_remove_failures=ignore_remove_failures)
+  op = opcodes.OpBackupExport(instance_name=args[0],
+                              target_node=opts.node,
+                              shutdown=opts.shutdown,
+                              shutdown_timeout=opts.shutdown_timeout,
+                              remove_instance=opts.remove_instance,
+                              ignore_remove_failures=ignore_remove_failures)
 
   SubmitOpCode(op, opts=opts)
   return 0
@@ -107,7 +104,7 @@ def RemoveExport(opts, args):
   @return: the desired exit code
 
   """
-  op = opcodes.OpRemoveExport(instance_name=args[0])
+  op = opcodes.OpBackupRemove(instance_name=args[0])
 
   SubmitOpCode(op, opts=opts)
   return 0
@@ -115,27 +112,10 @@ def RemoveExport(opts, args):
 
 # this is defined separately due to readability only
 import_opts = [
-  BACKEND_OPT,
-  DISK_OPT,
-  DISK_TEMPLATE_OPT,
-  FILESTORE_DIR_OPT,
-  FILESTORE_DRIVER_OPT,
-  HYPERVISOR_OPT,
-  IALLOCATOR_OPT,
   IDENTIFY_DEFAULTS_OPT,
-  NET_OPT,
-  NODE_PLACEMENT_OPT,
-  NOIPCHECK_OPT,
-  NONAMECHECK_OPT,
-  NONICS_OPT,
-  NWSYNC_OPT,
-  OSPARAMS_OPT,
-  OS_SIZE_OPT,
   SRC_DIR_OPT,
   SRC_NODE_OPT,
-  SUBMIT_OPT,
-  DRY_RUN_OPT,
-  PRIORITY_OPT,
+  IGNORE_IPOLICY_OPT,
   ]
 
 
@@ -152,7 +132,7 @@ commands = {
     "-n <target_node> [opts...] <name>",
     "Exports an instance to an image"),
   'import': (
-    ImportInstance, ARGS_ONE_INSTANCE, import_opts,
+    ImportInstance, ARGS_ONE_INSTANCE, COMMON_CREATE_OPTS + import_opts,
     "[...] -t disk-type -n node[:secondary-node] <name>",
     "Imports an instance from an exported image"),
   'remove': (