summaryrefslogtreecommitdiff
path: root/ironic/common/network.py
diff options
context:
space:
mode:
authorEllen Hui <ellenfkh@gmail.com>2014-08-05 23:50:56 +0000
committerChris Krelle <nobodycam@gmail.com>2014-08-29 10:26:03 -0700
commitf1adedde7584d7ba5fdd37ed7ee45a0d415f2af0 (patch)
tree2624abd65f7187537ecd626b43cc8822515e1fdb /ironic/common/network.py
parent2a19ff1cf6abf9bf7a48f2182b860322ef37794e (diff)
downloadironic-f1adedde7584d7ba5fdd37ed7ee45a0d415f2af0.tar.gz
Make DHCP provider pluggable
Previously, all dhcp was done explicitly through Neutron. This commit adds an interface for dhcp providers, currently implemented by a Neutron provider and a noop provider. The provider can be set in the dhcp_provider config option, and defaults to neutron. Co-Authored-By: Jim Rollenhagen <jim@jimrollenhagen.com> Co-Authored-By: Lucas Alvares Gomes <lucasagomes@gmail.com> Implements: blueprint support-external-dhcp Closes-Bug: #1282168 Change-Id: I7eea490c573914c6cd2a73056fe3a0ec91065dc0
Diffstat (limited to 'ironic/common/network.py')
-rw-r--r--ironic/common/network.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/ironic/common/network.py b/ironic/common/network.py
new file mode 100644
index 000000000..de5597905
--- /dev/null
+++ b/ironic/common/network.py
@@ -0,0 +1,30 @@
+# Copyright 2014 Rackspace, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+def get_node_vif_ids(task):
+ """Get all VIF ids for a node.
+
+ This function does not handle multi node operations.
+
+ :param task: a TaskManager instance.
+ :returns: A dict of the Node's port UUIDs and their associated VIFs
+
+ """
+ port_vifs = {}
+ for port in task.ports:
+ vif = port.extra.get('vif_port_id')
+ if vif:
+ port_vifs[port.uuid] = vif
+ return port_vifs