コード例 #1
0
    def test_resize_down_an_instance_booted_from_volume(self):
        """This test checks that nova allows
            resize down an instance booted from volume
            Steps:
            1. Create bootable volume
            2. Boot instance from newly created volume
            3. Resize instance from m1.small to m1.tiny
        """

        # 1. Create bootable volume
        image_id = [image.id for image in self.nova.images.list() if
                    image.name == 'TestVM'][0]

        volume = common_functions.create_volume(self.cinder, image_id,
                                                timeout=60)
        self.volumes.append(volume)

        # 2. Create instance from newly created volume, associate floating_ip
        name = 'TestVM_543355_instance_to_resize'
        networks = self.neutron.list_networks()['networks']
        net = [net['id'] for net in networks if not net['router:external']][0]
        flavor_list = {f.name: f.id for f in self.nova.flavors.list()}
        initial_flavor = flavor_list['m1.small']
        resize_flavor = flavor_list['m1.tiny']
        bdm = {'vda': volume.id}
        instance = common_functions.create_instance(self.nova,
                                                    name, initial_flavor, net,
                                                    [self.sec_group.name],
                                                    block_device_mapping=bdm,
                                                    inst_list=self.instances)
        self.instances.append(instance.id)

        # Assert for attached volumes
        attached_volumes = self.nova.servers.get(instance).to_dict()[
            'os-extended-volumes:volumes_attached']
        self.assertIn({'id': volume.id}, attached_volumes)

        # Assert to flavor size
        self.assertEqual(self.nova.servers.get(instance).flavor['id'],
                         initial_flavor,
                         "Unexpected instance flavor before resize")

        floating_ip = self.nova.floating_ips.create()
        self.floating_ips.append(floating_ip.ip)
        instance.add_floating_ip(floating_ip.ip)

        # 3. Resize from m1.small to m1.tiny
        self.nova.servers.resize(instance, resize_flavor)
        common_functions.check_inst_status(self.nova, instance.id,
                                           'VERIFY_RESIZE', 60)
        self.nova.servers.confirm_resize(instance)
        common_functions.check_inst_status(self.nova, instance.id,
                                           'ACTIVE', 60)
        self.assertEqual(self.nova.servers.get(instance).flavor['id'],
                         resize_flavor,
                         "Unexpected instance flavor after resize")

        # Check that instance is reachable
        ping = common_functions.ping_command(floating_ip.ip)
        self.assertTrue(ping, "Instance after resize is not reachable")
    def test_live_migration_for_windows_instance(self):
        """This test checks that instance with Windows Image could be
        migrated without any issues

        Steps:
        1. Upload Windows 2012 Server image to Glance
        2. Create VM with this Windows image
        3. Assign floating IP to this VM
        4. Ping this VM and verify that we can ping it
        5. Migrate this VM to another compute node
        6. Verify that live Migration works fine for Windows VMs
        and we can successfully ping this VM
        7. Reboot VM and verify that
        we can successfully ping this VM after reboot.

        :return: Nothing
        """
        # 1. 2. 3. -> Into setUp function
        # 4. Ping this VM and verify that we can ping it
        hypervisor_hostname_attribute = "OS-EXT-SRV-ATTR:hypervisor_hostname"
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
        hypervisors = {h.hypervisor_hostname: h for h in self.nova.hypervisors.list()}
        old_hyper = getattr(self.instance, hypervisor_hostname_attribute)
        logger.info("Old hypervisor is: {}".format(old_hyper))
        new_hyper = [h for h in hypervisors.keys() if h != old_hyper][0]
        logger.info("New hypervisor is: {}".format(new_hyper))
        # Execute the live migrate
        self.instance.live_migrate(new_hyper, block_migration=True)

        self.instance = self.nova.servers.get(self.instance.id)
        end_time = time.time() + 60 * self.hypervisor_timeout
        debug_string = "Waiting for changes."
        while getattr(self.instance, hypervisor_hostname_attribute) != new_hyper:
            if time.time() > end_time:
                # it can fail because of this issue
                # https://bugs.launchpad.net/mos/+bug/1544564
                logger.info(debug_string)
                raise AssertionError("Hypervisor is not changed after live migration")
            time.sleep(30)
            debug_string += "."
            self.instance = self.nova.servers.get(self.instance.id)
        logger.info(debug_string)
        self.assertEqual(self.instance.status, "ACTIVE")
        # Ping the Virtual Machine
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")

        # Reboot the VM and make sure that we can ping it
        self.instance.reboot(reboot_type="HARD")
        instance_status = common_functions.check_inst_status(self.nova, self.instance.id, "ACTIVE")
        self.instance = [s for s in self.nova.servers.list() if s.id == self.instance.id][0]
        if not instance_status:
            raise AssertionError("Instance status is '{0}' instead of 'ACTIVE".format(self.instance.status))

        self.wait_instance_to_boot()

        # Waiting for up-and-run of Virtual Machine after reboot
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
コード例 #3
0
    def test_nova_massively_spawn_v_ms_with_boot_local(self):
        """This test case creates a lot of VMs with boot local, checks it
        state and availability and then deletes it.

        Steps:
            1. Boot 10-100 instances from image.
            2. Check that list of instances contains created VMs.
            3. Check state of created instances
            4. Add the floating ips to the instances
            5. Ping the instances by the floating ips
        """
        initial_instances = self.nova.servers.list()
        primary_name = "testVM_543356"
        count = 10
        image_dict = {im.name: im.id for im in self.nova.images.list()}
        image_id = image_dict["TestVM"]
        flavor_dict = {f.name: f.id for f in self.nova.flavors.list()}
        flavor_id = flavor_dict["m1.micro"]
        networks = self.neutron.list_networks()["networks"]
        net_dict = {net["name"]: net["id"] for net in networks}
        net_internal_id = net_dict["admin_internal_net"]

        self.floating_ips = [self.nova.floating_ips.create()
                             for _ in xrange(count)]
        fip_new = [fip_info.ip for fip_info in self.floating_ips]
        fip_all = [fip_info.ip for fip_info in self.nova.floating_ips.list()]
        for fip in fip_new:
            self.assertIn(fip, fip_all)

        self.nova.servers.create(primary_name, image_id, flavor_id,
                                 max_count=count,
                                 security_groups=[self.sec_group.name],
                                 nics=[{"net-id": net_internal_id}])
        start_time = time()
        timeout = 5
        while len(self.nova.servers.list()) < len(initial_instances) + count \
                and time() < start_time + timeout * 60:
            sleep(5)

        instances = [inst for inst in self.nova.servers.list()
                     if inst not in initial_instances]
        self.instances = [inst.id for inst in instances]
        for inst_id in self.instances:
            self.assertTrue(common_functions.check_inst_status(self.nova,
                                                               inst_id,
                                                               'ACTIVE'))
        fip_dict = {}
        for inst in instances:
            fip = fip_new.pop()
            inst.add_floating_ip(fip)
            fip_dict[inst.id] = fip

        for inst_id in self.instances:
            self.assertTrue(common_functions.check_ip(
                self.nova, inst_id, fip_dict[inst_id]))

        for inst_id in self.instances:
            ping = common_functions.ping_command(fip_dict[inst_id], i=8)
            self.assertTrue(ping,
                            "Instance {} is not reachable".format(inst_id))
