From 365ded3d2089fff98f4d8562fb277112b242645f Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Tue, 16 Jan 2018 11:03:17 +0000 Subject: Improve "Libvirt.virsh_create_vm" function Read the command exit code and raise an exception in case the VM boot process went wrong. JIRA: YARDSTICK-941 Change-Id: Ibabaae8983213a33799ad00fa4d9541bbabea857 Signed-off-by: Rodolfo Alonso Hernandez --- yardstick/benchmark/contexts/standalone/model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'yardstick/benchmark/contexts/standalone/model.py') diff --git a/yardstick/benchmark/contexts/standalone/model.py b/yardstick/benchmark/contexts/standalone/model.py index 7eab1c9c8..ffa37fd37 100644 --- a/yardstick/benchmark/contexts/standalone/model.py +++ b/yardstick/benchmark/contexts/standalone/model.py @@ -106,8 +106,10 @@ class Libvirt(object): @staticmethod def virsh_create_vm(connection, cfg): - err = connection.execute("virsh create %s" % cfg)[0] - LOG.info("VM create status: %s", err) + LOG.info('VM create, XML config: %s', cfg) + status, _, error = connection.execute('virsh create %s' % cfg) + if status: + raise exceptions.LibvirtCreateError(error=error) @staticmethod def virsh_destroy_vm(vm_name, connection): -- cgit 1.2.3-korg