_GetUpdatedParams: enhance value removal options
[ganeti-local] / lib / opcodes.py
index 66698f5..bbc4b26 100644 (file)
@@ -90,7 +90,7 @@ class BaseOpCode(object):
                        type(state))
 
     for name in self._all_slots():
-      if name not in state:
+      if name not in state and hasattr(self, name):
         delattr(self, name)
 
     for name in state:
@@ -301,9 +301,14 @@ class OpSetClusterParams(OpCode):
     "vg_name",
     "enabled_hypervisors",
     "hvparams",
+    "os_hvp",
     "beparams",
     "nicparams",
     "candidate_pool_size",
+    "maintain_node_health",
+    "uid_pool",
+    "add_uids",
+    "remove_uids",
     ]
 
 
@@ -412,6 +417,7 @@ class OpSetNodeParams(OpCode):
     "master_candidate",
     "offline",
     "drained",
+    "auto_promote",
     ]
 
 
@@ -454,18 +460,30 @@ class OpNodeEvacuationStrategy(OpCode):
 # instance opcodes
 
 class OpCreateInstance(OpCode):
-  """Create an instance."""
+  """Create an instance.
+
+  @ivar instance_name: Instance name
+  @ivar mode: Instance creation mode (one of L{constants.INSTANCE_CREATE_MODES})
+  @ivar source_handshake: Signed handshake from source (remote import only)
+  @ivar source_x509_ca: Source X509 CA in PEM format (remote import only)
+  @ivar source_instance_name: Previous name of instance (remote import only)
+
+  """
   OP_ID = "OP_INSTANCE_CREATE"
   OP_DSC_FIELD = "instance_name"
   __slots__ = [
-    "instance_name", "os_type", "force_variant",
+    "instance_name",
+    "os_type", "force_variant", "no_install",
     "pnode", "disk_template", "snode", "mode",
     "disks", "nics",
-    "src_node", "src_path", "start",
+    "src_node", "src_path", "start", "identify_defaults",
     "wait_for_sync", "ip_check", "name_check",
     "file_storage_dir", "file_driver",
     "iallocator",
-    "hypervisor", "hvparams", "beparams",
+    "hypervisor", "hvparams", "beparams", "osparams",
+    "source_handshake",
+    "source_x509_ca",
+    "source_instance_name",
     "dry_run",
     ]
 
@@ -618,7 +636,8 @@ class OpSetInstanceParams(OpCode):
   __slots__ = [
     "instance_name",
     "hvparams", "beparams", "force",
-    "nics", "disks",
+    "nics", "disks", "disk_template",
+    "remote_node", "os_name", "force_variant",
     ]
 
 
@@ -645,12 +664,47 @@ class OpQueryExports(OpCode):
   __slots__ = ["nodes", "use_locking"]
 
 
+class OpPrepareExport(OpCode):
+  """Prepares an instance export.
+
+  @ivar instance_name: Instance name
+  @ivar mode: Export mode (one of L{constants.EXPORT_MODES})
+
+  """
+  OP_ID = "OP_BACKUP_PREPARE"
+  OP_DSC_FIELD = "instance_name"
+  __slots__ = [
+    "instance_name", "mode",
+    ]
+
+
 class OpExportInstance(OpCode):
-  """Export an instance."""
+  """Export an instance.
+
+  For local exports, the export destination is the node name. For remote
+  exports, the export destination is a list of tuples, each consisting of
+  hostname/IP address, port, HMAC and HMAC salt. The HMAC is calculated using
+  the cluster domain secret over the value "${index}:${hostname}:${port}". The
+  destination X509 CA must be a signed certificate.
+
+  @ivar mode: Export mode (one of L{constants.EXPORT_MODES})
+  @ivar target_node: Export destination
+  @ivar x509_key_name: X509 key to use (remote export only)
+  @ivar destination_x509_ca: Destination X509 CA in PEM format (remote export
+                             only)
+
+  """
   OP_ID = "OP_BACKUP_EXPORT"
   OP_DSC_FIELD = "instance_name"
   __slots__ = [
+    # TODO: Rename target_node as it changes meaning for different export modes
+    # (e.g. "destination")
     "instance_name", "target_node", "shutdown", "shutdown_timeout",
+    "remove_instance",
+    "ignore_remove_failures",
+    "mode",
+    "x509_key_name",
+    "destination_x509_ca",
     ]
 
 
@@ -712,7 +766,7 @@ class OpTestDelay(OpCode):
   """
   OP_ID = "OP_TEST_DELAY"
   OP_DSC_FIELD = "duration"
-  __slots__ = ["duration", "on_master", "on_nodes"]
+  __slots__ = ["duration", "on_master", "on_nodes", "repeat"]
 
 
 class OpTestAllocator(OpCode):