summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2013-01-15 13:00:10 +1300
committerRobert Collins <robertc@robertcollins.net>2013-01-15 13:00:35 +1300
commitb6b9ca1136de4b1dbb01b059d8e954dbaf0508cb (patch)
treed1af162543dd4b960755ddc1f05a8c426e51111a /nova/virt
parentce0a7700595c57db132c2c07704c29e88a078dda (diff)
Define a hypervisor driver method for getting MAC addresses.
This lets hypervisors export the MAC addresses an instance needs to have (or return the default of None if the hypervisor is not constrained by MAC addresses). being provisioned. Change-Id: I319a8deb2d09fbf8cecb7071256cf931924ef0e9
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/driver.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py
index e396de6a0..a8f779e66 100644
--- a/nova/virt/driver.py
+++ b/nova/virt/driver.py
@@ -732,6 +732,35 @@ class ComputeDriver(object):
# related helpers.
raise NotImplementedError(self.legacy_nwinfo)
+ def macs_for_instance(self, instance):
+ """What MAC addresses must this instance have?
+
+ Some hypervisors (such as bare metal) cannot do freeform virtualisation
+ of MAC addresses. This method allows drivers to return a set of MAC
+ addresses that the instance is to have. allocate_for_instance will take
+ this into consideration when provisioning networking for the instance.
+
+ Mapping of MAC addresses to actual networks (or permitting them to be
+ freeform) is up to the network implementation layer. For instance,
+ with openflow switches, fixed MAC addresses can still be virtualised
+ onto any L2 domain, with arbitrary VLANs etc, but regular switches
+ require pre-configured MAC->network mappings that will match the
+ actual configuration.
+
+ Most hypervisors can use the default implementation which returns None.
+ Hypervisors with MAC limits should return a set of MAC addresses, which
+ will be supplied to the allocate_for_instance call by the compute
+ manager, and it is up to that call to ensure that all assigned network
+ details are compatible with the set of MAC addresses.
+
+ This is called during spawn_instance by the compute manager.
+
+ :return: None, or a set of MAC ids (e.g. set(['12:34:56:78:90:ab'])).
+ None means 'no constraints', a set means 'these and only these
+ MAC addresses'.
+ """
+ return None
+
def manage_image_cache(self, context, all_instances):
"""
Manage the driver's local image cache.