Revision 295728df
b/lib/cmdlib.py | ||
---|---|---|
4434 | 4434 |
raise errors.OpPrereqError("Cluster does not support lvm-based" |
4435 | 4435 |
" instances") |
4436 | 4436 |
|
4437 |
|
|
4438 | 4437 |
if self.op.mode == constants.INSTANCE_IMPORT: |
4439 | 4438 |
src_node = self.op.src_node |
4440 | 4439 |
src_path = self.op.src_path |
... | ... | |
4500 | 4499 |
nic_mac_ini = 'nic%d_mac' % idx |
4501 | 4500 |
nic.mac = export_info.get(constants.INISECT_INS, nic_mac_ini) |
4502 | 4501 |
|
4502 |
# ENDIF: self.op.mode == constants.INSTANCE_IMPORT |
|
4503 | 4503 |
# ip ping checks (we use the same ip that was resolved in ExpandNames) |
4504 | 4504 |
if self.op.start and not self.op.ip_check: |
4505 | 4505 |
raise errors.OpPrereqError("Cannot ignore IP address conflicts when" |
... | ... | |
4510 | 4510 |
raise errors.OpPrereqError("IP %s of instance %s already in use" % |
4511 | 4511 |
(self.check_ip, self.op.instance_name)) |
4512 | 4512 |
|
4513 |
#### mac address generation |
|
4514 |
# By generating here the mac address both the allocator and the hooks get |
|
4515 |
# the real final mac address rather than the 'auto' or 'generate' value. |
|
4516 |
# There is a race condition between the generation and the instance object |
|
4517 |
# creation, which means that we know the mac is valid now, but we're not |
|
4518 |
# sure it will be when we actually add the instance. If things go bad |
|
4519 |
# adding the instance will abort because of a duplicate mac, and the |
|
4520 |
# creation job will fail. |
|
4521 |
for nic in self.nics: |
|
4522 |
if nic.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE): |
|
4523 |
nic.mac = self.cfg.GenerateMAC() |
|
4524 |
|
|
4513 | 4525 |
#### allocator run |
4514 | 4526 |
|
4515 | 4527 |
if self.op.iallocator is not None: |
... | ... | |
4599 | 4611 |
instance = self.op.instance_name |
4600 | 4612 |
pnode_name = self.pnode.name |
4601 | 4613 |
|
4602 |
for nic in self.nics: |
|
4603 |
if nic.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE): |
|
4604 |
nic.mac = self.cfg.GenerateMAC() |
|
4605 |
|
|
4606 | 4614 |
ht_kind = self.op.hypervisor |
4607 | 4615 |
if ht_kind in constants.HTS_REQ_PORT: |
4608 | 4616 |
network_port = self.cfg.AllocatePort() |
Also available in: Unified diff