Dan Yasny has posted comments on this change.
Change subject: Cisco VM-FEX support vdsm hooks
......................................................................
Patch Set 5: (8 inline comments)
....................................................
File vdsm_hooks/vmfex/before_vm_start.py
Line 82:
Line 83:
Line 84: def getUsableNics():
Line 85: # Scan localhost for physical NICs and return list of physical nics
Line 86: # that have all zeroes MAC
Done
Line 87: # Example ['eth0','eth1']
Line 88: #TODO: switch to glob in the future
Line 89: nics = []
Line 90: cmd = "find /sys/devices/pci* | grep '/net/' |grep address"
Line 84: def getUsableNics():
Line 85: # Scan localhost for physical NICs and return list of physical nics
Line 86: # that have all zeroes MAC
Line 87: # Example ['eth0','eth1']
Line 88: #TODO: switch to glob in the future
glob fails, but I used os.walk() and it seems to not only be working, but also
faster than glob.glob
Line 89: nics = []
Line 90: cmd = "find /sys/devices/pci* | grep '/net/' |grep address"
Line 91: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
Line 92: for nic in p.stdout.read().split():
Line 104: <name>direct-pool</name>
Line 105: <forward mode="passthrough">
Line 106: '''
Line 107: for i in getUsableNics():
Line 108: xmlstr += '<interface dev="' + str(i) + '"/> \n'
Done
Line 109:
Line 110: xmlstr += ' </forward> \n </network> '
Line 111: conn.networkDefineXML(xmlstr)
Line 112: dpool = conn.networkLookupByName('direct-pool')
Line 107: for i in getUsableNics():
Line 108: xmlstr += '<interface dev="' + str(i) + '"/> \n'
Line 109:
Line 110: xmlstr += ' </forward> \n </network> '
Line 111: conn.networkDefineXML(xmlstr)
If the pool exists and there are other VMs already running, we will not enter
this function
Line 112: dpool = conn.networkLookupByName('direct-pool')
Line 113: dpool.setAutostart(1)
Line 114: dpool.create()
Line 115: sys.stderr.write('vmfex: creating Direct-Pool Network \n')
Line 123: fcntl.flock(f.fileno(), fcntl.LOCK_EX)
Line 124: try:
Line 125: dpool = conn.networkLookupByName('direct-pool')
Line 126: dpool.destroy()
Line 127: dpool.undefine()
as above - If the pool exists and there are other VMs already running, we will
not enter this function
Line 128: sys.stderr.write('vmfex: removing direct-pool \n')
Line 129: finally:
Line 130: fcntl.flock(f.fileno(), fcntl.LOCK_UN)
Line 131:
Line 134: for vm in conn.listDomainsID():
Line 135: domxml = minidom.parseString(conn.lookupByID(vm).XMLDesc(0))
Line 136: for interface in domxml.getElementsByTagName('interface'):
Line 137: for attr in interface.getElementsByTagName('virtualport'):
Line 138: if attr.attributes.items()[0][1] == '802.1Qbh':
Done
Line 139: return True
Line 140: return False
Line 141:
Line 142:
Line 155:
Line 156:
Line 157: def handleDirectPool(conn):
Line 158: #TODO: take this part and everything it uses out and into a
separate
Line 159: # package
Done
Line 160:
Line 161: #is direct-pool defined?
Line 162: if 'direct-pool' in conn.listNetworks():
Line 163: #are there VMs running?
Line 157: def handleDirectPool(conn):
Line 158: #TODO: take this part and everything it uses out and into a
separate
Line 159: # package
Line 160:
Line 161: #is direct-pool defined?
Done
Line 162: if 'direct-pool' in conn.listNetworks():
Line 163: #are there VMs running?
Line 164: if conn.listDomainsID():
Line 165: #does any of the running VMs havd a Qbh nic?
--
To view, visit http://gerrit.ovirt.org/7547
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I45a7fa46919bb39a648dff190c40618395990e91
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Yasny <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Dan Yasny <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Igor Lvovsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches