Revision e40aebc9 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
12775 | 12775 |
" in cluster" % mac, |
12776 | 12776 |
errors.ECODE_NOTUNIQUE) |
12777 | 12777 |
elif new_net != old_net: |
12778 |
|
|
12778 | 12779 |
def get_net_prefix(net): |
12779 | 12780 |
if net: |
12780 | 12781 |
uuid = self.cfg.LookupNetwork(net) |
... | ... | |
12782 | 12783 |
nobj = self.cfg.GetNetwork(uuid) |
12783 | 12784 |
return nobj.mac_prefix |
12784 | 12785 |
return None |
12786 |
|
|
12785 | 12787 |
new_prefix = get_net_prefix(new_net) |
12786 | 12788 |
old_prefix = get_net_prefix(old_net) |
12787 | 12789 |
if old_prefix != new_prefix: |
... | ... | |
12812 | 12814 |
errors.ECODE_NOTUNIQUE) |
12813 | 12815 |
elif new_ip.lower() == constants.NIC_IP_POOL: |
12814 | 12816 |
raise errors.OpPrereqError("ip=pool, but no network found", |
12815 |
ECODEE_INVAL)
|
|
12817 |
errors.ECODE_INVAL)
|
|
12816 | 12818 |
else: |
12817 | 12819 |
# new net is None |
12818 | 12820 |
if self.op.conflicts_check: |
... | ... | |
13079 | 13081 |
nic.nicparams, cluster, pnode) |
13080 | 13082 |
return None |
13081 | 13083 |
|
13082 |
def _PrepareNicRemove(_, params, private):
|
|
13084 |
def _PrepareNicRemove(_, params, __):
|
|
13083 | 13085 |
ip = params.ip |
13084 | 13086 |
net = params.network |
13085 | 13087 |
if net is not None and ip is not None: |
... | ... | |
13305 | 13307 |
""" |
13306 | 13308 |
mac = params[constants.INIC_MAC] |
13307 | 13309 |
ip = params.get(constants.INIC_IP, None) |
13308 |
network = params.get(constants.INIC_NETWORK, None)
|
|
13310 |
net = params.get(constants.INIC_NETWORK, None) |
|
13309 | 13311 |
#TODO: not private.filled?? can a nic have no nicparams?? |
13310 | 13312 |
nicparams = private.filled |
13311 | 13313 |
|
13312 |
return (objects.NIC(mac=mac, ip=ip, network=network, nicparams=nicparams), [
|
|
13314 |
return (objects.NIC(mac=mac, ip=ip, network=net, nicparams=nicparams), [ |
|
13313 | 13315 |
("nic.%d" % idx, |
13314 | 13316 |
"add:mac=%s,ip=%s,mode=%s,link=%s,network=%s" % |
13315 | 13317 |
(mac, ip, private.filled[constants.NIC_MODE], |
13316 | 13318 |
private.filled[constants.NIC_LINK], |
13317 |
network)),
|
|
13319 |
net)), |
|
13318 | 13320 |
]) |
13319 | 13321 |
|
13320 | 13322 |
@staticmethod |
Also available in: Unified diff