Implement SR-IOV PF and VF instances
Adds support for the node daemon managing SR-IOV PF and VF instances. PFs are added to Zookeeper automatically based on the config at startup during network configuration, and are otherwise completely static. PFs are automatically removed from Zookeeper, along with all coresponding VFs, should the PF phy device be removed from the configuration. VFs are configured based on the (autocreated) VFs of each PF device, added to Zookeeper, and then a new class instance, SRIOVVFInstance, is used to watch them for configuration changes. This will enable the runtime management of VF settings by the API. The set of keys ensures that both configuration and details of the NIC can be tracked. Most keys are self-explanatory, especially for PFs and the basic keys for VFs. The configuration tree is also self-explanatory, being based entirely on the options available in the `ip link set {dev} vf` command. Two additional keys are also present: `used` and `used_by`, which will be able to track the (boolean) state of usage, as well as the VM that uses a given VIF. Since the VM side implementation will support both macvtap and direct "hostdev" assignments, this will ensure that this state can be tracked on both the VF and the VM side.
This commit is contained in:
@ -426,7 +426,7 @@ class ZKHandler(object):
|
||||
#
|
||||
class ZKSchema(object):
|
||||
# Current version
|
||||
_version = 0
|
||||
_version = 1
|
||||
|
||||
# Root for doing nested keys
|
||||
_schema_root = ''
|
||||
@ -483,7 +483,34 @@ class ZKSchema(object):
|
||||
'memory.provisioned': '/memprov',
|
||||
'ipmi.hostname': '/ipmihostname',
|
||||
'ipmi.username': '/ipmiusername',
|
||||
'ipmi.password': '/ipmipassword'
|
||||
'ipmi.password': '/ipmipassword',
|
||||
'sriov': '/sriov',
|
||||
'sriov.pf': '/sriov/pf',
|
||||
'sriov.vf': '/sriov/vf',
|
||||
},
|
||||
# The schema of an individual SR-IOV PF entry (/nodes/{node_name}/sriov/pf/{pf})
|
||||
'sriov_pf': {
|
||||
'phy': '', # The root key
|
||||
'mtu': '/mtu',
|
||||
'vfcount': '/vfcount'
|
||||
},
|
||||
# The schema of an individual SR-IOV VF entry (/nodes/{node_name}/sriov/vf/{vf})
|
||||
'sriov_vf': {
|
||||
'phy': '', # The root key
|
||||
'pf': '/pf',
|
||||
'mtu': '/mtu',
|
||||
'mac': '/mac',
|
||||
'config': '/config',
|
||||
'config.vlan_id': '/config/vlan_id',
|
||||
'config.vlan_qos': '/config/vlan_qos',
|
||||
'config.tx_rate_min': '/config/tx_rate_min',
|
||||
'config.tx_rate_max': '/config/tx_rate_max',
|
||||
'config.spoof_check': '/config/spoof_check',
|
||||
'config.link_state': '/config/link_state',
|
||||
'config.trust': '/config/trust',
|
||||
'config.query_rss': '/config/query_rss',
|
||||
'used': '/used',
|
||||
'used_by': '/used_by'
|
||||
},
|
||||
# The schema of an individual domain entry (/domains/{domain_uuid})
|
||||
'domain': {
|
||||
@ -709,6 +736,10 @@ class ZKSchema(object):
|
||||
if not zkhandler.zk_conn.exists(nkipath):
|
||||
result = False
|
||||
|
||||
# One might expect child keys under node (specifically, sriov.pf and sriov.vf) to be
|
||||
# managed here as well, but those are created automatically every time pvcnoded starts
|
||||
# and thus never need to be validated or applied.
|
||||
|
||||
# These two have several children layers that must be parsed through
|
||||
for elem in ['volume']:
|
||||
# First read all the subelements of the key class (pool layer)
|
||||
@ -782,6 +813,10 @@ class ZKSchema(object):
|
||||
if not zkhandler.zk_conn.exists(nkipath):
|
||||
zkhandler.zk_conn.create(nkipath, ''.encode(zkhandler.encoding))
|
||||
|
||||
# One might expect child keys under node (specifically, sriov.pf and sriov.vf) to be
|
||||
# managed here as well, but those are created automatically every time pvcnoded starts
|
||||
# and thus never need to be validated or applied.
|
||||
|
||||
# These two have several children layers that must be parsed through
|
||||
for elem in ['volume']:
|
||||
# First read all the subelements of the key class (pool layer)
|
||||
|
Reference in New Issue
Block a user