Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/integration/smoke/test_vm_life_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,37 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
if cls.hypervisor.lower() in ["kvm"]:
cls.ensure_all_hosts_are_up()
super(TestSecuredVmMigration, cls).tearDownClass()

@classmethod
def ensure_all_hosts_are_up(cls):
hosts = Host.list(
cls.apiclient,
zoneid=cls.zone.id,
type='Routing',
hypervisor='KVM'
)
for host in hosts:
if host.state != "Up":
SshClient(host.ipaddress, port=22, user=cls.hostConfig["username"], passwd=cls.hostConfig["password"]) \
.execute("service cloudstack-agent stop ; \
sleep 10 ; \
service cloudstack-agent start")
interval = 5
retries = 10
while retries > -1:
time.sleep(interval)
restarted_host = Host.list(
cls.apiclient,
hostid=host.id,
type='Routing'
)[0]
if restarted_host.state == "Up":
break
retries = retries - 1

def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
Expand Down