示例#1
0
文件: test_disco.py 项目: zsvic/nova
 def test_libvirt_disco_driver_disconnect(self):
     dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
     dcon.connector.disconnect_volume = mock.MagicMock()
     conn = {'data': mock.sentinel.conn_data}
     dcon.disconnect_volume(conn, mock.sentinel.instance)
     dcon.connector.disconnect_volume.assert_called_once_with(
         mock.sentinel.conn_data, None)
示例#2
0
    def test_libvirt_disco_driver_get_config(self):
        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)

        conn = {'data': {'device_path': '/dev/dms1234567'}}
        conf = dcon.get_config(conn, self.disk_info)
        self.assertEqual('file', conf.source_type)
        self.assertEqual('/dev/dms1234567', conf.source_path)
        self.assertEqual('disco', conf.source_protocol)
示例#3
0
文件: test_disco.py 项目: zsvic/nova
    def test_libvirt_disco_driver_get_config(self):
        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)

        disk_info = {'path': '/dev/dms1234567', 'name': 'aDiscoVolume',
                     'type': 'raw', 'dev': 'vda1', 'bus': 'pci0',
                     'device_path': '/dev/dms1234567'}
        conn = {'data': disk_info}
        conf = dcon.get_config(conn, disk_info)
        self.assertEqual('file', conf.source_type)
        self.assertEqual('/dev/dms1234567', conf.source_path)
        self.assertEqual('disco', conf.source_protocol)
示例#4
0
文件: test_disco.py 项目: zsvic/nova
 def test_libvirt_disco_driver_connect(self):
     dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
     conf = {'server_ip': '127.0.0.1', 'server_port': 9898}
     disk_info = {'disco_id': '1234567',
                  'name': 'aDiscoVolume',
                  'conf': conf}
     conn = {'data': disk_info}
     with mock.patch.object(dcon.connector,
                            'connect_volume',
                            return_value={'path': '/dev/dms1234567'}):
         dcon.connect_volume(conn, mock.sentinel.instance)
         self.assertEqual('/dev/dms1234567',
                          conn['data']['device_path'])
示例#5
0
 def test_libvirt_disco_driver_disconnect(self):
     dcon = disco.LibvirtDISCOVolumeDriver(self.fake_conn)
     dcon.connector.disconnect_volume = mock.MagicMock()
     disk_info = {
         'path': '/dev/dms1234567',
         'name': 'aDiscoVolume',
         'type': 'raw',
         'dev': 'vda1',
         'bus': 'pci0',
         'device_path': '/dev/dms123456'
     }
     conn = {'data': disk_info}
     dcon.disconnect_volume(conn, disk_info)
     dcon.connector.disconnect_volume.assert_called_once_with(
         disk_info, None)
示例#6
0
 def test_libvirt_disco_driver(self):
     libvirt_driver = disco.LibvirtDISCOVolumeDriver(self.fake_conn)
     self.assertIsInstance(libvirt_driver.connector,
                           connector.DISCOConnector)