Change in vdsm[master]: VDSM hook for random network allocation during VM power on
asegurap at redhat.com
asegurap at redhat.com
Mon Oct 20 11:27:11 UTC 2014
Antoni Segura Puimedon has posted comments on this change.
Change subject: VDSM hook for random network allocation during VM power on
......................................................................
Patch Set 3:
(4 comments)
http://gerrit.ovirt.org/#/c/34114/3//COMMIT_MSG
Commit Message:
Line 13: load.
Line 14: The more VMs allocated with networks, the
Line 15: tendency of VMs to be evenly distributed among
Line 16: networks rise.
Line 17: The hook uses CustomDeciveProperties and a property
s/CustomDeciveProperties/CustomDeviceProperties/
Line 18: called 'equivnets' which is a comma separated list
Line 19: of network names. When the VM is started, a random
Line 20: network is allocated to it.
Line 21:
http://gerrit.ovirt.org/#/c/34114/3/vdsm_hooks/allocate_net/before_device_create.py
File vdsm_hooks/allocate_net/before_device_create.py:
Line 1: #!/usr/bin/python
/usr/bin/env python
Line 2: #
Line 3: # Copyright 2014 Red Hat, Inc.
Line 4: #
Line 5: # This program is free software; you can redistribute it and/or modify
Line 42:
Line 43:
Line 44: def _parse_available_nets():
Line 45: return [net.strip()
Line 46: for net in os.environ[AVAIL_NETS_KEY].split(',') if net]
I would rather have the separator be whitespace instead of ',' since ',' is a valid character for bridge names and ' ' is not.
Additionally, since this method contains 'available' in its name, I'd say it would be ideal if we were to check that a bridge with the name exists or we filter it out, as the attaching would be impossible.
Line 47:
Line 48:
Line 49: def _get_random_network():
Line 50: available_nets = _parse_available_nets()
Line 86: interface.toxml(encoding='UTF-8')
Line 87:
Line 88: allocate_random_network(interface)
Line 89: print "Interface after removing filter: %s" % \
Line 90: interface.toxml(encoding='UTF-8')
please, use print() rather than the print statement for forwards compatibility.
Line 91:
Line 92:
Line 93: def main():
Line 94: device_xml = hooking.read_domxml()
--
To view, visit http://gerrit.ovirt.org/34114
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib14c76994918750e7eef460411acc337599b0186
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list