Ejemplo n.º 1
0
 def test_find_allocated_slots(self):
     disk1 = fake.VirtualDisk(200, 0)
     disk2 = fake.VirtualDisk(200, 1)
     disk3 = fake.VirtualDisk(201, 1)
     ide0 = fake.VirtualIDEController(200)
     ide1 = fake.VirtualIDEController(201)
     scsi0 = fake.VirtualLsiLogicController(key=1000, scsiCtlrUnitNumber=7)
     devices = [disk1, disk2, disk3, ide0, ide1, scsi0]
     taken = vm_util._find_allocated_slots(devices)
     self.assertEqual([0, 1], sorted(taken[200]))
     self.assertEqual([1], taken[201])
     self.assertEqual([7], taken[1000])
Ejemplo n.º 2
0
 def test_allocate_controller_key_and_unit_number_scsi(self):
     # Test that we allocate on existing SCSI controller if there is a free
     # slot on it
     devices = [fake.VirtualLsiLogicController(1000, scsiCtlrUnitNumber=7)]
     for unit_number in range(7):
         disk = fake.VirtualDisk(1000, unit_number)
         devices.append(disk)
     factory = fake.FakeFactory()
     (controller_key, unit_number,
      controller_spec) = vm_util.allocate_controller_key_and_unit_number(
          factory, devices, 'lsiLogic')
     self.assertEqual(1000, controller_key)
     self.assertEqual(8, unit_number)
     self.assertIsNone(controller_spec)