コード例 #1
0
    def test_find_disk_dev(self):
        mapping = {
            "disk.local": {
                'dev': 'sda',
                'bus': 'scsi',
                'type': 'disk',
                },
            "disk.swap": {
                'dev': 'sdc',
                'bus': 'scsi',
                'type': 'disk',
                },
            }

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, 'scsi')
        self.assertEqual(dev, 'sdb')

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, 'scsi',
                                                   last_device=True)
        self.assertEqual(dev, 'sdz')

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, 'virtio')
        self.assertEqual(dev, 'vda')

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, 'fdc')
        self.assertEqual(dev, 'fda')
コード例 #2
0
    def test_find_disk_dev(self):
        mapping = {
            "disk.local": {"dev": "sda", "bus": "scsi", "type": "disk"},
            "disk.swap": {"dev": "sdc", "bus": "scsi", "type": "disk"},
        }

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, "scsi")
        self.assertEqual(dev, "sdb")

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, "scsi", last_device=True)
        self.assertEqual(dev, "sdz")

        dev = blockinfo.find_disk_dev_for_disk_bus(mapping, "virtio")
        self.assertEqual(dev, "vda")