def setUp(self):
        super(volumeMetaDataTest, self).setUp()
        self.volume_api = cinder.volume.api.API()
        fakes.stub_out_key_pair_funcs(self.stubs)
        self.stubs.Set(cinder.db, 'volume_get', return_volume)
        self.stubs.Set(cinder.db, 'volume_metadata_get',
                       return_volume_metadata)
        self.stubs.Set(cinder.db, 'service_get_all_by_topic',
                       stubs.stub_service_get_all_by_topic)

        self.stubs.Set(self.volume_api, 'update_volume_metadata',
                       fake_update_volume_metadata)

        self.ext_mgr = extensions.ExtensionManager()
        self.ext_mgr.extensions = {}
        self.volume_controller = volumes.VolumeController(self.ext_mgr)
        self.controller = volume_metadata.Controller()
        self.req_id = str(uuid.uuid4())
        self.url = '/v1/fake/volumes/%s/metadata' % self.req_id

        vol = {"size": 100,
               "display_name": "Volume Test Name",
               "display_description": "Volume Test Desc",
               "availability_zone": "zone1:host1",
               "metadata": {}}
        body = {"volume": vol}
        req = fakes.HTTPRequest.blank('/v1/volumes')
        self.volume_controller.create(req, body)
    def setUp(self):
        super(SnapshotMetaDataTest, self).setUp()
        self.volume_api = cinder.volume.api.API()
        fakes.stub_out_key_pair_funcs(self.stubs)
        self.stubs.Set(cinder.db, 'volume_get', return_volume)
        self.stubs.Set(cinder.db, 'snapshot_get', return_snapshot)
        self.stubs.Set(cinder.db, 'snapshot_metadata_get',
                       return_snapshot_metadata)

        self.stubs.Set(self.volume_api, 'update_snapshot_metadata',
                       fake_update_snapshot_metadata)

        self.ext_mgr = extensions.ExtensionManager()
        self.ext_mgr.extensions = {}
        self.snapshot_controller = snapshots.SnapshotsController(self.ext_mgr)
        self.controller = snapshot_metadata.Controller()
        self.req_id = str(uuid.uuid4())
        self.url = '/v1/fake/snapshots/%s/metadata' % self.req_id

        snap = {
            "volume_size": 100,
            "volume_id": "fake-vol-id",
            "display_name": "Volume Test Name",
            "display_description": "Volume Test Desc",
            "availability_zone": "zone1:host1",
            "host": "fake-host",
            "metadata": {}
        }
        body = {"snapshot": snap}
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        self.snapshot_controller.create(req, body)
    def setUp(self):
        super(SnapshotMetaDataTest, self).setUp()
        self.volume_api = cinder.volume.api.API()
        fakes.stub_out_key_pair_funcs(self.stubs)
        self.stubs.Set(cinder.db, 'volume_get', return_volume)
        self.stubs.Set(cinder.db, 'snapshot_get', return_snapshot)
        self.stubs.Set(cinder.db, 'snapshot_metadata_get',
                       return_snapshot_metadata)

        self.stubs.Set(self.volume_api, 'update_snapshot_metadata',
                       fake_update_snapshot_metadata)

        self.ext_mgr = extensions.ExtensionManager()
        self.ext_mgr.extensions = {}
        self.snapshot_controller = snapshots.SnapshotsController(self.ext_mgr)
        self.controller = snapshot_metadata.Controller()
        self.req_id = str(uuid.uuid4())
        self.url = '/v1/fake/snapshots/%s/metadata' % self.req_id

        snap = {"volume_size": 100,
                "volume_id": "fake-vol-id",
                "display_name": "Volume Test Name",
                "display_description": "Volume Test Desc",
                "availability_zone": "zone1:host1",
                "host": "fake-host",
                "metadata": {}}
        body = {"snapshot": snap}
        req = fakes.HTTPRequest.blank('/v1/snapshots')
        self.snapshot_controller.create(req, body)
Exemple #4
0
    def setUp(self):
        super(volumeMetaDataTest, self).setUp()
        self.volume_api = volume_api.API()
        fakes.stub_out_key_pair_funcs(self.stubs)
        self.stubs.Set(db, 'volume_get', return_volume)
        self.stubs.Set(db, 'volume_metadata_get', return_volume_metadata)
        self.stubs.Set(db, 'service_get_all_by_topic',
                       stubs.stub_service_get_all_by_topic)

        self.stubs.Set(self.volume_api, 'update_volume_metadata',
                       fake_update_volume_metadata)

        self.ext_mgr = extensions.ExtensionManager()
        self.ext_mgr.extensions = {}
        self.volume_controller = volumes.VolumeController(self.ext_mgr)
        self.controller = volume_metadata.Controller()
        self.req_id = str(uuid.uuid4())
        self.url = '/v2/fake/volumes/%s/metadata' % self.req_id

        vol = {
            "size": 100,
            "display_name": "Volume Test Name",
            "display_description": "Volume Test Desc",
            "availability_zone": "zone1:host1",
            "metadata": {}
        }
        body = {"volume": vol}
        req = fakes.HTTPRequest.blank('/v2/volumes')
        self.volume_controller.create(req, body)