Github user sanju1010 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/742#discussion_r37950166 --- Diff: test/integration/component/maint/test_migrate_volume_timeout.py --- @@ -0,0 +1,286 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.lib.utils import (cleanup_resources, + validateList) +from marvin.lib.base import (Account, + VirtualMachine, + ServiceOffering, + Cluster, + StoragePool, + Volume, + DiskOffering, + Configurations, + Zone) +from marvin.lib.common import (get_zone, + get_domain, + get_template, + list_hosts, + find_storage_pool_type + ) +from marvin.codes import PASS +from marvin.sshClient import SshClient +from requests.exceptions import ConnectionError +import time + + +def restart_ms(self): + """Restart MS + #1-ssh into m/c running MS + #2-restart ms + #3-verify the response + #4-loop until you get list_zone api answer """ + sshClient = SshClient( + self.mgtSvrDetails["mgtSvrIp"], + 22, + self.mgtSvrDetails["user"], + self.mgtSvrDetails["passwd"] + ) + command = "service cloudstack-management restart" + ms_restart_response = sshClient.execute(command) + self.assertEqual( + validateList(ms_restart_response)[0], + PASS, + "Check the MS restart response") + self.assertEqual( + ms_restart_response[0], + 'Stopping cloudstack-management:[ OK ]', + "MS i not stopped" + ) + self.assertEqual( + ms_restart_response[1], + 'Starting cloudstack-management: [ OK ]', + "MS not started" + ) + timeout = self.services["timeout"] + while True: + time.sleep(self.services["sleep"]) + try: + list_response = Zone.list( + self.api_client + ) + if validateList(list_response)[0] == PASS: + break + except ConnectionError as e: + self.debug("list zone response is not available due to %s" % e) + + if timeout == 0: + raise Exception("Ms is not comming up !") + timeout = timeout - 1 + + +class testMigrateVolumeTimeout(cloudstackTestCase): + + @classmethod + def setUpClass(cls): + try: + cls._cleanup = [] + cls.testClient = super( + testMigrateVolumeTimeout, + cls).getClsTestClient() + cls.api_client = cls.testClient.getApiClient() + cls.services = cls.testClient.getParsedTestDataConfig() + # Get Domain, Zone, Template + cls.domain = get_domain(cls.api_client) + cls.zone = get_zone( + cls.api_client, + cls.testClient.getZoneForTests()) + cls.template = get_template( + cls.api_client, + cls.zone.id, + cls.services["ostype"] + ) + cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.services['mode'] = cls.zone.networktype + cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__ + cls.services["virtual_machine"]["zoneid"] = cls.zone.id + cls.services["virtual_machine"]["template"] = cls.template.id + cls.find_storage_pool = True + cls.clusterWithSufficientPool = None + if cls.hypervisor.lower() == 'lxc': + if not find_storage_pool_type( + cls.api_client, storagetype='rbd'): + cls.find_storage_pool = False + return + clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id) + + if not validateList(clusters)[0]: + + cls.debug( + "check list cluster response for zone id %s" % + cls.zone.id) + + for cluster in clusters: + cls.pool = StoragePool.list(cls.api_client, + clusterid=cluster.id, + keyword="NetworkFilesystem" + ) + + if not validateList(cls.pool)[0]: + + cls.debug( + "check list cluster response for zone id %s" % + cls.zone.id) + --- End diff -- Same comment here!!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---