Commit 720f56c8 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Iustin Pop
Browse files

Add tag handling to {Op,LU}InstanceCreate

Add a tag slot to opcodes.OpInstanceCreate. We do not reuse _PTags, as this is
intended for OpTagsSet and thus:

  a) is not documented
  b) does not carry a default value, making it mandatory

Also pass the tags to the iallocator during instance creation.
Signed-off-by: default avatarApollon Oikonomopoulos <>
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarIustin Pop <>
parent 85061b9a
...@@ -8000,7 +8000,7 @@ class LUInstanceCreate(LogicalUnit): ...@@ -8000,7 +8000,7 @@ class LUInstanceCreate(LogicalUnit):
name=self.op.instance_name, name=self.op.instance_name,
disk_template=self.op.disk_template, disk_template=self.op.disk_template,
tags=[], tags=self.op.tags,
os=self.op.os_type, os=self.op.os_type,
vcpus=self.be_full[constants.BE_VCPUS], vcpus=self.be_full[constants.BE_VCPUS],
memory=self.be_full[constants.BE_MEMORY], memory=self.be_full[constants.BE_MEMORY],
...@@ -8236,6 +8236,10 @@ class LUInstanceCreate(LogicalUnit): ...@@ -8236,6 +8236,10 @@ class LUInstanceCreate(LogicalUnit):
",".join(enabled_hvs)), ",".join(enabled_hvs)),
# Check tag validity
for tag in self.op.tags:
# check hypervisor parameter syntax (locally) # check hypervisor parameter syntax (locally)
utils.ForceDictType(self.op.hvparams, constants.HVS_PARAMETER_TYPES) utils.ForceDictType(self.op.hvparams, constants.HVS_PARAMETER_TYPES)
filled_hvp = cluster.SimpleFillHV(self.op.hypervisor, self.op.os_type, filled_hvp = cluster.SimpleFillHV(self.op.hypervisor, self.op.os_type,
...@@ -8581,6 +8585,7 @@ class LUInstanceCreate(LogicalUnit): ...@@ -8581,6 +8585,7 @@ class LUInstanceCreate(LogicalUnit):
hvparams=self.op.hvparams, hvparams=self.op.hvparams,
hypervisor=self.op.hypervisor, hypervisor=self.op.hypervisor,
osparams=self.op.osparams, osparams=self.op.osparams,
) )
if self.adopt_disks: if self.adopt_disks:
...@@ -965,6 +965,7 @@ class OpInstanceCreate(OpCode): ...@@ -965,6 +965,7 @@ class OpInstanceCreate(OpCode):
("src_node", None, ht.TMaybeString, "Source node for import"), ("src_node", None, ht.TMaybeString, "Source node for import"),
("src_path", None, ht.TMaybeString, "Source directory for import"), ("src_path", None, ht.TMaybeString, "Source directory for import"),
("start", True, ht.TBool, "Whether to start instance after creation"), ("start", True, ht.TBool, "Whether to start instance after creation"),
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Instance tags"),
] ]
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