Commit a16b7ca6 authored by Antoine Millet's avatar Antoine Millet

Reworked vm_define to handle other formats

parent d2fe2d66
......@@ -199,10 +199,11 @@ class Handler(HostHandler):
@libvirt_handler
def vm_define(self, data, format='xml'):
logger.debug('VM define')
if format != 'xml':
raise NotImplementedError('Format not supported')
return self.hypervisor.vm_define(data)
if format == 'xml':
return self.hypervisor.vm_define(data)
else:
raise NotImplementedError('Format not supported')
@libvirt_handler
def vm_undefine(self, name):
......
......@@ -210,7 +210,7 @@ class KVM(object):
:return: VM name created
"""
try:
return self.vir_con.defineXML(xml_desc).name()
return self.vir_con.defineXML(xml_desc).UUIDString()
except libvirt.libvirtError:
logger.exception('Error while creating domain')
# reraise exception for the cc-server
......
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