예제 #1
0
 def test_migrate_network_to_block(self):
     conf = drive_config(diskType=DISK_TYPE.NETWORK, path='pool/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.networkDev)
     # Migrate drive to block domain...
     drive.path = '/blockdomain/volume'
     drive.diskType = None
     self.assertTrue(drive.blockDev)
예제 #2
0
 def test_migrate_from_block_to_network(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to network disk...
     drive.path = "pool/volume"
     drive.diskType = DISK_TYPE.NETWORK
     self.assertFalse(drive.blockDev)
예제 #3
0
 def test_migrate_from_block_to_network(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to network disk...
     drive.path = "pool/volume"
     drive.diskType = DISK_TYPE.NETWORK
     self.assertFalse(drive.blockDev)
예제 #4
0
 def test_migrate_network_to_block(self):
     conf = drive_config(diskType=DISK_TYPE.NETWORK, path='pool/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.networkDev)
     # Migrate drive to block domain...
     drive.path = '/blockdomain/volume'
     drive.diskType = None
     self.assertTrue(drive.blockDev)
예제 #5
0
 def test_migrate_from_block_to_file(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to file domain...
     utils.isBlockDevice = lambda path: False
     drive.path = "/filedomain/volume"
     self.assertFalse(drive.blockDev)
예제 #6
0
 def test_migrate_from_block_to_file(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to file domain...
     utils.isBlockDevice = lambda path: False
     drive.path = "/filedomain/volume"
     self.assertFalse(drive.blockDev)
예제 #7
0
 def test_migrate_from_block_to_network(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to netowrk (not sure we will support this)...
     drive.path = "rbd:pool/volume"
     drive.volumeInfo = {'volType': 'network'}
     self.assertFalse(drive.blockDev)
예제 #8
0
 def test_migrate_from_block_to_network(self):
     conf = drive_config(path='/blockdomain/volume')
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.blockDev)
     # Migrate drive to netowrk (not sure we will support this)...
     drive.path = "rbd:pool/volume"
     drive.volumeInfo = {'volType': 'network'}
     self.assertFalse(drive.blockDev)
예제 #9
0
 def check_leases(self, conf):
     drive = Drive({}, self.log, **conf)
     leases = list(drive.getLeasesXML())
     self.assertEqual(1, len(leases))
     xml = """
     <lease>
         <key>vol_id</key>
         <lockspace>dom_id</lockspace>
         <target offset="0" path="path" />
     </lease>
     """
     self.assertXMLEqual(vmxml.format_xml(leases[0]), xml)
예제 #10
0
 def check_leases(self, conf):
     drive = Drive({}, self.log, **conf)
     leases = list(drive.getLeasesXML())
     self.assertEqual(1, len(leases))
     xml = """
     <lease>
         <key>vol_id</key>
         <lockspace>dom_id</lockspace>
         <target offset="0" path="path" />
     </lease>
     """
     self.assertXMLEqual(vmxml.format_xml(leases[0]), xml)
예제 #11
0
    def test_ide_drive(self, interface, index, expected_name):
        conf = drive_config(
            device='disk',
            iface=interface,
            index=index,
        )

        drive = Drive({}, self.log, **conf)
        self.assertEqual(drive.name, expected_name)
예제 #12
0
 def check(self, vm_conf, device_conf, xml, is_block_device=False):
     drive = Drive(vm_conf, self.log, **device_conf)
     # Patch to skip the block device checking.
     if is_block_device is not None:
         drive._blockDev = is_block_device
     self.assertXMLEqual(vmxml.format_xml(drive.getXML()), xml)
예제 #13
0
 def check_no_leases(self, conf):
     drive = Drive({}, self.log, **conf)
     leases = list(drive.getLeasesXML())
     self.assertEqual([], leases)
예제 #14
0
 def test_no_replica(self):
     conf = drive_config()
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.replicaChunked, False)
예제 #15
0
 def test_replica(self, diskType, format, chunked):
     conf = drive_config(diskReplicate=replica(diskType, format=format))
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.replicaChunked, chunked)
예제 #16
0
 def check_no_leases(self, conf):
     drive = Drive({}, self.log, **conf)
     leases = list(drive.getLeasesXML())
     self.assertEqual([], leases)
예제 #17
0
 def test_chunked(self, device, blockDev, format, chunked):
     conf = drive_config(device=device, format=format)
     drive = Drive({}, self.log, **conf)
     drive._blockDev = blockDev
     self.assertEqual(drive.chunked, chunked)
예제 #18
0
 def check(self, vm_conf, device_conf, xml, is_block_device=False):
     drive = Drive(vm_conf, self.log, **device_conf)
     # Patch to skip the block device checking.
     drive._blockDev = is_block_device
     self.assertXMLEqual(drive.getReplicaXML().toxml(), xml)
예제 #19
0
 def test_network_disk(self):
     # This is undocumented interface used by glusterfs
     conf = drive_config(volumeInfo={'volType': 'network'})
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.networkDev)
     self.assertFalse(drive.blockDev)
예제 #20
0
 def check(self, shared, expected):
     conf = drive_config()
     if shared:
         conf['shared'] = shared
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.extSharedState, expected)
예제 #21
0
 def test_max_size(self):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     size = utils.round(self.CAPACITY * drive.VOLWM_COW_OVERHEAD,
                        constants.MEGAB)
     self.assertEqual(drive.getMaxVolumeSize(self.CAPACITY), size)
예제 #22
0
 def test_next_size_limit(self, cursize):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.getNextVolumeSize(cursize, self.CAPACITY),
                      drive.getMaxVolumeSize(self.CAPACITY))
예제 #23
0
 def test_next_size(self, cursize):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.getNextVolumeSize(cursize, self.CAPACITY),
                      cursize + drive.volExtensionChunk)
