Commit aac0352d authored by Iustin Pop's avatar Iustin Pop

burnin: skip migration based on hypervisor support

The patch adds selection of hypervisor in burnin (on multi-hypervisor
clusters, we always used the default) and optional hypervisor
parameters, and skips migration if the hypervisor doesn't support it.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent d271c6fd
...@@ -36,6 +36,7 @@ from ganeti import constants ...@@ -36,6 +36,7 @@ from ganeti import constants
from ganeti import cli from ganeti import cli
from ganeti import errors from ganeti import errors
from ganeti import utils from ganeti import utils
from ganeti import hypervisor
from ganeti.confd import client as confd_client from ganeti.confd import client as confd_client
...@@ -111,6 +112,7 @@ OPTIONS = [ ...@@ -111,6 +112,7 @@ OPTIONS = [
help="OS to use during burnin", help="OS to use during burnin",
metavar="<OS>", metavar="<OS>",
completion_suggest=cli.OPT_COMPL_ONE_OS), completion_suggest=cli.OPT_COMPL_ONE_OS),
cli.HYPERVISOR_OPT,
cli.cli_option("--disk-size", dest="disk_size", cli.cli_option("--disk-size", dest="disk_size",
help="Disk size (determines disk count)", help="Disk size (determines disk count)",
default="128m", type="string", metavar="<size,size,...>", default="128m", type="string", metavar="<size,size,...>",
...@@ -473,7 +475,11 @@ class Burner(object): ...@@ -473,7 +475,11 @@ class Burner(object):
constants.BE_MEMORY: options.mem_size, constants.BE_MEMORY: options.mem_size,
constants.BE_VCPUS: 1, constants.BE_VCPUS: 1,
} }
self.hypervisor = None
self.hvp = {} self.hvp = {}
if options.hypervisor:
self.hypervisor, self.hvp = options.hypervisor
socket.setdefaulttimeout(options.net_timeout) socket.setdefaulttimeout(options.net_timeout)
...@@ -515,6 +521,9 @@ class Burner(object): ...@@ -515,6 +521,9 @@ class Burner(object):
default_nic_params = self.cluster_info["nicparams"][constants.PP_DEFAULT] default_nic_params = self.cluster_info["nicparams"][constants.PP_DEFAULT]
self.cluster_default_nicparams = default_nic_params self.cluster_default_nicparams = default_nic_params
if self.hypervisor is None:
self.hypervisor = self.cluster_info["default_hypervisor"]
self.hv_class = hypervisor.GetHypervisorClass(self.hypervisor)
@_DoCheckInstances @_DoCheckInstances
@_DoBatch(False) @_DoBatch(False)
...@@ -559,6 +568,7 @@ class Burner(object): ...@@ -559,6 +568,7 @@ class Burner(object):
iallocator=self.opts.iallocator, iallocator=self.opts.iallocator,
beparams=self.bep, beparams=self.bep,
hvparams=self.hvp, hvparams=self.hvp,
hypervisor=self.hypervisor,
) )
remove_instance = lambda name: lambda: self.to_rem.append(name) remove_instance = lambda name: lambda: self.to_rem.append(name)
self.ExecOrQueue(instance, [op], post_process=remove_instance(instance)) self.ExecOrQueue(instance, [op], post_process=remove_instance(instance))
...@@ -978,8 +988,14 @@ class Burner(object): ...@@ -978,8 +988,14 @@ class Burner(object):
if opts.do_failover and opts.disk_template in constants.DTS_NET_MIRROR: if opts.do_failover and opts.disk_template in constants.DTS_NET_MIRROR:
self.BurnFailover() self.BurnFailover()
if opts.do_migrate and opts.disk_template == constants.DT_DRBD8: if opts.do_migrate:
self.BurnMigrate() if opts.disk_template != constants.DT_DRBD8:
Log("Skipping migration (disk template not DRBD8)")
elif not self.hv_class.CAN_MIGRATE:
Log("Skipping migration (hypervisor %s does not support it)",
self.hypervisor)
else:
self.BurnMigrate()
if (opts.do_move and len(self.nodes) > 1 and if (opts.do_move and len(self.nodes) > 1 and
opts.disk_template in [constants.DT_PLAIN, constants.DT_FILE]): opts.disk_template in [constants.DT_PLAIN, constants.DT_FILE]):
......
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