Пример #1
0
    def testPCI(self):
        """Test the placement of the first PCI device during startup."""
        self.MockOut(mock.patch('ganeti.utils.EnsureDirs'))
        hypervisor = hv_kvm.KVMHypervisor()
        dev_type = constants.HOTPLUG_TARGET_NIC
        kvm_devid = "nic-9e7c85f6-b6e5-4243"
        hv_dev_type = constants.HT_NIC_PARAVIRTUAL
        bus_slots = hypervisor._GetBusSlots()
        hvinfo = hv_kvm._GenerateDeviceHVInfo(dev_type, kvm_devid, hv_dev_type,
                                              bus_slots)
        # NOTE: The PCI slot is zero-based, i.e. 13th slot has addr hex(12)
        expected_hvinfo = {
            "driver": "virtio-net-pci",
            "id": kvm_devid,
            "bus": "pci.0",
            "addr": hex(constants.QEMU_DEFAULT_PCI_RESERVATIONS),
        }

        self.assertTrue(hvinfo == expected_hvinfo)
Пример #2
0
    def testSCSI(self):
        """Test the placement of the first SCSI device during startup."""
        self.MockOut(mock.patch('ganeti.utils.EnsureDirs'))
        hypervisor = hv_kvm.KVMHypervisor()
        dev_type = constants.HOTPLUG_TARGET_DISK
        kvm_devid = "disk-932df160-7a22-4067"
        hv_dev_type = constants.HT_DISK_SCSI_BLOCK
        bus_slots = hypervisor._GetBusSlots()
        hvinfo = hv_kvm._GenerateDeviceHVInfo(dev_type, kvm_devid, hv_dev_type,
                                              bus_slots)
        expected_hvinfo = {
            "driver": "scsi-block",
            "id": kvm_devid,
            "bus": "scsi.0",
            "channel": 0,
            "scsi-id": 0,
            "lun": 0,
        }

        self.assertTrue(hvinfo == expected_hvinfo)
  def testPCI(self):
    """Test the placement of the first PCI device during startup."""
    self.MockOut(mock.patch('ganeti.utils.EnsureDirs'))
    hypervisor = hv_kvm.KVMHypervisor()
    dev_type = constants.HOTPLUG_TARGET_NIC
    kvm_devid = "nic-9e7c85f6-b6e5-4243"
    hv_dev_type = constants.HT_NIC_PARAVIRTUAL
    bus_slots = hypervisor._GetBusSlots()
    hvinfo = hv_kvm._GenerateDeviceHVInfo(dev_type,
                                          kvm_devid,
                                          hv_dev_type,
                                          bus_slots)
    # NOTE: The PCI slot is zero-based, i.e. 13th slot has addr hex(12)
    expected_hvinfo = {
      "driver": "virtio-net-pci",
      "id": kvm_devid,
      "bus": "pci.0",
      "addr": hex(constants.QEMU_DEFAULT_PCI_RESERVATIONS),
      }

    self.assertTrue(hvinfo == expected_hvinfo)
  def testSCSI(self):
    """Test the placement of the first SCSI device during startup."""
    self.MockOut(mock.patch('ganeti.utils.EnsureDirs'))
    hypervisor = hv_kvm.KVMHypervisor()
    dev_type = constants.HOTPLUG_TARGET_DISK
    kvm_devid = "disk-932df160-7a22-4067"
    hv_dev_type = constants.HT_DISK_SCSI_BLOCK
    bus_slots = hypervisor._GetBusSlots()
    hvinfo = hv_kvm._GenerateDeviceHVInfo(dev_type,
                                          kvm_devid,
                                          hv_dev_type,
                                          bus_slots)
    expected_hvinfo = {
      "driver": "scsi-block",
      "id": kvm_devid,
      "bus": "scsi.0",
      "channel": 0,
      "scsi-id": 0,
      "lun": 0,
      }

    self.assertTrue(hvinfo == expected_hvinfo)