Revision d8dcf3c9
b/lib/cmdlib.py | ||
---|---|---|
5722 | 5722 |
args['memory'] = self.be_new[constants.BE_MEMORY] |
5723 | 5723 |
if constants.BE_VCPUS in self.be_new: |
5724 | 5724 |
args['vcpus'] = self.be_new[constants.BE_VCPUS] |
5725 |
# FIXME: readd disk/nic changes |
|
5725 |
# TODO: export disk changes. Note: _BuildInstanceHookEnv* don't export disk |
|
5726 |
# information at all. |
|
5727 |
if self.op.nics: |
|
5728 |
args['nics'] = [] |
|
5729 |
nic_override = dict(self.op.nics) |
|
5730 |
for idx, nic in enumerate(self.instance.nics): |
|
5731 |
if idx in nic_override: |
|
5732 |
this_nic_override = nic_override[idx] |
|
5733 |
else: |
|
5734 |
this_nic_override = {} |
|
5735 |
if 'ip' in this_nic_override: |
|
5736 |
ip = this_nic_override['ip'] |
|
5737 |
else: |
|
5738 |
ip = nic.ip |
|
5739 |
if 'bridge' in this_nic_override: |
|
5740 |
bridge = this_nic_override['bridge'] |
|
5741 |
else: |
|
5742 |
bridge = nic.bridge |
|
5743 |
if 'mac' in this_nic_override: |
|
5744 |
mac = this_nic_override['mac'] |
|
5745 |
else: |
|
5746 |
mac = nic.mac |
|
5747 |
args['nics'].append((ip, bridge, mac)) |
|
5748 |
if constants.DDM_ADD in nic_override: |
|
5749 |
ip = nic_override[constants.DDM_ADD].get('ip', None) |
|
5750 |
bridge = nic_override[constants.DDM_ADD]['bridge'] |
|
5751 |
mac = nic_override[constants.DDM_ADD]['mac'] |
|
5752 |
args['nics'].append((ip, bridge, mac)) |
|
5753 |
elif constants.DDM_REMOVE in nic_override: |
|
5754 |
del args['nics'][-1] |
|
5755 |
|
|
5726 | 5756 |
env = _BuildInstanceHookEnvByObject(self, self.instance, override=args) |
5727 | 5757 |
nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes) |
5728 | 5758 |
return env, nl, nl |
Also available in: Unified diff