Beispiel #1
0
    def test_libvirt_rbd_driver_auth_disabled_flags_override(self):
        libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
        name = 'volume-00000001'
        vol = {'id': 1, 'name': name}
        connection_info = self.rbd_connection(vol)
        uuid = '875a8070-d0b9-4949-8b31-104d125c9a64'
        user = '******'
        secret_type = 'ceph'
        connection_info['data']['auth_enabled'] = False
        connection_info['data']['auth_username'] = user
        connection_info['data']['secret_type'] = secret_type
        connection_info['data']['secret_uuid'] = uuid

        # NOTE: Supplying the rbd_secret_uuid will enable authentication
        # locally in nova-compute even if not enabled in nova-volume/cinder
        flags_uuid = '37152720-1785-11e2-a740-af0c1d8b8e4b'
        flags_user = '******'
        self.flags(rbd_user=flags_user, rbd_secret_uuid=flags_uuid)
        disk_info = {
            "bus": "virtio",
            "dev": "vde",
            "type": "disk",
        }

        conf = libvirt_driver.connect_volume(connection_info, disk_info)
        tree = conf.format_dom()
        self.assertEqual(tree.get('type'), 'network')
        self.assertEqual(tree.find('./source').get('protocol'), 'rbd')
        rbd_name = '%s/%s' % ('rbd', name)
        self.assertEqual(tree.find('./source').get('name'), rbd_name)
        self.assertEqual(tree.find('./auth').get('username'), flags_user)
        self.assertEqual(tree.find('./auth/secret').get('type'), secret_type)
        self.assertEqual(tree.find('./auth/secret').get('uuid'), flags_uuid)
        libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #2
0
    def test_libvirt_rbd_driver_auth_disabled(self):
        libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
        name = 'volume-00000001'
        vol = {'id': 1, 'name': name}
        connection_info = self.rbd_connection(vol)
        uuid = '875a8070-d0b9-4949-8b31-104d125c9a64'
        user = '******'
        secret_type = 'ceph'
        connection_info['data']['auth_enabled'] = False
        connection_info['data']['auth_username'] = user
        connection_info['data']['secret_type'] = secret_type
        connection_info['data']['secret_uuid'] = uuid
        disk_info = {
            "bus": "virtio",
            "dev": "vde",
            "type": "disk",
        }

        conf = libvirt_driver.connect_volume(connection_info, disk_info)
        tree = conf.format_dom()
        self.assertEqual(tree.get('type'), 'network')
        self.assertEqual(tree.find('./source').get('protocol'), 'rbd')
        rbd_name = '%s/%s' % ('rbd', name)
        self.assertEqual(tree.find('./source').get('name'), rbd_name)
        self.assertEqual(tree.find('./auth'), None)
        libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #3
0
 def test_libvirt_rbd_driver_hosts(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     name = 'volume-00000001'
     vol = {'id': 1, 'name': name}
     connection_info = self.rbd_connection(vol)
     disk_info = {
         "bus": "virtio",
         "dev": "vde",
         "type": "disk",
         }
     hosts = ['example.com', '1.2.3.4', '::1']
     ports = [None, '6790', '6791']
     connection_info['data']['hosts'] = hosts
     connection_info['data']['ports'] = ports
     conf = libvirt_driver.connect_volume(connection_info, disk_info)
     tree = conf.format_dom()
     self.assertEqual(tree.get('type'), 'network')
     self.assertEqual(tree.find('./source').get('protocol'), 'rbd')
     rbd_name = '%s/%s' % ('rbd', name)
     self.assertEqual(tree.find('./source').get('name'), rbd_name)
     self.assertEqual(tree.find('./source/auth'), None)
     found_hosts = tree.findall('./source/host')
     self.assertEqual([host.get('name') for host in found_hosts], hosts)
     self.assertEqual([host.get('port') for host in found_hosts], ports)
     libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #4
0
 def test_libvirt_rbd_driver(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     connection_info = self.rbd_connection(self.vol)
     conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
     tree = conf.format_dom()
     self._assertNetworkAndProtocolEquals(tree)
     self.assertEqual(tree.find('./source/auth'), None)
     libvirt_driver.disconnect_volume(connection_info, "vde")
 def test_libvirt_sheepdog_driver(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     connection_info = self.sheepdog_connection(self.vol)
     conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
     tree = conf.format_dom()
     self.assertEqual(tree.get('type'), 'network')
     self.assertEqual(tree.find('./source').get('protocol'), 'sheepdog')
     self.assertEqual(tree.find('./source').get('name'), self.name)
     libvirt_driver.disconnect_volume(connection_info, "vde")
 def test_libvirt_rbd_driver(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     connection_info = self.rbd_connection(self.vol)
     conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
     tree = conf.format_dom()
     self._assertNetworkAndProtocolEquals(tree)
     self.assertIsNone(tree.find('./source/auth'))
     self.assertEqual('1048576', tree.find('./iotune/total_bytes_sec').text)
     self.assertEqual('500', tree.find('./iotune/read_iops_sec').text)
     libvirt_driver.disconnect_volume(connection_info, "vde")
    def test_libvirt_rbd_driver_auth_disabled(self):
        libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
        connection_info = self.rbd_connection(self.vol)
        secret_type = 'ceph'
        connection_info['data']['auth_enabled'] = False
        connection_info['data']['auth_username'] = self.user
        connection_info['data']['secret_type'] = secret_type
        connection_info['data']['secret_uuid'] = self.uuid

        conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
        tree = conf.format_dom()
        self._assertNetworkAndProtocolEquals(tree)
        self.assertIsNone(tree.find('./auth'))
        libvirt_driver.disconnect_volume(connection_info, "vde")
 def test_libvirt_rbd_driver_hosts(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     connection_info = self.rbd_connection(self.vol)
     hosts = ['example.com', '1.2.3.4', '::1']
     ports = [None, '6790', '6791']
     connection_info['data']['hosts'] = hosts
     connection_info['data']['ports'] = ports
     conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
     tree = conf.format_dom()
     self._assertNetworkAndProtocolEquals(tree)
     self.assertIsNone(tree.find('./source/auth'))
     found_hosts = tree.findall('./source/host')
     self.assertEqual([host.get('name') for host in found_hosts], hosts)
     self.assertEqual([host.get('port') for host in found_hosts], ports)
     libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #9
0
 def test_libvirt_sheepdog_driver(self):
     libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
     name = 'volume-00000001'
     vol = {'id': 1, 'name': name}
     connection_info = self.sheepdog_connection(vol)
     disk_info = {
         "bus": "virtio",
         "dev": "vde",
         "type": "disk",
     }
     conf = libvirt_driver.connect_volume(connection_info, disk_info)
     tree = conf.format_dom()
     self.assertEqual(tree.get('type'), 'network')
     self.assertEqual(tree.find('./source').get('protocol'), 'sheepdog')
     self.assertEqual(tree.find('./source').get('name'), name)
     libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #10
0
    def test_libvirt_rbd_driver_auth_enabled_flags_override(self):
        libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
        connection_info = self.rbd_connection(self.vol)
        secret_type = 'ceph'
        connection_info['data']['auth_enabled'] = True
        connection_info['data']['auth_username'] = self.user
        connection_info['data']['secret_type'] = secret_type
        connection_info['data']['secret_uuid'] = self.uuid

        flags_uuid = '37152720-1785-11e2-a740-af0c1d8b8e4b'
        flags_user = '******'
        self.flags(rbd_user=flags_user, rbd_secret_uuid=flags_uuid)

        conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
        tree = conf.format_dom()
        self._assertNetworkAndProtocolEquals(tree)
        self.assertEqual(tree.find('./auth').get('username'), flags_user)
        self.assertEqual(tree.find('./auth/secret').get('type'), secret_type)
        self.assertEqual(tree.find('./auth/secret').get('uuid'), flags_uuid)
        libvirt_driver.disconnect_volume(connection_info, "vde")
Beispiel #11
0
    def test_libvirt_rbd_driver_auth_disabled_flags_override(self):
        libvirt_driver = volume.LibvirtNetVolumeDriver(self.fake_conn)
        connection_info = self.rbd_connection(self.vol)
        secret_type = 'ceph'
        connection_info['data']['auth_enabled'] = False
        connection_info['data']['auth_username'] = self.user
        connection_info['data']['secret_type'] = secret_type
        connection_info['data']['secret_uuid'] = self.uuid

        # NOTE: Supplying the rbd_secret_uuid will enable authentication
        # locally in nova-compute even if not enabled in nova-volume/cinder
        flags_uuid = '37152720-1785-11e2-a740-af0c1d8b8e4b'
        flags_user = '******'
        self.flags(rbd_user=flags_user, rbd_secret_uuid=flags_uuid)

        conf = libvirt_driver.connect_volume(connection_info, self.disk_info)
        tree = conf.format_dom()
        self._assertNetworkAndProtocolEquals(tree)
        self.assertEqual(tree.find('./auth').get('username'), flags_user)
        self.assertEqual(tree.find('./auth/secret').get('type'), secret_type)
        self.assertEqual(tree.find('./auth/secret').get('uuid'), flags_uuid)
        libvirt_driver.disconnect_volume(connection_info, "vde")