Revision 3b3b1bca
b/lib/cmdlib.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
11132 | 11132 |
child.size = parent.size |
11133 | 11133 |
child.mode = parent.mode |
11134 | 11134 |
|
11135 |
# this is a DRBD disk, return its port to the pool |
|
11136 |
# NOTE: this must be done right before the call to cfg.Update! |
|
11137 |
for disk in old_disks: |
|
11138 |
tcp_port = disk.logical_id[2] |
|
11139 |
self.cfg.AddTcpUdpPort(tcp_port) |
|
11140 |
|
|
11135 | 11141 |
# update instance structure |
11136 | 11142 |
instance.disks = new_disks |
11137 | 11143 |
instance.disk_template = constants.DT_PLAIN |
... | ... | |
11154 | 11160 |
self.LogWarning("Could not remove metadata for disk %d on node %s," |
11155 | 11161 |
" continuing anyway: %s", idx, pnode, msg) |
11156 | 11162 |
|
11157 |
# this is a DRBD disk, return its port to the pool |
|
11158 |
for disk in old_disks: |
|
11159 |
tcp_port = disk.logical_id[2] |
|
11160 |
self.cfg.AddTcpUdpPort(tcp_port) |
|
11161 | 11163 |
|
11162 | 11164 |
def Exec(self, feedback_fn): |
11163 | 11165 |
"""Modifies an instance. |
b/lib/config.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
654 | 654 |
def AddTcpUdpPort(self, port): |
655 | 655 |
"""Adds a new port to the available port pool. |
656 | 656 |
|
657 |
@warning: this method does not "flush" the configuration (via |
|
658 |
L{_WriteConfig}); callers should do that themselves once the |
|
659 |
configuration is stable |
|
660 |
|
|
657 | 661 |
""" |
658 | 662 |
if not isinstance(port, int): |
659 | 663 |
raise errors.ProgrammerError("Invalid type passed for port") |
660 | 664 |
|
661 | 665 |
self._config_data.cluster.tcpudp_port_pool.add(port) |
662 |
self._WriteConfig() |
|
663 | 666 |
|
664 | 667 |
@locking.ssynchronized(_config_lock, shared=1) |
665 | 668 |
def GetPortList(self): |
Also available in: Unified diff