Пример #1
0
    def setUp(self):
        super(VsaTestCase, self).setUp()
        self.stubs = stubout.StubOutForTesting()
        self.vsa_api = vsa.API()
        self.volume_api = volume.API()

        FLAGS.quota_volumes = 100
        FLAGS.quota_gigabytes = 10000

        self.context = context.get_admin_context()

        volume_types.create(self.context,
                            'SATA_500_7200',
                            extra_specs={
                                'type': 'vsa_drive',
                                'drive_name': 'SATA_500_7200',
                                'drive_type': 'SATA',
                                'drive_size': '500',
                                'drive_rpm': '7200'
                            })

        def fake_show_by_name(meh, context, name):
            if name == 'wrong_image_name':
                LOG.debug(_("Test: Emulate wrong VSA name. Raise"))
                raise exception.ImageNotFound
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.stubs.Set(engine.image.fake._FakeImageService, 'show_by_name',
                       fake_show_by_name)
Пример #2
0
 def test_too_many_gigabytes(self):
     volume_ids = []
     volume_id = self._create_volume(size=20)
     volume_ids.append(volume_id)
     self.assertRaises(exception.QuotaError,
                       volume.API().create,
                       self.context,
                       size=10,
                       snapshot_id=None,
                       name='',
                       description='')
     for volume_id in volume_ids:
         db.volume_destroy(self.context, volume_id)
Пример #3
0
    def __init__(self, vsa_driver=None, *args, **kwargs):
        if not vsa_driver:
            vsa_driver = FLAGS.vsa_driver
        self.driver = utils.import_object(vsa_driver)
        self.compute_manager = utils.import_object(FLAGS.compute_manager)

        self.compute_api = compute.API()
        self.volume_api = volume.API()
        self.vsa_api = vsa.API()

        if FLAGS.vsa_ec2_user_id is None or \
           FLAGS.vsa_ec2_access_key is None:
            raise exception.VSAEngineAccessParamNotFound()

        super(VsaManager, self).__init__(*args, **kwargs)
Пример #4
0
    def setUp(self):
        super(VsaVolumesTestCase, self).setUp()
        self.stubs = stubout.StubOutForTesting()
        self.vsa_api = vsa.API()
        self.volume_api = volume.API()
        self.context = context.get_admin_context()

        self.default_vol_type = self.vsa_api.get_vsa_volume_type(self.context)

        def fake_show_by_name(meh, context, name):
            return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}

        self.stubs.Set(engine.image.fake._FakeImageService, 'show_by_name',
                       fake_show_by_name)

        param = {'display_name': 'VSA name test'}
        vsa_ref = self.vsa_api.create(self.context, **param)
        self.vsa_id = vsa_ref['id']
Пример #5
0
 def __init__(self):
     self.volume_api = volume.API()
     self.vsa_api = vsa.API()
     super(VsaVolumeDriveController, self).__init__()
Пример #6
0
 def __init__(self):
     self.compute_api = compute.API(network_api=network.API(),
                                    volume_api=volume.API())
Пример #7
0
 def __init__(self):
     self.volume_api = volume.API()
     super(SnapshotController, self).__init__()
Пример #8
0
 def __init__(self):
     self.compute_api = compute.API()
     self.volume_api = volume.API()
     super(VolumeAttachmentController, self).__init__()
Пример #9
0
 def __init__(self):
     self.volume_api = volume.API()
     super(VolumeController, self).__init__()
Пример #10
0
 def __init__(self, compute_api=None, volume_api=None, **kwargs):
     self.compute_api = compute_api or compute.API()
     self.volume_api = volume_api or volume.API()
     super(API, self).__init__(**kwargs)