예제 #24
0
 def test_chunked(self, device, blockDev, format, chunked):
     conf = drive_config(device=device, format=format)
     drive = Drive({}, self.log, **conf)
     drive._blockDev = blockDev
     self.assertEqual(drive.chunked, chunked)
예제 #25
0
 def check(self, vm_conf, device_conf, xml, is_block_device=False):
     drive = Drive(vm_conf, self.log, **device_conf)
     # Patch to skip the block device checking.
     drive._blockDev = is_block_device
     self.assertXMLEqual(drive.getXML().toxml(), xml)
예제 #26
0
 def check(self, **kw):
     conf = drive_config(**kw)
     drive = Drive({}, self.log, **conf)
     self.assertRaises(ValueError, drive.getXML)
예제 #27
0
 def test_floppy(self):
     conf = drive_config(device='floppy')
     drive = Drive({}, self.log, **conf)
     self.assertFalse(drive.networkDev)
     self.assertFalse(drive.blockDev)
예제 #28
0
 def test_network_disk(self):
     conf = drive_config(diskType=DISK_TYPE.NETWORK)
     drive = Drive({}, self.log, **conf)
     self.assertTrue(drive.networkDev)
     self.assertFalse(drive.blockDev)
예제 #29
0
 def test_file_disk(self):
     conf = drive_config(device='disk')
     drive = Drive({}, self.log, **conf)
     self.assertFalse(drive.networkDev)
     self.assertFalse(drive.blockDev)
예제 #30
0
 def test_next_size_limit(self, cursize):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.getNextVolumeSize(cursize, self.CAPACITY),
                      drive.getMaxVolumeSize(self.CAPACITY))
예제 #31
0
 def check(self, vm_conf, device_conf, xml, is_block_device=False):
     drive = Drive(vm_conf, self.log, **device_conf)
     # Patch to skip the block device checking.
     if is_block_device is not None:
         drive._blockDev = is_block_device
     self.assertXMLEqual(vmxml.format_xml(drive.getXML()), xml)
예제 #32
0
 def test_replica(self, diskType, format):
     conf = drive_config(diskReplicate=replica(diskType, format=format))
     drive = Drive({}, self.log, **conf)
     drive._blockDev = False
     self.assertEqual(drive.chunked, False)
예제 #33
0
 def test_next_size(self, cursize):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.getNextVolumeSize(cursize, self.CAPACITY),
                      cursize + drive.volExtensionChunk)
예제 #34
0
 def test_replica(self, diskType, format):
     conf = drive_config(diskReplicate=replica(diskType, format=format))
     drive = Drive({}, self.log, **conf)
     drive._blockDev = False
     self.assertEqual(drive.chunked, False)
예제 #35
0
 def test_max_size(self):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     size = utils.round(self.CAPACITY * drive.VOLWM_COW_OVERHEAD,
                        constants.MEGAB)
     self.assertEqual(drive.getMaxVolumeSize(self.CAPACITY), size)
예제 #36
0
 def test_capacity_limit(self, cursize):
     conf = drive_config(format='cow')
     drive = Drive({}, self.log, **conf)
     self.assertEqual(drive.getNextVolumeSize(cursize, self.CAPACITY),
                      self.CAPACITY / constants.MEGAB)