diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-01-16 11:03:17 +0000 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-03-21 09:11:53 +0000 |
commit | 365ded3d2089fff98f4d8562fb277112b242645f (patch) | |
tree | 1bd32f1e71010a709f495f1d638291b9799ecca5 /yardstick/benchmark/contexts/standalone/model.py | |
parent | 49af409b0c43ec3d3f0479c21cef172e29e1cdfd (diff) |
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 <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/benchmark/contexts/standalone/model.py')
-rw-r--r-- | yardstick/benchmark/contexts/standalone/model.py | 6 |
1 files changed, 4 insertions, 2 deletions
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): |