Revision e25625ab
b/lib/cmdlib/instance.py | ||
---|---|---|
318 | 318 |
raise errors.OpPrereqError("Unsupported OS variant", errors.ECODE_INVAL) |
319 | 319 |
|
320 | 320 |
|
321 |
def _ComputeInstanceCommunicationNIC(instance_name): |
|
322 |
"""Compute the name of the instance NIC used by instance |
|
323 |
communication. |
|
324 |
|
|
325 |
With instance communication, a new NIC is added to the instance. |
|
326 |
This NIC has a special name that identities it as being part of |
|
327 |
instance communication, and not just a normal NIC. This function |
|
328 |
generates the name of the NIC based on a prefix and the instance |
|
329 |
name |
|
330 |
|
|
331 |
@type instance_name: string |
|
332 |
@param instance_name: name of the instance the NIC belongs to |
|
333 |
|
|
334 |
@rtype: string |
|
335 |
@return: name of the NIC |
|
336 |
|
|
337 |
""" |
|
338 |
return constants.INSTANCE_COMMUNICATION_NIC_PREFIX + instance_name |
|
339 |
|
|
340 |
|
|
321 | 341 |
class LUInstanceCreate(LogicalUnit): |
322 | 342 |
"""Create an instance. |
323 | 343 |
|
... | ... | |
434 | 454 |
|
435 | 455 |
# add NIC for instance communication |
436 | 456 |
if self.op.instance_communication: |
437 |
nic_name = "%s%s" % (constants.INSTANCE_COMMUNICATION_NIC_PREFIX, |
|
438 |
self.op.instance_name) |
|
457 |
nic_name = _ComputeInstanceCommunicationNIC(self.op.instance_name) |
|
439 | 458 |
|
440 | 459 |
self.op.nics.append({constants.INIC_NAME: nic_name, |
441 | 460 |
constants.INIC_MAC: constants.VALUE_GENERATE, |
... | ... | |
2923 | 2942 |
None if nothing needs to be done |
2924 | 2943 |
|
2925 | 2944 |
""" |
2926 |
nic_name = "%s%s" % (constants.INSTANCE_COMMUNICATION_NIC_PREFIX, |
|
2927 |
instance.name) |
|
2945 |
nic_name = _ComputeInstanceCommunicationNIC(instance.name) |
|
2928 | 2946 |
|
2929 | 2947 |
instance_communication_nic = None |
2930 | 2948 |
|
Also available in: Unified diff