summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-04 21:23:25 +0000
committerGerrit Code Review <review@openstack.org>2013-04-04 21:23:25 +0000
commitaa81b755287d68b77593371ef24b3d09dbe35ff8 (patch)
tree6aefaaa5cb319322c18be61d878f6c54fba1a1d1 /nova/virt
parentbe5219753183f7378245178817373c3562e20e84 (diff)
parent2a43c4020927c936ed3b3f07416413f5171d62f8 (diff)
Merge "Resolve conflicting mac address in resize"
Diffstat (limited to 'nova/virt')
-rwxr-xr-xnova/virt/powervm/driver.py18
-rw-r--r--nova/virt/powervm/operator.py14
2 files changed, 32 insertions, 0 deletions
diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py
index c193111c8..603ee0b61 100755
--- a/nova/virt/powervm/driver.py
+++ b/nova/virt/powervm/driver.py
@@ -240,6 +240,16 @@ class PowerVMDriver(driver.ComputeDriver):
diskname = pvm_op.get_disk_name_by_vhost(vhost)
self._powervm.power_off(instance['name'], timeout=120)
+ # NOTE(ldbragst) Here we need to check if the resize or migrate is
+ # happening on the same host. If yes, then we need to assign a temp
+ # mac address to the source LPAR so we don't have a conflict when
+ # another LPAR is booted with the same mac address as the
+ # original LPAR
+ if src_host == dest:
+ macs = self.macs_for_instance(instance)
+ temp_mac = macs.pop()
+ self._powervm._operator.set_lpar_mac_base_value(instance['name'],
+ temp_mac)
disk_info = self._powervm.migrate_disk(
diskname, src_host, dest, CONF.powervm_img_remote_path,
@@ -307,6 +317,14 @@ class PowerVMDriver(driver.ComputeDriver):
new_name = self._get_resize_name(instance['name'])
+ # NOTE(ldbragst) In the case of a resize_revert on the same host
+ # we reassign the original mac address, replacing the temp mac
+ # on the old instance that will be started
+ if (self._powervm.instance_exists(new_name) and
+ self._powervm.instance_exists(instance['name'])):
+ original_mac = network_info[0]['address']
+ self._powervm._operator.set_lpar_mac_base_value(instance['name'],
+ original_mac)
# Make sure we don't have a failed same-host migration still
# hanging around
if self.instance_exists(new_name):
diff --git a/nova/virt/powervm/operator.py b/nova/virt/powervm/operator.py
index 059935652..13012b700 100644
--- a/nova/virt/powervm/operator.py
+++ b/nova/virt/powervm/operator.py
@@ -761,6 +761,20 @@ class BaseOperator(object):
command = 'rm %s' % file_path
self.run_vios_command_as_root(command)
+ def set_lpar_mac_base_value(self, instance_name, mac):
+ """Set LPAR's property virtual_eth_mac_base_value
+
+ :param instance_name: name of the instance to be set
+ :param mac: mac of virtual ethernet
+ """
+ # NOTE(ldbragst) We only use the base mac value because the last
+ # byte is the slot id of the virtual NIC, which doesn't change.
+ mac_base_value = mac[:-2].replace(':', '')
+ cmd = ' '.join(['chsyscfg -r lpar -i',
+ '"name=%s,' % instance_name,
+ 'virtual_eth_mac_base_value=%s"' % mac_base_value])
+ self.run_vios_command(cmd)
+
class IVMOperator(BaseOperator):
"""Integrated Virtualization Manager (IVM) Operator.