Skip to content

Commit

Permalink
qemu_guest_agent: update guest agent case
Browse files Browse the repository at this point in the history
Signed-off-by: Xiangchun Fu <xfu@redhat.com>
  • Loading branch information
xiangchunfu committed Aug 3, 2017
1 parent 19b5482 commit aa1eab5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions qemu/tests/qemu_guest_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import aexpect

from autotest.client.shared import error
from autotest.client import utils
from avocado.utils import path as avo_path
from avocado.utils import process
Expand Down Expand Up @@ -721,39 +720,40 @@ def _action_after_fsfreeze(self, *args):
raise error.TestFail("FS freeze failed, guest still can"
" write file")

@error.context_aware
def gagent_check_reset_reboot_shutdown(self, test, params, env):

"""
Execute "system_reset" and send "shutdown,reboot" command to guest agent after FS fsreezed
:param test: kvm test objecti
Execute "system_reset" and send "shutdown,reboot" command to guest agent after FS freezed
:param test: kvm test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
vm = env.get_vm(params["main_vm"])
if not self.vm.is_alive():
if not vm.is_alive():
test.skip("VM died,can't continue the test loop.")
self.gagent.fsfreeze()
self.gagent.verify_fsfreeze_status(self.gagent.FSFREEZE_STATUS_FROZEN)

try:
self.gagent.shutdown(self.gagent.SHUTDOWN_MODE_POWERDOWN)
except Exception:
self.test.fail("guest-shutdown command returned a wrong message")
test.fail("guest-shutdown command returned a wrong message")
else:
logging.info("guest FS is still freeze status")
self.gagent.verify_fsfreeze_status(self.gagent.FSFREEZE_STATUS_FROZEN)

try:
self.gagent.shutdown(self.gagent.SHUTDOWN_MODE_REBOOT)
except Exception:
self.test.fail("guest-reboot command returned a wrong message")
test.fail("guest-reboot command returned a wrong message")
else:
logging.info("guest FS is still freeze status")
self.gagent.verify_fsfreeze_status(self.gagent.FSFREEZE_STATUS_FROZEN)

if vm.monitor.cmd("system_reset"):
self.gagent.verify_fsfreeze_status(self.gagent.FSFREEZE_STATUS_THAWED)
else:
test.fail("system_reset command fail,please check qemu process")

@error.context_aware
def _action_before_fsthaw(self, *args):
Expand Down

0 comments on commit aa1eab5

Please sign in to comment.