コード例 #4
0
    def test_suspend_and_resume_instance_with_windows_image(self):
        """This test checks that instance with Windows image can be suspended
        and resumed

        Steps:
        1. Upload Windows 2012 Server image to Glance
        2. Create VM with this Windows image
        3. Assign floating IP to this VM
        4. Ping this VM and verify that we can ping it
        5. Suspend VM
        6. Verify that we can't ping it
        7. Resume and verify that we can ping it again.
        8. Reboot VM
        9. Verify that we can ping this VM after reboot.
        :return: Nothing
        """
        # Initial check
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
        # Suspend state check
        self.instance.suspend()
        # Make sure that the VM in 'Suspended' state
        ping_result = common_functions.ping_command(
            self.floating_ip.ip,
            should_be_available=False
        )
        self.assertTrue(ping_result, "Instance is reachable")
        # Resume state check
        self.instance.resume()
        # Make sure that the VM in 'Resume' state
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")

        # Reboot the VM and make sure that we can ping it
        self.instance.reboot(reboot_type='HARD')
        instance_status = common_functions.check_inst_status(
            self.nova,
            self.instance.id,
            'ACTIVE')
        self.instance = [s for s in self.nova.servers.list()
                         if s.id == self.instance.id][0]
        if not instance_status:
            raise AssertionError(
                "Instance status is '{0}' instead of 'ACTIVE".format(
                    self.instance.status))

        self.wait_instance_to_boot()

        # Waiting for up-and-run of Virtual Machine after reboot
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
コード例 #5
0
    def test_pause_and_unpause_instance_with_windows_image(self, instance,
                                                           floating_ip):
        """This test checks that instance with Windows image could be paused
        and unpaused

        Steps:
        1. Upload Windows 2012 Server image to Glance
        2. Create VM with this Windows image
        3. Assign floating IP to this VM
        4. Ping this VM and verify that we can ping it
        5. Pause this VM
        6. Verify that we can't ping it
        7. Unpause it and verify that we can ping it again
        8. Reboot VM
        9. Verify that we can ping this VM after reboot.
        :return: Nothing
        """
        # Initial check
        ping_result = common.ping_command(floating_ip.ip)
        assert ping_result, "Instance is not reachable"
        # Paused state check
        instance.pause()
        # Make sure that the VM in 'Paused' state
        ping_result = common.ping_command(floating_ip.ip,
                                          should_be_available=False)
        assert ping_result, "Instance is reachable"
        # Unpaused state check
        instance.unpause()
        # Make sure that the VM in 'Unpaused' state
        ping_result = common.ping_command(floating_ip.ip)
        assert ping_result, "Instance is not reachable"

        # Reboot the VM and make sure that we can ping it
        instance.reboot(reboot_type='HARD')
        instance_status = common.check_inst_status(
            self.os_conn.nova,
            instance.id,
            'ACTIVE')
        instance = self.os_conn.nova.servers.get(instance.id)
        if not instance_status:
            raise AssertionError(
                "Instance status is '{0}' instead of 'ACTIVE".format(
                    instance.status))

        self.wait_to_boot(instance)

        # Waiting for up-and-run of Virtual Machine after reboot
        ping_result = common.ping_command(floating_ip.ip)
        assert ping_result, "Instance is not reachable"
