The nova.objects.pci_device Module

class PciDevice(*args, **kwargs)

Bases: nova.objects.base.NovaPersistentObject, nova.objects.base.NovaObject

Object to represent a PCI device on a compute node.

PCI devices are managed by the compute resource tracker, which discovers the devices from the hardware platform, claims, allocates and frees devices for instances.

The PCI device information is permanently maintained in a database. This makes it convenient to get PCI device information, like physical function for a VF device, adjacent switch IP address for a NIC, hypervisor identification for a PCI device, etc. It also provides a convenient way to check device allocation information for administrator purposes.

A device can be in available/claimed/allocated/deleted/removed state.

A device is available when it is discovered..

A device is claimed prior to being allocated to an instance. Normally the transition from claimed to allocated is quick. However, during a resize operation the transition can take longer, because devices are claimed in prep_resize and allocated in finish_resize.

A device becomes removed when hot removed from a node (i.e. not found in the next auto-discover) but not yet synced with the DB. A removed device should not be allocated to any instance, and once deleted from the DB, the device object is changed to deleted state and no longer synced with the DB.

Filed notes:

| 'dev_id':
|   Hypervisor's identification for the device, the string format
|   is hypervisor specific
| 'extra_info':
|   Device-specific properties like PF address, switch ip address etc.
VERSION = '1.5'
address
allocate(instance)
claim(instance_uuid)
compute_node_id
classmethod create(context, dev_dict)

Create a PCI device based on hypervisor information.

As the device object is just created and is not synced with db yet thus we should not reset changes here for fields from dict.

created_at
deleted
deleted_at
dev_id
dev_type
extra_info
fields = {'parent_addr': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'instance_uuid': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'status': PciDeviceStatus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('available', 'claimed', 'allocated', 'removed', 'deleted', 'unavailable', 'unclaimable')), 'dev_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'label': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'compute_node_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'vendor_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'dev_type': PciDeviceType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('type-PCI', 'type-PF', 'type-VF')), 'numa_node': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'address': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'product_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'deleted': Boolean(default=False,nullable=False), 'request_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'extra_info': Dict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
free(instance=None)
classmethod get_by_dev_addr(context, *args, **kwargs)
classmethod get_by_dev_id(context, *args, **kwargs)
id
instance_uuid
is_available()
label
numa_node
obj_make_compatible(primitive, target_version)
parent_addr
product_id
remove()
request_id
save(*args, **kwargs)
static should_migrate_data()
status
update_device(dev_dict)

Sync the content from device dictionary to device object.

The resource tracker updates the available devices periodically. To avoid meaningless syncs with the database, we update the device object only if a value changed.

updated_at
vendor_id
class PciDeviceList(*args, **kwargs)

Bases: nova.objects.base.ObjectListBase, nova.objects.base.NovaObject

VERSION = '1.3'
fields = {'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
classmethod get_by_compute_node(context, *args, **kwargs)
classmethod get_by_instance_uuid(context, *args, **kwargs)
classmethod get_by_parent_address(context, *args, **kwargs)
objects
compare_pci_device_attributes(obj_a, obj_b)

Previous topic

The nova.objects.numa Module

Next topic

The nova.objects.pci_device_pool Module

Project Source

This Page