Commit ddaf585d authored by Antoine Millet's avatar Antoine Millet

Implemented vm_boot_order handler

parent 3433cc7f
......@@ -119,6 +119,8 @@ class NodeConfigParser(object):
self.attach_script = config.get('node', 'attach_script', default_attach_script)
default_detach_script = 'hkvm-detach'
self.detach_script = config.get('node', 'detach_script', default_detach_script)
default_boot_order_script = 'hkvm-boot-order'
self.boot_order_script = config.get('node', 'boot_order_script', default_boot_order_script)
# RPC handler ACLs
acl_section_name = 'node_handler'
......
......@@ -304,6 +304,20 @@ class Handler(HostHandler):
logger.error(msg)
raise UndefinedDomain(msg)
@libvirt_handler
def vm_boot_order(self, name, order):
logger.debug('VM boot order %s -> %s', name, order)
if name in self.hypervisor.domains:
args_order = ['%s:%s' % tuple(x) for x in order]
rcode, output = execute(self.main, [self.main.config.boot_order_script,
name] + args_order)
if rcode != 0:
raise RuntimeError(output.strip().split('\n')[-1].strip())
else:
msg = 'Cannot change boot order of VM %s because it is not defined' % name
logger.error(msg)
raise UndefinedDomain(msg)
@libvirt_handler
def vm_stop(self, name):
logger.debug('VM stop %s', name)
......
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