From b6b9ca1136de4b1dbb01b059d8e954dbaf0508cb Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 15 Jan 2013 13:00:10 +1300 Subject: 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 --- nova/virt/driver.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'nova/virt') 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. -- cgit