コード例 #1
0
    def test_vols_get_glance_metadata(self):
        ctxt = context.get_admin_context()
        db.volume_create(ctxt, {
            'id': fake.VOLUME_ID,
            'volume_type_id': fake.VOLUME_TYPE_ID
        })
        db.volume_create(ctxt, {
            'id': fake.VOLUME2_ID,
            'volume_type_id': fake.VOLUME_TYPE_ID
        })
        db.volume_create(ctxt, {
            'id': '3',
            'volume_type_id': fake.VOLUME_TYPE_ID
        })
        db.volume_glance_metadata_create(ctxt, fake.VOLUME_ID, 'key1',
                                         'value1')
        db.volume_glance_metadata_create(ctxt, fake.VOLUME2_ID, 'key2',
                                         'value2')
        db.volume_glance_metadata_create(ctxt, fake.VOLUME2_ID, 'key22',
                                         'value22')

        metadata = db.volume_glance_metadata_get_all(ctxt)
        self.assertEqual(3, len(metadata))
        self._assert_metadata_equals(fake.VOLUME_ID, 'key1', 'value1',
                                     metadata[0])
        self._assert_metadata_equals(fake.VOLUME2_ID, 'key2', 'value2',
                                     metadata[1])
        self._assert_metadata_equals(fake.VOLUME2_ID, 'key22', 'value22',
                                     metadata[2])
コード例 #2
0
    def test_vols_get_glance_metadata(self):
        ctxt = context.get_admin_context()
        db.volume_create(ctxt, {'id': '1'})
        db.volume_create(ctxt, {'id': '2'})
        db.volume_create(ctxt, {'id': '3'})
        db.volume_glance_metadata_create(ctxt, '1', 'key1', 'value1')
        db.volume_glance_metadata_create(ctxt, '2', 'key2', 'value2')
        db.volume_glance_metadata_create(ctxt, '2', 'key22', 'value22')

        metadata = db.volume_glance_metadata_get_all(ctxt)
        self.assertEqual(3, len(metadata))
        self._assert_metadata_equals('1', 'key1', 'value1', metadata[0])
        self._assert_metadata_equals('2', 'key2', 'value2', metadata[1])
        self._assert_metadata_equals('2', 'key22', 'value22', metadata[2])
コード例 #3
0
    def test_vols_get_glance_metadata(self):
        ctxt = context.get_admin_context()
        db.volume_create(ctxt, {'id': '1'})
        db.volume_create(ctxt, {'id': '2'})
        db.volume_create(ctxt, {'id': '3'})
        db.volume_glance_metadata_create(ctxt, '1', 'key1', 'value1')
        db.volume_glance_metadata_create(ctxt, '2', 'key2', 'value2')
        db.volume_glance_metadata_create(ctxt, '2', 'key22', 'value22')

        metadata = db.volume_glance_metadata_get_all(ctxt)
        self.assertEqual(3, len(metadata))
        self._assert_metadata_equals('1', 'key1', 'value1', metadata[0])
        self._assert_metadata_equals('2', 'key2', 'value2', metadata[1])
        self._assert_metadata_equals('2', 'key22', 'value22', metadata[2])
コード例 #4
0
    def test_vols_get_glance_metadata(self):
        ctxt = context.get_admin_context()
        db.volume_create(ctxt, {"id": fake.VOLUME_ID})
        db.volume_create(ctxt, {"id": fake.VOLUME2_ID})
        db.volume_create(ctxt, {"id": "3"})
        db.volume_glance_metadata_create(ctxt, fake.VOLUME_ID, "key1", "value1")
        db.volume_glance_metadata_create(ctxt, fake.VOLUME2_ID, "key2", "value2")
        db.volume_glance_metadata_create(ctxt, fake.VOLUME2_ID, "key22", "value22")

        metadata = db.volume_glance_metadata_get_all(ctxt)
        self.assertEqual(3, len(metadata))
        self._assert_metadata_equals(fake.VOLUME_ID, "key1", "value1", metadata[0])
        self._assert_metadata_equals(fake.VOLUME2_ID, "key2", "value2", metadata[1])
        self._assert_metadata_equals(fake.VOLUME2_ID, "key22", "value22", metadata[2])
コード例 #5
0
    def test_vols_get_glance_metadata(self):
        ctxt = context.get_admin_context()
        db.volume_create(ctxt, {"id": "1"})
        db.volume_create(ctxt, {"id": "2"})
        db.volume_create(ctxt, {"id": "3"})
        db.volume_glance_metadata_create(ctxt, "1", "key1", "value1")
        db.volume_glance_metadata_create(ctxt, "2", "key2", "value2")
        db.volume_glance_metadata_create(ctxt, "2", "key22", "value22")

        metadata = db.volume_glance_metadata_get_all(ctxt)
        self.assertEqual(len(metadata), 3)
        self._assert_metadata_equals("1", "key1", "value1", metadata[0])
        self._assert_metadata_equals("2", "key2", "value2", metadata[1])
        self._assert_metadata_equals("2", "key22", "value22", metadata[2])