def test_10_reboot_cpvm_forced(self): """Test force reboot CPVM """ list_cpvm_response = list_ssvms(self.apiclient, systemvmtype='consoleproxy', state='Running', zoneid=self.zone.id) self.assertEqual(isinstance(list_cpvm_response, list), True, "Check list response returns a valid list") cpvm_response = list_cpvm_response[0] hosts = list_hosts(self.apiclient, id=cpvm_response.hostid) self.assertEqual(isinstance(hosts, list), True, "Check list response returns a valid list") self.debug("Force rebooting CPVM: %s" % cpvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = cpvm_response.id cmd.forced = True self.apiclient.rebootSystemVm(cmd) cpvm_response = self.checkForRunningSystemVM(cpvm_response) self.debug("CPVM state: %s" % cpvm_response.state) self.assertEqual('Running', str(cpvm_response.state), "Check whether CPVM is running or not") # Wait for the agent to be up self.waitForSystemVMAgent(cpvm_response.name) # Call to verify cloud process is running self.test_04_cpvm_internals()
def test_07_reboot_ssvm(self): """Test reboot SSVM """ # Validate the following # 1. The SSVM should go to stop and return to Running state # 2. SSVM's public-ip and private-ip must remain the same # before and after reboot # 3. The cloud process should still be running within the SSVM list_ssvm_response = list_ssvms(self.apiclient, systemvmtype='secondarystoragevm', state='Running', zoneid=self.zone.id) self.assertEqual(isinstance(list_ssvm_response, list), True, "Check list response returns a valid list") ssvm_response = list_ssvm_response[0] hosts = list_hosts(self.apiclient, id=ssvm_response.hostid) self.assertEqual(isinstance(hosts, list), True, "Check list response returns a valid list") # Store the public & private IP values before reboot old_public_ip = ssvm_response.publicip old_private_ip = ssvm_response.privateip self.debug("Rebooting SSVM: %s" % ssvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = ssvm_response.id self.apiclient.rebootSystemVm(cmd) ssvm_response = self.checkForRunningSystemVM(ssvm_response) self.debug("SSVM State: %s" % ssvm_response.state) self.assertEqual('Running', str(ssvm_response.state), "Check whether CPVM is running or not") self.assertEqual( ssvm_response.publicip, old_public_ip, "Check Public IP after reboot with that of before reboot") # Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745 # Wait for the agent to be up self.waitForSystemVMAgent(ssvm_response.name) # Wait until NFS stores mounted before running the script time.sleep(30) # Call to verify cloud process is running self.test_03_ssvm_internals()
def test_09_reboot_ssvm_forced(self): """Test force reboot SSVM """ list_ssvm_response = list_ssvms( self.apiclient, systemvmtype='secondarystoragevm', state='Running', zoneid=self.zone.id ) self.assertEqual( isinstance(list_ssvm_response, list), True, "Check list response returns a valid list" ) ssvm_response = list_ssvm_response[0] hosts = list_hosts( self.apiclient, id=ssvm_response.hostid ) self.assertEqual( isinstance(hosts, list), True, "Check list response returns a valid list" ) self.debug("Force rebooting SSVM: %s" % ssvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = ssvm_response.id cmd.forced = True self.apiclient.rebootSystemVm(cmd) ssvm_response = self.checkForRunningSystemVM(ssvm_response) self.debug("SSVM State: %s" % ssvm_response.state) self.assertEqual( 'Running', str(ssvm_response.state), "Check whether SSVM is running or not" ) # Wait for the agent to be up self.waitForSystemVMAgent(ssvm_response.name) # Wait until NFS stores mounted before running the script time.sleep(90) # Call to verify cloud process is running self.test_03_ssvm_internals()
def test_08_reboot_cpvm(self): """Test reboot CPVM """ # Validate the following # 1. The CPVM should go to stop and return to Running state # 2. CPVM's public-ip and private-ip must remain # the same before and after reboot # 3. the cloud process should still be running within the CPVM list_cpvm_response = list_ssvms( self.apiclient, systemvmtype='consoleproxy', state='Running', zoneid=self.zone.id ) self.assertEqual( isinstance(list_cpvm_response, list), True, "Check list response returns a valid list" ) cpvm_response = list_cpvm_response[0] hosts = list_hosts( self.apiclient, id=cpvm_response.hostid ) self.assertEqual( isinstance(hosts, list), True, "Check list response returns a valid list" ) # Store the public & private IP values before reboot old_public_ip = cpvm_response.publicip old_private_ip = cpvm_response.privateip self.debug("Rebooting CPVM: %s" % cpvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = cpvm_response.id self.apiclient.rebootSystemVm(cmd) timeout = self.services["timeout"] while True: list_cpvm_response = list_ssvms( self.apiclient, id=cpvm_response.id ) if isinstance(list_cpvm_response, list): if list_cpvm_response[0].state == 'Running': break if timeout == 0: raise Exception("List CPVM call failed!") time.sleep(self.services["sleep"]) timeout = timeout - 1 cpvm_response = list_cpvm_response[0] self.debug("CPVM state: %s" % cpvm_response.state) self.assertEqual( 'Running', str(cpvm_response.state), "Check whether CPVM is running or not" ) self.assertEqual( cpvm_response.publicip, old_public_ip, "Check Public IP after reboot with that of before reboot" ) self.assertEqual( cpvm_response.privateip, old_private_ip, "Check Private IP after reboot with that of before reboot" ) # Wait for the agent to be up self.waitForSystemVMAgent(cpvm_response.name) # Wait for some time before running diagnostic scripts on SSVM # as it may take some time to start all service properly time.sleep(int(self.services["configurableData"]["systemVmDelay"])) # Call to verify cloud process is running self.test_04_cpvm_internals() return
def test_08_reboot_cpvm(self): """Test reboot CPVM """ # Validate the following # 1. The CPVM should go to stop and return to Running state # 2. CPVM's public-ip and private-ip must remain # the same before and after reboot # 3. the cloud process should still be running within the CPVM list_cpvm_response = list_ssvms(self.apiclient, systemvmtype='consoleproxy', state='Running', zoneid=self.zone.id) self.assertEqual(isinstance(list_cpvm_response, list), True, "Check list response returns a valid list") cpvm_response = list_cpvm_response[0] hosts = list_hosts(self.apiclient, id=cpvm_response.hostid) self.assertEqual(isinstance(hosts, list), True, "Check list response returns a valid list") # Store the public & private IP values before reboot old_public_ip = cpvm_response.publicip old_private_ip = cpvm_response.privateip self.debug("Rebooting CPVM: %s" % cpvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = cpvm_response.id self.apiclient.rebootSystemVm(cmd) timeout = self.services["timeout"] while True: list_cpvm_response = list_ssvms(self.apiclient, id=cpvm_response.id) if isinstance(list_cpvm_response, list): if list_cpvm_response[0].state == 'Running': break if timeout == 0: raise Exception("List CPVM call failed!") time.sleep(self.services["sleep"]) timeout = timeout - 1 cpvm_response = list_cpvm_response[0] self.debug("CPVM state: %s" % cpvm_response.state) self.assertEqual('Running', str(cpvm_response.state), "Check whether CPVM is running or not") self.assertEqual( cpvm_response.publicip, old_public_ip, "Check Public IP after reboot with that of before reboot") # Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745 # Wait for the agent to be up self.waitForSystemVMAgent(cpvm_response.name) # Wait for some time before running diagnostic scripts on SSVM # as it may take some time to start all service properly time.sleep(int(self.services["configurableData"]["systemVmDelay"])) # Call to verify cloud process is running self.test_04_cpvm_internals() return
def test_08_reboot_cpvm(self): """Test reboot CPVM """ # Validate the following # 1. The CPVM should go to stop and return to Running state # 2. CPVM's public-ip and private-ip must remain # the same before and after reboot # 3. the cloud process should still be running within the CPVM list_cpvm_response = list_ssvms( self.apiclient, systemvmtype='consoleproxy', state='Running', zoneid=self.zone.id ) self.assertEqual( isinstance(list_cpvm_response, list), True, "Check list response returns a valid list" ) cpvm_response = list_cpvm_response[0] hosts = list_hosts( self.apiclient, id=cpvm_response.hostid ) self.assertEqual( isinstance(hosts, list), True, "Check list response returns a valid list" ) # Store the public & private IP values before reboot old_public_ip = cpvm_response.publicip old_private_ip = cpvm_response.privateip self.debug("Rebooting CPVM: %s" % cpvm_response.id) cmd = rebootSystemVm.rebootSystemVmCmd() cmd.id = cpvm_response.id self.apiclient.rebootSystemVm(cmd) cpvm_response = self.checkForRunningSystemVM(cpvm_response) self.debug("CPVM state: %s" % cpvm_response.state) self.assertEqual( 'Running', str(cpvm_response.state), "Check whether CPVM is running or not" ) self.assertEqual( cpvm_response.publicip, old_public_ip, "Check Public IP after reboot with that of before reboot" ) # Private IP Address of System VMs are allowed to change after reboot - CLOUDSTACK-7745 # Wait for the agent to be up self.waitForSystemVMAgent(cpvm_response.name) # Call to verify cloud process is running self.test_04_cpvm_internals()