コード例 #6
0
    def test_542826_PauseAndUnpauseInstanceWithWindowsImage(self):
        """ This test checks that instance with Windows image could be paused
        and unpaused

        Steps:
        1. Upload Windows 2012 Server image to Glance
        2. Create VM with this Windows image
        3. Assign floating IP to this VM
        4. Ping this VM and verify that we can ping it
        5. Pause this VM
        6. Verify that we can't ping it
        7. Unpause it and verify that we can ping it again
        8. Reboot VM
        9. Verify that we can ping this VM after reboot.
        :return: Nothing
        """
        # Initial check
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
        # Paused state check
        self.node_to_boot.pause()
        # Make sure that the VM in 'Paused' state
        ping_result = common_functions.ping_command(
                self.floating_ip.ip,
                should_be_available=False
        )
        self.assertTrue(ping_result, "Instance is reachable")
        # Unpaused state check
        self.node_to_boot.unpause()
        # Make sure that the VM in 'Unpaused' state
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
        # Reboot the VM and make sure that we can ping it
        self.node_to_boot.reboot(reboot_type='HARD')
        instance_status = common_functions.check_inst_status(
                self.nova,
                self.node_to_boot.id,
                'ACTIVE')
        self.node_to_boot = [s for s in self.nova.servers.list()
                             if s.id == self.node_to_boot.id][0]
        if not instance_status:
            raise AssertionError(
                    "Instance status is '{0}' instead of 'ACTIVE".format(
                        self.node_to_boot.status))

        # Waiting for up-and-run of Virtual Machine after reboot
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
コード例 #7
0
    def test_nova_massively_spawn_v_ms_boot_from_cinder(self):
        """This test case creates a lot of VMs which boot from Cinder, checks
        it state and availability and then deletes it.

        Steps:
            1. Create 10-100 volumes.
            2. Boot 10-100 instances from volumes.
            3. Check that list of instances contains created VMs.
            4. Check state of created instances
            5. Add the floating ips to the instances
            6. Ping the instances by the floating ips
        """
        initial_instances = self.nova.servers.list()
        count = 10
        primary_name = "testVM_543357"
        image_dict = {im.name: im.id for im in self.nova.images.list()}
        image_id = image_dict["TestVM"]
        flavor_dict = {f.name: f.id for f in self.nova.flavors.list()}
        flavor_id = flavor_dict["m1.tiny"]
        net_internal_id = self.get_admin_int_net_id()

        initial_volumes = self.cinder.volumes.list()
        for i in range(count):
            common_functions.create_volume(self.cinder, image_id, size=1)
        self.volumes = [volume for volume in self.cinder.volumes.list()
                        if volume not in initial_volumes]
        msg = "Count of created volumes is incorrect!"
        self.assertEqual(len(self.volumes), 10, msg)

        self.floating_ips = [self.nova.floating_ips.create()
                             for _ in range(count)]
        fip_new = [fip_info.ip for fip_info in self.floating_ips]
        fip_all = [fip_info.ip for fip_info in self.nova.floating_ips.list()]
        for fip in fip_new:
            self.assertIn(fip, fip_all)

        for volume in self.volumes:
            bdm = {'vda': volume.id}
            self.nova.servers.create(primary_name, '', flavor_id,
                                     security_groups=[self.sec_group.id],
                                     block_device_mapping=bdm,
                                     nics=[{"net-id": net_internal_id}])
        start_time = time()
        timeout = 5
        while len(self.nova.servers.list()) < len(initial_instances) + count \
                and time() < start_time + timeout * 60:
            sleep(5)

        instances = [inst for inst in self.nova.servers.list()
                     if inst not in initial_instances]
        self.instances = [inst.id for inst in instances]
        for inst_id in self.instances:
            self.assertTrue(common_functions.check_inst_status(self.nova,
                                                               inst_id,
                                                               'ACTIVE'))
        fip_dict = {}
        for inst in instances:
            fip = fip_new.pop()
            inst.add_floating_ip(fip)
            fip_dict[inst.id] = fip

        for inst_id in self.instances:
            self.assertTrue(common_functions.check_ip(
                self.nova, inst_id, fip_dict[inst_id]))

        for inst_id in self.instances:
            ping = common_functions.ping_command(fip_dict[inst_id], i=8)
            self.assertTrue(ping,
                            "Instance {} is not reachable".format(inst_id))
