Commit bc89efc3 authored by Guido Trotter's avatar Guido Trotter
Browse files

LUCreateInstance: reuse mac address on import

When importing an instance with the same name as the exported one if the
mac address is "auto" we try to reuse the previous mac address. One can
still force generation of a new one with mac="generate".

Forward-port-of: r1887, Reviewed-by: iustinp

Reviewed-by: imsnah
parent c78995f0
......@@ -3491,6 +3491,14 @@ class LUCreateInstance(LogicalUnit):
'disk0_dump'))
self.src_image = diskimage
if self.op.mac == constants.VALUE_AUTO:
old_name = export_info.get(constants.INISECT_INS, 'name')
if self.op.instance_name == old_name:
# FIXME: adjust every nic, when we'll be able to create instances
# with more than one
if int(export_info.get(constants.INISECT_INS, 'nic_count')) >= 1:
self.op.mac = export_info.get(constants.INISECT_INS, 'nic_0_mac')
# ip ping checks (we use the same ip that was resolved in ExpandNames)
if self.op.start and not self.op.ip_check:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment