Exemplo n.º 1
0
    def test_volume_status_of_detaching_volume(self):
        """Test the volume's status in response when detaching a volume."""
        vol1 = self.cloud.create_volume(self.context,
                                        size=1,
                                        name='test-ls',
                                        description='test volume ls')
        self.assertEqual('available', vol1['status'])
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        kwargs = {
            'image_id':
            'ami-1',
            'instance_type':
            CONF.default_flavor,
            'max_count':
            1,
            'block_device_mapping': [{
                'device_name': '/dev/sdb',
                'volume_id': vol1_uuid,
                'delete_on_termination': True
            }]
        }
        self._run_instance(**kwargs)
        resp = self.cloud.detach_volume(self.context, vol1['volumeId'])

        # Here,the status should be 'detaching',but it can be 'detached' in
        # unittest scenario if the detach action is very fast.
        self.assertIn(resp['status'], ('detaching', 'detached'))
Exemplo n.º 2
0
    def test_volume_status_of_detaching_volume(self):
        """Test the volume's status in response when detaching a volume."""
        vol1 = self.cloud.create_volume(self.context,
                                        size=1,
                                        name='test-ls',
                                        description='test volume ls')
        self.assertEqual('available', vol1['status'])
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_flavor,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': True}]}
        ec2_instance_id = self._run_instance(**kwargs)

        # NOTE(ft): Since fake detach action is very fast, we replace it to
        # empty function to check EC2 API results at 'detaching' stage
        self.stubs.Set(fake_volume.API, 'detach',
                       lambda *args, **kwargs: None)

        resp = self.cloud.detach_volume(self.context,
                                        vol1['volumeId'])

        self.assertEqual('detaching', resp['status'])
        resp = self.cloud.describe_volumes(self.context, [vol1['volumeId']])
        volume = resp['volumeSet'][0]
        self.assertEqual('in-use', volume['status'])
        self.assertThat({'status': 'detaching',
                         'volumeId': vol1['volumeId'],
                         'device': '/dev/sdb',
                         'instanceId': ec2_instance_id},
                         matchers.IsSubDictOf(volume['attachmentSet'][0]))
Exemplo n.º 3
0
def param2id(object_id):
    """Helper function to convert various volume id types to internal id.
    args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10'
    """
    if '-' in object_id:
        return ec2utils.ec2_vol_id_to_uuid(object_id)
    else:
        return object_id
Exemplo n.º 4
0
    def test_volume_status_of_detaching_volume(self):
        """Test the volume's status in response when detaching a volume."""
        vol1 = self.cloud.create_volume(self.context,
                                        size=1,
                                        name='test-ls',
                                        description='test volume ls')
        self.assertEqual('available', vol1['status'])
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_flavor,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': True}]}
        self._run_instance(**kwargs)
        resp = self.cloud.detach_volume(self.context,
                                        vol1['volumeId'])

        # Here,the status should be 'detaching',but it can be 'detached' in
        # unittest scenario if the detach action is very fast.
        self.assertIn(resp['status'], ('detaching', 'detached'))
Exemplo n.º 5
0
    def test_volume_status_of_detaching_volume(self):
        """Test the volume's status in response when detaching a volume."""
        vol1 = self.cloud.create_volume(self.context,
                                        size=1,
                                        name='test-ls',
                                        description='test volume ls')
        self.assertEqual('available', vol1['status'])
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        kwargs = {
            'image_id':
            'ami-1',
            'instance_type':
            CONF.default_flavor,
            'max_count':
            1,
            'block_device_mapping': [{
                'device_name': '/dev/sdb',
                'volume_id': vol1_uuid,
                'delete_on_termination': True
            }]
        }
        ec2_instance_id = self._run_instance(**kwargs)

        # NOTE(ft): Since fake detach action is very fast, we replace it to
        # empty function to check EC2 API results at 'detaching' stage
        self.stubs.Set(fake_volume.API, 'detach', lambda *args, **kwargs: None)

        resp = self.cloud.detach_volume(self.context, vol1['volumeId'])

        self.assertEqual('detaching', resp['status'])
        resp = self.cloud.describe_volumes(self.context, [vol1['volumeId']])
        volume = resp['volumeSet'][0]
        self.assertEqual('in-use', volume['status'])
        self.assertThat(
            {
                'status': 'detaching',
                'volumeId': vol1['volumeId'],
                'device': '/dev/sdb',
                'instanceId': ec2_instance_id
            }, matchers.IsSubDictOf(volume['attachmentSet'][0]))
Exemplo n.º 6
0
    def test_stop_with_attached_volume(self):
        """Make sure attach info is reflected to block device mapping"""

        availability_zone = 'zone1:host1'
        vol1 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2['volumeId'])

        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval=0.3)
        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_instance_type,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': True}]}
        ec2_instance_id = self._run_instance(**kwargs)
        instance_uuid = ec2utils.ec2_inst_id_to_uuid(self.context,
                                                     ec2_instance_id)

        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 1)
        for vol in vols:
            self.assertEqual(vol['id'], vol1_uuid)
            self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')
        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_detached(vol)

        instance = db.instance_get_by_uuid(self.context, instance_uuid)
        self.cloud.compute_api.attach_volume(self.context,
                                             instance,
                                             volume_id=vol2_uuid,
                                             device='/dev/sdc')

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol1, instance_uuid, '/dev/sdb')

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, '/dev/sdc')

        self.cloud.compute_api.detach_volume(self.context,
                                             volume_id=vol1_uuid)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, '/dev/sdc')

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 1)

        self._assert_volume_detached(vol1)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        self.cloud.terminate_instances(self.context, [ec2_instance_id])
Exemplo n.º 7
0
    def test_stop_start_with_volume(self):
        """Make sure run instance with block device mapping works"""
        availability_zone = 'zone1:host1'
        vol1 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2['volumeId'])
        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval=0.3)

        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_instance_type,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': False},
                                           {'device_name': '/dev/sdc',
                                            'volume_id': vol2_uuid,
                                            'delete_on_termination': True},
                                           ]}
        ec2_instance_id = self._run_instance(**kwargs)
        instance_uuid = ec2utils.ec2_inst_id_to_uuid(self.context,
                                                     ec2_instance_id)
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]

        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol['id']) == str(vol1_uuid) or
                str(vol['id']) == str(vol2_uuid))
            if(str(vol['id']) == str(vol1_uuid)):
                self.volume_api.attach(self.context, vol,
                                       instance_uuid, '/dev/sdb')
            elif(str(vol['id']) == str(vol2_uuid)):
                self.volume_api.attach(self.context, vol,
                                       instance_uuid, '/dev/sdc')

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdc')

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdc')

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol['id']) == str(vol1_uuid) or
                            str(vol['id']) == str(vol2_uuid))
            self.assertTrue(vol['mountpoint'] == '/dev/sdb' or
                            vol['mountpoint'] == '/dev/sdc')
            self.assertEqual(vol['instance_uuid'], instance_uuid)
            self.assertEqual(vol['status'], "in-use")
            self.assertEqual(vol['attach_status'], "attached")

        #Here we puke...
        self.cloud.terminate_instances(self.context, [ec2_instance_id])

        admin_ctxt = context.get_admin_context(read_deleted="no")
        vol = self.volume_api.get(admin_ctxt, vol2_uuid)
        self.assertFalse(vol['deleted'])
        self.cloud.delete_volume(self.context, vol1['volumeId'])
        self._restart_compute_service()
Exemplo n.º 8
0
    def test_stop_with_attached_volume(self):
        # Make sure attach info is reflected to block device mapping.

        availability_zone = 'zone1:host1'
        vol1 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2['volumeId'])

        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval_max=0.3)
        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_flavor,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': True}]}
        ec2_instance_id = self._run_instance(**kwargs)
        instance_uuid = ec2utils.ec2_inst_id_to_uuid(self.context,
                                                     ec2_instance_id)

        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 1)
        for vol in vols:
            self.assertEqual(vol['id'], vol1_uuid)
            self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')
        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_detached(vol)

        instance = db.instance_get_by_uuid(self.context, instance_uuid)
        self.cloud.compute_api.attach_volume(self.context,
                                             instance,
                                             volume_id=vol2_uuid,
                                             device='/dev/sdc')

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol1, instance_uuid, '/dev/sdb')

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, '/dev/sdc')

        self.cloud.compute_api.detach_volume(self.context,
                                             instance, vol1)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, '/dev/sdc')

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 1)

        self._assert_volume_detached(vol1)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        self.cloud.terminate_instances(self.context, [ec2_instance_id])
Exemplo n.º 9
0
    def test_stop_start_with_volume(self):
        # Make sure run instance with block device mapping works.
        availability_zone = 'zone1:host1'
        vol1 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context,
                                          size=1,
                                          availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1['volumeId'])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2['volumeId'])
        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval_max=0.3)

        kwargs = {'image_id': 'ami-1',
                  'instance_type': CONF.default_flavor,
                  'max_count': 1,
                  'block_device_mapping': [{'device_name': '/dev/sdb',
                                            'volume_id': vol1_uuid,
                                            'delete_on_termination': False},
                                           {'device_name': '/dev/sdc',
                                            'volume_id': vol2_uuid,
                                            'delete_on_termination': True},
                                           ]}
        ec2_instance_id = self._run_instance(**kwargs)
        instance_uuid = ec2utils.ec2_inst_id_to_uuid(self.context,
                                                     ec2_instance_id)
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]

        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol['id']) == str(vol1_uuid) or
                str(vol['id']) == str(vol2_uuid))
            if str(vol['id']) == str(vol1_uuid):
                self.volume_api.attach(self.context, vol['id'],
                                       instance_uuid, '/dev/sdb')
            elif str(vol['id']) == str(vol2_uuid):
                self.volume_api.attach(self.context, vol['id'],
                                       instance_uuid, '/dev/sdc')

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdc')

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdb')

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, '/dev/sdc')

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v['instance_uuid'] == instance_uuid]
        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol['id']) == str(vol1_uuid) or
                            str(vol['id']) == str(vol2_uuid))
            self.assertTrue(vol['mountpoint'] == '/dev/sdb' or
                            vol['mountpoint'] == '/dev/sdc')
            self.assertEqual(vol['instance_uuid'], instance_uuid)
            self.assertEqual(vol['status'], "in-use")
            self.assertEqual(vol['attach_status'], "attached")

        #Here we puke...
        self.cloud.terminate_instances(self.context, [ec2_instance_id])

        admin_ctxt = context.get_admin_context(read_deleted="no")
        vol = self.volume_api.get(admin_ctxt, vol2_uuid)
        self.assertFalse(vol['deleted'])
        self.cloud.delete_volume(self.context, vol1['volumeId'])
        self._restart_compute_service()
Exemplo n.º 10
0
    def test_stop_with_attached_volume(self):
        """Make sure attach info is reflected to block device mapping"""

        availability_zone = "zone1:host1"
        vol1 = self.cloud.create_volume(self.context, size=1, availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context, size=1, availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1["volumeId"])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2["volumeId"])

        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval=0.3)
        kwargs = {
            "image_id": "ami-1",
            "instance_type": FLAGS.default_instance_type,
            "max_count": 1,
            "block_device_mapping": [
                {"device_name": "/dev/vdb", "volume_id": vol1_uuid, "delete_on_termination": True}
            ],
        }
        ec2_instance_id = self._run_instance(**kwargs)
        instance_id = ec2utils.ec2_id_to_id(ec2_instance_id)
        instance_uuid = ec2utils.ec2_instance_id_to_uuid(self.context, ec2_instance_id)

        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v["instance_uuid"] == instance_uuid]
        self.assertEqual(len(vols), 1)
        for vol in vols:
            self.assertEqual(vol["id"], vol1_uuid)
            self._assert_volume_attached(vol, instance_uuid, "/dev/vdb")
        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_detached(vol)

        instance = db.instance_get(self.context, instance_id)
        self.cloud.compute_api.attach_volume(self.context, instance, volume_id=vol2_uuid, device="/dev/vdc")

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol1, instance_uuid, "/dev/vdb")

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, "/dev/vdc")

        self.cloud.compute_api.detach_volume(self.context, volume_id=vol1_uuid)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol2 = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol2, instance_uuid, "/dev/vdc")

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v["instance_uuid"] == instance_uuid]
        self.assertEqual(len(vols), 1)

        self._assert_volume_detached(vol1)

        vol1 = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_detached(vol1)

        self.cloud.terminate_instances(self.context, [ec2_instance_id])
Exemplo n.º 11
0
    def test_stop_start_with_volume(self):
        """Make sure run instance with block device mapping works"""
        availability_zone = "zone1:host1"
        vol1 = self.cloud.create_volume(self.context, size=1, availability_zone=availability_zone)
        vol2 = self.cloud.create_volume(self.context, size=1, availability_zone=availability_zone)
        vol1_uuid = ec2utils.ec2_vol_id_to_uuid(vol1["volumeId"])
        vol2_uuid = ec2utils.ec2_vol_id_to_uuid(vol2["volumeId"])
        # enforce periodic tasks run in short time to avoid wait for 60s.
        self._restart_compute_service(periodic_interval=0.3)

        kwargs = {
            "image_id": "ami-1",
            "instance_type": FLAGS.default_instance_type,
            "max_count": 1,
            "block_device_mapping": [
                {"device_name": "/dev/vdb", "volume_id": vol1_uuid, "delete_on_termination": False},
                {"device_name": "/dev/vdc", "volume_id": vol2_uuid, "delete_on_termination": True},
            ],
        }
        ec2_instance_id = self._run_instance(**kwargs)
        instance_uuid = ec2utils.ec2_instance_id_to_uuid(self.context, ec2_instance_id)
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v["instance_uuid"] == instance_uuid]

        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol["id"]) == str(vol1_uuid) or str(vol["id"]) == str(vol2_uuid))
            if str(vol["id"]) == str(vol1_uuid):
                self.volume_api.attach(self.context, vol, instance_uuid, "/dev/vdb")
            elif str(vol["id"]) == str(vol2_uuid):
                self.volume_api.attach(self.context, vol, instance_uuid, "/dev/vdc")

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, "/dev/vdb")

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, "/dev/vdc")

        result = self.cloud.stop_instances(self.context, [ec2_instance_id])
        self.assertTrue(result)

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, "/dev/vdb")

        vol = self.volume_api.get(self.context, vol1_uuid)
        self._assert_volume_attached(vol, instance_uuid, "/dev/vdb")

        vol = self.volume_api.get(self.context, vol2_uuid)
        self._assert_volume_attached(vol, instance_uuid, "/dev/vdc")

        self.cloud.start_instances(self.context, [ec2_instance_id])
        vols = self.volume_api.get_all(self.context)
        vols = [v for v in vols if v["instance_uuid"] == instance_uuid]
        self.assertEqual(len(vols), 2)
        for vol in vols:
            self.assertTrue(str(vol["id"]) == str(vol1_uuid) or str(vol["id"]) == str(vol2_uuid))
            self.assertTrue(vol["mountpoint"] == "/dev/vdb" or vol["mountpoint"] == "/dev/vdc")
            self.assertEqual(vol["instance_uuid"], instance_uuid)
            self.assertEqual(vol["status"], "in-use")
            self.assertEqual(vol["attach_status"], "attached")

        # Here we puke...
        self.cloud.terminate_instances(self.context, [ec2_instance_id])

        admin_ctxt = context.get_admin_context(read_deleted="no")
        vol = self.volume_api.get(admin_ctxt, vol2_uuid)
        self.assertFalse(vol["deleted"])
        self.cloud.delete_volume(self.context, vol1["volumeId"])
        self._restart_compute_service()