コード例 #8
0
    def test_live_migration_for_windows_instance(self):
        """This test checks that instance with Windows Image could be
        migrated without any issues

        Steps:
        1. Upload Windows 2012 Server image to Glance
        2. Create VM with this Windows image
        3. Assign floating IP to this VM
        4. Ping this VM and verify that we can ping it
        5. Migrate this VM to another compute node
        6. Verify that live Migration works fine for Windows VMs
        and we can successfully ping this VM
        7. Reboot VM and verify that
        we can successfully ping this VM after reboot.

        :return: Nothing
        """
        # 1. 2. 3. -> Into setUp function
        # 4. Ping this VM and verify that we can ping it
        hypervisor_hostname_attribute = "OS-EXT-SRV-ATTR:hypervisor_hostname"
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
        hypervisors = {h.hypervisor_hostname: h for h
                       in self.nova.hypervisors.list()}
        old_hyper = getattr(self.instance,
                            hypervisor_hostname_attribute)
        logger.info("Old hypervisor is: {}".format(old_hyper))
        new_hyper = [h for h in hypervisors.keys() if h != old_hyper][0]
        logger.info("New hypervisor is: {}".format(new_hyper))
        # Execute the live migrate
        self.instance.live_migrate(new_hyper, block_migration=True)

        self.instance = self.nova.servers.get(self.instance.id)
        end_time = time.time() + 60 * self.hypervisor_timeout
        debug_string = "Waiting for changes."
        while getattr(self.instance,
                      hypervisor_hostname_attribute) != new_hyper:
            if time.time() > end_time:
                # it can fail because of this issue
                # https://bugs.launchpad.net/mos/+bug/1544564
                logger.info(debug_string)
                raise AssertionError(
                    "Hypervisor is not changed after live migration")
            time.sleep(30)
            debug_string += "."
            self.instance = self.nova.servers.get(self.instance.id)
        logger.info(debug_string)
        self.assertEqual(self.instance.status, 'ACTIVE')
        # Ping the Virtual Machine
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")

        # Reboot the VM and make sure that we can ping it
        self.instance.reboot(reboot_type='HARD')
        instance_status = common_functions.check_inst_status(
            self.nova,
            self.instance.id,
            'ACTIVE')
        self.instance = [s for s in self.nova.servers.list()
                         if s.id == self.instance.id][0]
        if not instance_status:
            raise AssertionError(
                "Instance status is '{0}' instead of 'ACTIVE".format(
                    self.instance.status))

        self.wait_instance_to_boot()

        # Waiting for up-and-run of Virtual Machine after reboot
        ping_result = common_functions.ping_command(self.floating_ip.ip)
        self.assertTrue(ping_result, "Instance is not reachable")
