Commit 51958d2a authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

QA for KVM instance shutdown

Add QA for instance shutdown for KVM.
Signed-off-by: default avatarJose A. Lopes <>
Reviewed-by: default avatarMichele Tartara <>
parent 2a60db50
......@@ -25,6 +25,7 @@
import os
import re
import time
from ganeti import utils
from ganeti import constants
......@@ -1097,7 +1098,7 @@ def TestInstanceCreationRestrictedByDiskTemplates():
def _TestInstanceUserDown(instance, master, hv_shutdown_fn):
# Shutdown instance in Xen and bring instance status to 'USER_down'
# Shutdown instance and bring instance status to 'USER_down'
cmd = ["gnt-instance", "list", "--no-headers", "-o", "status",]
......@@ -1150,19 +1151,27 @@ def _TestInstanceUserDown(instance, master, hv_shutdown_fn):
def _TestInstanceUserDownXen(instance, master):
primary = _GetInstanceField(, "pnode")
fn = lambda: AssertCommand(["xm", "shutdown", "-w",],
fail=False, node=primary)
_TestInstanceUserDown(instance, master, fn)
# FIXME: User shutdown is not implemented for KVM yet
# @InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
# def _TestInstanceUserDownKvm(instance, master):
# fn = lambda: hv_kvm.KVMHypervisor._StopInstance(None, True,
# _TestInstanceUserDown(instance, master, fn)
def _TestInstanceUserDownKvm(_1, _2):
def _TestInstanceUserDownKvm(instance, master):
def _StopKVMInstance():
AssertCommand("pkill -f \"kvm -name %s\"" %, node=primary)
AssertCommand(["gnt-instance", "modify", "-H", "user_shutdown=true",])
# The instance needs to reboot not because the 'user_shutdown'
# parameter was modified but because the KVM daemon need to be
# started, given that the instance was first created with user
# shutdown disabled.
AssertCommand(["gnt-instance", "reboot",])
primary = _GetInstanceField(, "pnode")
_TestInstanceUserDown(instance, master, _StopKVMInstance)
def TestInstanceUserDown(instance, master):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment