Example #1
0
    def test_get_root_info_no_bdm(self, mock_get_bus, mock_find_dev):
        image_meta = {}
        blockinfo.get_root_info('kvm', image_meta, None, 'virtio', 'ide')
        mock_find_dev.assert_called_once_with({}, 'virtio')

        blockinfo.get_root_info('kvm', image_meta, None, 'virtio', 'ide',
                                 root_device_name='/dev/vda')
        mock_get_bus.assert_called_once_with('kvm', '/dev/vda')
Example #2
0
    def test_get_root_info_no_bdm(self, mock_get_bus, mock_find_dev):
        image_meta = {}
        blockinfo.get_root_info('kvm', image_meta, None, 'virtio', 'ide')
        mock_find_dev.assert_called_once_with({}, 'virtio')

        blockinfo.get_root_info('kvm',
                                image_meta,
                                None,
                                'virtio',
                                'ide',
                                root_device_name='/dev/vda')
        mock_get_bus.assert_called_once_with('kvm', '/dev/vda')
Example #3
0
 def test_get_root_info_bdm(self, mock_get_info):
     image_meta = {}
     root_bdm = {
         'mount_device': '/dev/vda',
         'disk_bus': 'scsi',
         'device_type': 'disk'
     }
     # No root_device_name
     blockinfo.get_root_info('kvm', image_meta, root_bdm, 'virtio', 'ide')
     mock_get_info.assert_called_once_with('kvm', image_meta, root_bdm, {},
                                           'virtio')
     mock_get_info.reset_mock()
     # Both device names
     blockinfo.get_root_info('kvm',
                             image_meta,
                             root_bdm,
                             'virtio',
                             'ide',
                             root_device_name='sda')
     mock_get_info.assert_called_once_with('kvm', image_meta, root_bdm, {},
                                           'virtio')
     mock_get_info.reset_mock()
     # Missing device names
     del root_bdm['mount_device']
     blockinfo.get_root_info('kvm',
                             image_meta,
                             root_bdm,
                             'virtio',
                             'ide',
                             root_device_name='sda')
     mock_get_info.assert_called_once_with('kvm', image_meta, {
         'device_name': 'sda',
         'disk_bus': 'scsi',
         'device_type': 'disk'
     }, {}, 'virtio')
Example #4
0
 def test_get_root_info_bdm(self, mock_get_info):
     image_meta = {}
     root_bdm = {'mount_device': '/dev/vda',
                 'disk_bus': 'scsi',
                 'device_type': 'disk'}
     # No root_device_name
     blockinfo.get_root_info('kvm', image_meta, root_bdm, 'virtio', 'ide')
     mock_get_info.assert_called_once_with('kvm', image_meta,
                                           root_bdm, {}, 'virtio')
     mock_get_info.reset_mock()
     # Both device names
     blockinfo.get_root_info('kvm', image_meta, root_bdm, 'virtio', 'ide',
                             root_device_name='sda')
     mock_get_info.assert_called_once_with('kvm', image_meta,
                                           root_bdm, {}, 'virtio')
     mock_get_info.reset_mock()
     # Missing device names
     del root_bdm['mount_device']
     blockinfo.get_root_info('kvm', image_meta, root_bdm, 'virtio', 'ide',
                             root_device_name='sda')
     mock_get_info.assert_called_once_with('kvm',
                                           image_meta,
                                           {'device_name': 'sda',
                                            'disk_bus': 'scsi',
                                            'device_type': 'disk'},
                                           {}, 'virtio')