コード例 #9
0
    def test_nova_massively_spawn_v_ms_boot_from_cinder(self):
        """This test case creates a lot of VMs which boot from Cinder, checks
        it state and availability and then deletes it.

        Steps:
            1. Create 10-100 volumes.
            2. Boot 10-100 instances from volumes.
            3. Check that list of instances contains created VMs.
            4. Check state of created instances
            5. Add the floating ips to the instances
            6. Ping the instances by the floating ips
        """
        initial_instances = self.nova.servers.list()
        count = 10
        primary_name = "testVM_543357"
        image_dict = {im.name: im.id for im in self.nova.images.list()}
        image_id = image_dict["TestVM"]
        flavor_dict = {f.name: f.id for f in self.nova.flavors.list()}
        flavor_id = flavor_dict["m1.tiny"]
        networks = self.neutron.list_networks()["networks"]
        net_dict = {net["name"]: net["id"] for net in networks}
        net_internal_id = net_dict["admin_internal_net"]

        initial_volumes = self.cinder.volumes.list()
        for i in range(count):
            common_functions.create_volume(self.cinder, image_id, size=1)
        self.volumes = [
            volume for volume in self.cinder.volumes.list()
            if volume not in initial_volumes
        ]
        msg = "Count of created volumes is incorrect!"
        self.assertEqual(len(self.volumes), 10, msg)

        self.floating_ips = [
            self.nova.floating_ips.create() for _ in range(count)
        ]
        fip_new = [fip_info.ip for fip_info in self.floating_ips]
        fip_all = [fip_info.ip for fip_info in self.nova.floating_ips.list()]
        for fip in fip_new:
            self.assertIn(fip, fip_all)

        for volume in self.volumes:
            bdm = {'vda': volume.id}
            self.nova.servers.create(primary_name,
                                     '',
                                     flavor_id,
                                     security_groups=[self.sec_group.name],
                                     block_device_mapping=bdm,
                                     nics=[{
                                         "net-id": net_internal_id
                                     }])
        start_time = time()
        timeout = 5
        while len(self.nova.servers.list()) < len(initial_instances) + count \
                and time() < start_time + timeout * 60:
            sleep(5)

        instances = [
            inst for inst in self.nova.servers.list()
            if inst not in initial_instances
        ]
        self.instances = [inst.id for inst in instances]
        for inst_id in self.instances:
            self.assertTrue(
                common_functions.check_inst_status(self.nova, inst_id,
                                                   'ACTIVE'))
        fip_dict = {}
        for inst in instances:
            fip = fip_new.pop()
            inst.add_floating_ip(fip)
            fip_dict[inst.id] = fip

        for inst_id in self.instances:
            self.assertTrue(
                common_functions.check_ip(self.nova, inst_id,
                                          fip_dict[inst_id]))

        for inst_id in self.instances:
            ping = common_functions.ping_command(fip_dict[inst_id], i=8)
            self.assertTrue(ping,
                            "Instance {} is not reachable".format(inst_id))
