예제 #1
0
    def test_disk_type_from_path(self, mock_exists):
        # Seems like lvm detection
        # if its in /dev ??
        for p in ['/dev/b', '/dev/blah/blah']:
            d_type = libvirt_utils.get_disk_type_from_path(p)
            self.assertEqual('lvm', d_type)

        # Try rbd detection
        d_type = libvirt_utils.get_disk_type_from_path('rbd:pool/instance')
        self.assertEqual('rbd', d_type)

        # Try the other types
        path = '/myhome/disk.config'
        d_type = libvirt_utils.get_disk_type_from_path(path)
        self.assertIsNone(d_type)
예제 #2
0
파일: test_utils.py 프로젝트: andymcc/nova
    def test_disk_type_from_path(self, mock_exists):
        # Seems like lvm detection
        # if its in /dev ??
        for p in ['/dev/b', '/dev/blah/blah']:
            d_type = libvirt_utils.get_disk_type_from_path(p)
            self.assertEqual('lvm', d_type)

        # Try rbd detection
        d_type = libvirt_utils.get_disk_type_from_path('rbd:pool/instance')
        self.assertEqual('rbd', d_type)

        # Try the other types
        path = '/myhome/disk.config'
        d_type = libvirt_utils.get_disk_type_from_path(path)
        self.assertIsNone(d_type)
예제 #3
0
 def test_disk_type_ploop(self, mock_isdir, mock_exists):
     path = '/some/path'
     d_type = libvirt_utils.get_disk_type_from_path(path)
     mock_isdir.assert_called_once_with(path)
     mock_exists.assert_called_once_with("%s/DiskDescriptor.xml" % path)
     self.assertEqual('ploop', d_type)
예제 #4
0
 def test_disk_type_ploop(self, mock_isdir, mock_exists):
     path = '/some/path'
     d_type = libvirt_utils.get_disk_type_from_path(path)
     mock_isdir.assert_called_once_with(path)
     mock_exists.assert_called_once_with("%s/DiskDescriptor.xml" % path)
     self.assertEqual('ploop', d_type)