[Kimchi-devel] [PATCH] Issue #289: catch the libvirtError when failed to start a vm
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Mon Feb 24 20:18:58 UTC 2014
I just noticed that the bug number is not #289 actually
On 02/24/2014 02:52 PM, Rodrigo Trujillo wrote:
> Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>
> On 02/24/2014 07:15 AM, shaohef at linux.vnet.ibm.com wrote:
>> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>>
>> There are several reasons when failed to start domain.
>> we should catch the libvirtError.
>>
>> issue:
>> https://github.com/kimchi-project/kimchi/issues/289
>>
>> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>> ---
>> src/kimchi/i18n.py | 1 +
>> src/kimchi/model/vms.py | 6 +++++-
>> 2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
>> index dfc1b2b..fc4b1ff 100644
>> --- a/src/kimchi/i18n.py
>> +++ b/src/kimchi/i18n.py
>> @@ -76,6 +76,7 @@ messages = {
>> "KCHVM0016E": _("Specify a template to create a virtual machine
>> from"),
>> "KCHVM0017E": _("Volume list (LUNs names) not given."),
>> "KCHVM0018E": _("Virtual machine volumes must be a list of
>> strings with distinct LUNs names."),
>> + "KCHVM0019E": _("Unable to start virtual machine %(name)s.
>> Details: %(err)s"),
>>
>> "KCHVMIF0001E": _("Interface %(iface)s does not exist in
>> virtual machine %(name)s"),
>> "KCHVMIF0002E": _("Network %(network)s specified for virtual
>> machine %(name)s does not exist"),
>> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
>> index 9da6688..b6a42e6 100644
>> --- a/src/kimchi/model/vms.py
>> +++ b/src/kimchi/model/vms.py
>> @@ -376,7 +376,11 @@ class VMModel(object):
>> run_setfacl_set_attr(iso)
>>
>> dom = self.get_vm(name, self.conn)
>> - dom.create()
>> + try:
>> + dom.create()
>> + except libvirt.libvirtError as e:
>> + raise OperationFailed("KCHVM0019E",
>> + {'name': name, 'err':
>> e.get_error_message()})
>>
>> def stop(self, name):
>> if self._vm_exists(name):
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
More information about the Kimchi-devel
mailing list