コード例 #1
0
    def _disable_zone_and_delete_system_vms(self, virtual_router, verify_managed_system_vm_deleted=True):
        self.zone.update(self.apiClient, id=self.zone.id, allocationstate="Disabled")

        if virtual_router is not None:
            Router.destroy(self.apiClient, virtual_router.id)

            if verify_managed_system_vm_deleted:
                cs_root_volume = self._get_root_volume_for_system_vm(virtual_router.id, 'Expunged')

                self._verify_managed_system_vm_deleted(cs_root_volume.name)

        # list_ssvms lists the secondary storage VM and the console proxy VM
        system_vms = list_ssvms(self.apiClient)

        for system_vm in system_vms:
            destroy_ssvm_cmd = destroySystemVm.destroySystemVmCmd()

            destroy_ssvm_cmd.id = system_vm.id

            self.apiClient.destroySystemVm(destroy_ssvm_cmd)

            if verify_managed_system_vm_deleted:
                cs_root_volume = self._get_root_volume_for_system_vm(system_vm.id, 'Expunged')

                self._verify_managed_system_vm_deleted(cs_root_volume.name)
コード例 #2
0
ファイル: test_ssvm.py プロジェクト: phanthaihuan/cloudstack
    def test_09_destroy_ssvm(self):
        """Test destroy SSVM
        """

        # Validate the following
        # 1. SSVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the
        #    systemVM from what it was before
        # 3. new SSVM will have a public/private and link-local-ip
        # 4. cloud process within SSVM must be up and running

        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]

        old_name = ssvm_response.name

        self.debug("Destroying SSVM: %s" % ssvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = ssvm_response.id
        self.apiclient.destroySystemVm(cmd)

        ssvm_response = self.checkForRunningSystemVM(ssvm_response,
                                                     'secondarystoragevm')

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created SSVM
        self.assertNotEqual(ssvm_response.name, old_name,
                            "Check SSVM new name with name of destroyed SSVM")
        self.assertEqual(hasattr(ssvm_response, 'privateip'), True,
                         "Check whether SSVM has private IP field")

        self.assertEqual(hasattr(ssvm_response, 'linklocalip'), True,
                         "Check whether SSVM has link local IP field")

        self.assertEqual(hasattr(ssvm_response, 'publicip'), True,
                         "Check whether SSVM has public IP field")

        # Wait for the agent to be up
        self.waitForSystemVMAgent(ssvm_response.name)

        # Call to verify cloud process is running
        self.test_03_ssvm_internals()
コード例 #3
0
ファイル: test_ssvm.py プロジェクト: klurnl/cloudstack
    def test_09_destroy_ssvm(self):
        """Test destroy SSVM
        """

        # Validate the following
        # 1. SSVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the
        #    systemVM from what it was before
        # 3. new SSVM will have a public/private and link-local-ip
        # 4. cloud process within SSVM must be up and running

        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]

        old_name = ssvm_response.name

        self.debug("Destroying SSVM: %s" % ssvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = ssvm_response.id
        self.apiclient.destroySystemVm(cmd)

        timeout = self.services["timeout"]
        while True:
            list_ssvm_response = list_ssvms(
                self.apiclient,
                zoneid=self.zone.id,
                systemvmtype='secondarystoragevm'
            )
            if isinstance(list_ssvm_response, list):
                if list_ssvm_response[0].state == 'Running':
                    break
            if timeout == 0:
                raise Exception("List SSVM call failed!")

            time.sleep(self.services["sleep"])
            timeout = timeout - 1

        ssvm_response = list_ssvm_response[0]

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created SSVM
        self.assertNotEqual(
            ssvm_response.name,
            old_name,
            "Check SSVM new name with name of destroyed SSVM"
        )
        self.assertEqual(
            hasattr(ssvm_response, 'privateip'),
            True,
            "Check whether SSVM has private IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'linklocalip'),
            True,
            "Check whether SSVM has link local IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'publicip'),
            True,
            "Check whether SSVM has public IP field"
        )

        # Wait for the agent to be up
        self.waitForSystemVMAgent(ssvm_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_03_ssvm_internals()
        return
コード例 #4
0
    def test_10_destroy_cpvm(self):
        """Test destroy CPVM
        """

        # Validate the following
        # 1. CPVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the systemVM from
        #    what it was before
        # 3. new CPVM will have a public/private and link-local-ip
        # 4. cloud process within CPVM must be up and running

        list_cpvm_response = list_ssvms(self.apiclient,
                                        systemvmtype='consoleproxy',
                                        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]

        old_name = cpvm_response.name

        self.debug("Destroying CPVM: %s" % cpvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = cpvm_response.id
        self.apiclient.destroySystemVm(cmd)

        timeout = self.services["timeout"]
        while True:
            list_cpvm_response = list_ssvms(self.apiclient,
                                            systemvmtype='consoleproxy',
                                            zoneid=self.zone.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]

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created CPVM
        self.assertNotEqual(cpvm_response.name, old_name,
                            "Check SSVM new name with name of destroyed CPVM")
        self.assertEqual(hasattr(cpvm_response, 'privateip'), True,
                         "Check whether CPVM has private IP field")

        self.assertEqual(hasattr(cpvm_response, 'linklocalip'), True,
                         "Check whether CPVM has link local IP field")

        self.assertEqual(hasattr(cpvm_response, 'publicip'), True,
                         "Check whether CPVM has public IP field")

        # 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
コード例 #5
0
    def test_09_destroy_ssvm(self):
        """Test destroy SSVM
        """

        # Validate the following
        # 1. SSVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the
        #    systemVM from what it was before
        # 3. new SSVM will have a public/private and link-local-ip
        # 4. cloud process within SSVM must be up and running

        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]

        old_name = ssvm_response.name

        self.logger.debug("Destroying SSVM: %s" % ssvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = ssvm_response.id
        self.apiclient.destroySystemVm(cmd)

        timeout = self.services["timeout"]
        while True:
            list_ssvm_response = list_ssvms(self.apiclient,
                                            zoneid=self.zone.id,
                                            systemvmtype='secondarystoragevm')
            if isinstance(list_ssvm_response, list):
                if list_ssvm_response[0].state == 'Running':
                    break
            if timeout == 0:
                self.logger.debug(
                    "Warning: List SSVM didn't return systemvms in Running state. This is a known issue, ignoring it for now!"
                )
                return

            time.sleep(self.services["sleep"])
            timeout = timeout - 1

        ssvm_response = list_ssvm_response[0]

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created SSVM
        self.assertNotEqual(ssvm_response.name, old_name,
                            "Check SSVM new name with name of destroyed SSVM")
        self.assertEqual(hasattr(ssvm_response, 'privateip'), True,
                         "Check whether SSVM has private IP field")

        self.assertEqual(hasattr(ssvm_response, 'linklocalip'), True,
                         "Check whether SSVM has link local IP field")

        self.assertEqual(hasattr(ssvm_response, 'publicip'), True,
                         "Check whether SSVM has public IP field")

        # Wait for the agent to be up
        self.wait_for_system_vm_agent(ssvm_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_03_ssvm_internals()
        return
コード例 #6
0
ファイル: test_ssvm.py プロジェクト: PCextreme/cloudstack
    def test_09_destroy_ssvm(self):
        """Test destroy SSVM
        """

        # Validate the following
        # 1. SSVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the
        #    systemVM from what it was before
        # 3. new SSVM will have a public/private and link-local-ip
        # 4. cloud process within SSVM must be up and running

        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]

        old_name = ssvm_response.name

        self.debug("Destroying SSVM: %s" % ssvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = ssvm_response.id
        self.apiclient.destroySystemVm(cmd)

        ssvm_response = self.checkForRunningSystemVM(ssvm_response, 'secondarystoragevm')

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created SSVM
        self.assertNotEqual(
            ssvm_response.name,
            old_name,
            "Check SSVM new name with name of destroyed SSVM"
        )
        self.assertEqual(
            hasattr(ssvm_response, 'privateip'),
            True,
            "Check whether SSVM has private IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'linklocalip'),
            True,
            "Check whether SSVM has link local IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'publicip'),
            True,
            "Check whether SSVM has public IP field"
        )

        # Wait for the agent to be up
        self.waitForSystemVMAgent(ssvm_response.name)

        # Call to verify cloud process is running
        self.test_03_ssvm_internals()
コード例 #7
0
    def test_03_destroy_ssvm(self):
        """Test destroy SSVM
        """

        # Validate the following
        # 1. SSVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the
        #    systemVM from what it was before
        # 3. new SSVM will have a public/private and link-local-ip
        # 4. cloud process within SSVM must be up and running

        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]

        old_name = ssvm_response.name

        self.logger.debug("Destroying SSVM: %s" % ssvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = ssvm_response.id
        self.apiclient.destroySystemVm(cmd)

        timeout = self.services["timeout"]
        while True:
            list_ssvm_response = list_ssvms(
                self.apiclient,
                zoneid=self.zone.id,
                systemvmtype='secondarystoragevm'
            )
            if isinstance(list_ssvm_response, list):
                if list_ssvm_response[0].state == 'Running':
                    break
            if timeout == 0:
                self.logger.debug(
                    "Warning: List SSVM didn't return systemvms in Running state. This is a known issue, ignoring it for now!")
                return

            time.sleep(self.services["sleep"])
            timeout = timeout - 1

        ssvm_response = list_ssvm_response[0]

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created SSVM
        self.assertNotEqual(
            ssvm_response.name,
            old_name,
            "Check SSVM new name with name of destroyed SSVM"
        )
        self.assertEqual(
            hasattr(ssvm_response, 'privateip'),
            True,
            "Check whether SSVM has private IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'linklocalip'),
            True,
            "Check whether SSVM has link local IP field"
        )

        self.assertEqual(
            hasattr(ssvm_response, 'publicip'),
            True,
            "Check whether SSVM has public IP field"
        )

        # Wait for the agent to be up
        self.wait_for_system_vm_agent(ssvm_response.name)

        return
コード例 #8
0
    def test_04_destroy_cpvm(self):
        """Test destroy CPVM
        """

        # Validate the following
        # 1. CPVM should be completely destroyed and a new one will spin up
        # 2. listSystemVMs will show a different name for the systemVM from
        #    what it was before
        # 3. new CPVM will have a public/private and link-local-ip
        # 4. cloud process within CPVM must be up and running

        list_cpvm_response = list_ssvms(self.apiclient,
                                        systemvmtype='consoleproxy',
                                        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]

        old_name = cpvm_response.name

        self.logger.debug("Destroying CPVM: %s" % cpvm_response.id)
        cmd = destroySystemVm.destroySystemVmCmd()
        cmd.id = cpvm_response.id
        self.apiclient.destroySystemVm(cmd)

        timeout = self.services["timeout"]
        while True:
            list_cpvm_response = list_ssvms(self.apiclient,
                                            systemvmtype='consoleproxy',
                                            zoneid=self.zone.id)
            if isinstance(list_cpvm_response, list):
                if list_cpvm_response[0].state == 'Running':
                    break
            if timeout == 0:
                self.logger.debug(
                    "Warning: List CPVM didn't return systemvms in Running state. This is a known issue, ignoring it for now!"
                )
                return

            time.sleep(self.services["sleep"])
            timeout = timeout - 1

        cpvm_response = list_cpvm_response[0]

        # Verify Name, Public IP, Private IP and Link local IP
        # for newly created CPVM
        self.assertNotEqual(cpvm_response.name, old_name,
                            "Check SSVM new name with name of destroyed CPVM")
        self.assertEqual(hasattr(cpvm_response, 'privateip'), True,
                         "Check whether CPVM has private IP field")

        self.assertEqual(hasattr(cpvm_response, 'linklocalip'), True,
                         "Check whether CPVM has link local IP field")

        self.assertEqual(hasattr(cpvm_response, 'publicip'), True,
                         "Check whether CPVM has public IP field")

        # Wait for the agent to be up
        self.wait_for_system_vm_agent(cpvm_response.name)

        return