Skip to content

Commit

Permalink
Merge pull request #799 from Zhengtong/fix_1380672
Browse files Browse the repository at this point in the history
Ensure libvirtd service is running before run guestfs tools
  • Loading branch information
will-Do authored Dec 9, 2016
2 parents 75badf1 + 249a7b5 commit 3dfeff6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def preprocess(test, params, env):
kernel_extra_params_add = params.get("kernel_extra_params_add", "")
kernel_extra_params_remove = params.get("kernel_extra_params_remove", "")
if params.get("disable_pci_msi"):
disable_pci_msi = params.get("disable-pci_msi")
disable_pci_msi = params.get("disable_pci_msi")
if disable_pci_msi == "yes":
if "pci=" in kernel_extra_params_add:
kernel_extra_params_add = re.sub("pci=.*?\s+", "pci=nomsi ",
Expand Down
7 changes: 7 additions & 0 deletions virttest/utils_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from avocado.core import exceptions
from avocado.utils import process
from avocado.utils.service import SpecificServiceManager

from . import error_context

Expand Down Expand Up @@ -422,6 +423,12 @@ def __init__(self, disk):
self.g = guestfs.GuestFS()
self.disk = disk
self.g.add_drive(disk)
libvirtd = SpecificServiceManager("libvirtd")
libvirtd_status = libvirtd.status()
if libvirtd_status is None:
raise exceptions.TestError('libvirtd: service not found')
if (not libvirtd_status) and (not libvirtd.start()):
raise exceptions.TestError('libvirtd: failed to start')
logging.debug("Launch the disk %s, wait..." % self.disk)
self.g.launch()

Expand Down

0 comments on commit 3dfeff6

Please sign in to comment.