Beispiel #1
0
 def test_translate_pci_device_timestamp(self):
     assert guestagenthelpers.translate_pci_device({
         'driver-date': 1565568000000000000,
         'driver-name': 'Red Hat VirtIO Ethernet Adapter',
         'driver-version': '100.80.104.17300',
         'id': {
             'type': 'pci',
             'device-id': 4096,
             'vendor-id': 6900,
         }
     }) == {
         'device_id': 4096,
         'driver_date': '2019-08-12',
         'driver_name': 'Red Hat VirtIO Ethernet Adapter',
         'driver_version': '100.80.104.17300',
         'vendor_id': 6900,
     }
Beispiel #2
0
 def test_translate_pci_device(self):
     self.assertEqual(
         guestagenthelpers.translate_pci_device({
             'driver-date': '2019-08-12',
             'driver-name': 'Red Hat VirtIO Ethernet Adapter',
             'driver-version': '100.80.104.17300',
             'address': {
                 'type': 'pci',
                 'data': {
                     'device-id': 4096,
                     'vendor-id': 6900,
                 }
             }
         }), {
             'device_id': 4096,
             'driver_date': '2019-08-12',
             'driver_name': 'Red Hat VirtIO Ethernet Adapter',
             'driver_version': '100.80.104.17300',
             'vendor_id': 6900,
         })
Beispiel #3
0
 def _qga_call_get_devices(self, vm):
     ret = self.call_qga_command(vm, _QEMU_DEVICES_COMMAND)
     if ret is not None:
         devices = []
         for device in ret:
             if device.get('address', {}).get('type') == 'pci':
                 d = guestagenthelpers.translate_pci_device(device)
                 # Qemu-ga returns all devices exactly like they exist in
                 # the VM. That means some devices, e.g. storage
                 # controllers, can appear several times in the list. We
                 # don't need to duplicate the info as engine knows exactly
                 # what devices and in what count are in the VM. We just
                 # care about the driver info.
                 if d not in devices:
                     devices.append(d)
             else:
                 self.log.debug('Skipping unknown device: %r', device)
         return {'pci_devices': devices}
     else:
         self.set_failure(vm.id)
         return {}