コード例 #10
0
    def test_nova_massively_spawn_v_ms_with_boot_local(self):
        """This test case creates a lot of VMs with boot local, checks it
        state and availability and then deletes it.

        Steps:
            1. Boot 10-100 instances from image.
            2. Check that list of instances contains created VMs.
            3. Check state of created instances
            4. Add the floating ips to the instances
            5. Ping the instances by the floating ips
        """
        initial_instances = self.nova.servers.list()
        primary_name = "testVM_543356"
        count = 10
        image_dict = {im.name: im.id for im in self.nova.images.list()}
        image_id = image_dict["TestVM"]
        flavor_dict = {f.name: f.id for f in self.nova.flavors.list()}
        flavor_id = flavor_dict["m1.micro"]
        networks = self.neutron.list_networks()["networks"]
        net_dict = {net["name"]: net["id"] for net in networks}
        net_internal_id = net_dict["admin_internal_net"]

        self.floating_ips = [
            self.nova.floating_ips.create() for _ in range(count)
        ]
        fip_new = [fip_info.ip for fip_info in self.floating_ips]
        fip_all = [fip_info.ip for fip_info in self.nova.floating_ips.list()]
        for fip in fip_new:
            self.assertIn(fip, fip_all)

        self.nova.servers.create(primary_name,
                                 image_id,
                                 flavor_id,
                                 max_count=count,
                                 security_groups=[self.sec_group.name],
                                 nics=[{
                                     "net-id": net_internal_id
                                 }])
        start_time = time()
        timeout = 5
        while len(self.nova.servers.list()) < len(initial_instances) + count \
                and time() < start_time + timeout * 60:
            sleep(5)

        instances = [
            inst for inst in self.nova.servers.list()
            if inst not in initial_instances
        ]
        self.instances = [inst.id for inst in instances]
        for inst_id in self.instances:
            self.assertTrue(
                common_functions.check_inst_status(self.nova, inst_id,
                                                   'ACTIVE'))
        fip_dict = {}
        for inst in instances:
            fip = fip_new.pop()
            inst.add_floating_ip(fip)
            fip_dict[inst.id] = fip

        for inst_id in self.instances:
            self.assertTrue(
                common_functions.check_ip(self.nova, inst_id,
                                          fip_dict[inst_id]))

        for inst_id in self.instances:
            ping = common_functions.ping_command(fip_dict[inst_id], i=8)
            self.assertTrue(ping,
                            "Instance {} is not reachable".format(inst_id))
コード例 #11
0
    def test_resize_down_an_instance_booted_from_volume(self):
        """This test checks that nova allows
            resize down an instance booted from volume
            Steps:
            1. Create bootable volume
            2. Boot instance from newly created volume
            3. Resize instance from m1.small to m1.tiny
        """

        # 1. Create bootable volume
        image_id = [
            image.id for image in self.nova.images.list()
            if image.name == 'TestVM'
        ][0]

        volume = common_functions.create_volume(self.cinder,
                                                image_id,
                                                timeout=60)
        self.volumes.append(volume)

        # 2. Create instance from newly created volume, associate floating_ip
        name = 'TestVM_543355_instance_to_resize'
        networks = self.neutron.list_networks()['networks']
        net = [net['id'] for net in networks if not net['router:external']][0]
        flavor_list = {f.name: f.id for f in self.nova.flavors.list()}
        initial_flavor = flavor_list['m1.small']
        resize_flavor = flavor_list['m1.tiny']
        bdm = {'vda': volume.id}
        instance = common_functions.create_instance(self.nova,
                                                    name,
                                                    initial_flavor,
                                                    net, [self.sec_group.name],
                                                    block_device_mapping=bdm,
                                                    inst_list=self.instances)
        self.instances.append(instance.id)

        # Assert for attached volumes
        attached_volumes = self.nova.servers.get(
            instance).to_dict()['os-extended-volumes:volumes_attached']
        self.assertIn({'id': volume.id}, attached_volumes)

        # Assert to flavor size
        self.assertEqual(
            self.nova.servers.get(instance).flavor['id'], initial_flavor,
            "Unexpected instance flavor before resize")

        floating_ip = self.nova.floating_ips.create()
        self.floating_ips.append(floating_ip.ip)
        instance.add_floating_ip(floating_ip.ip)

        # 3. Resize from m1.small to m1.tiny
        self.nova.servers.resize(instance, resize_flavor)
        common_functions.check_inst_status(self.nova, instance.id,
                                           'VERIFY_RESIZE', 60)
        self.nova.servers.confirm_resize(instance)
        common_functions.check_inst_status(self.nova, instance.id, 'ACTIVE',
                                           60)
        self.assertEqual(
            self.nova.servers.get(instance).flavor['id'], resize_flavor,
            "Unexpected instance flavor after resize")

        # Check that instance is reachable
        ping = common_functions.ping_command(floating_ip.ip)
        self.assertTrue(ping, "Instance after resize is not reachable")