Revision 2522b7c4
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 |
... | ... | |
9665 | 9665 |
child.size = parent.size |
9666 | 9666 |
child.mode = parent.mode |
9667 | 9667 |
|
9668 |
# this is a DRBD disk, return its port to the pool |
|
9669 |
# NOTE: this must be done right before the call to cfg.Update! |
|
9670 |
for disk in old_disks: |
|
9671 |
tcp_port = disk.logical_id[2] |
|
9672 |
self.cfg.AddTcpUdpPort(tcp_port) |
|
9673 |
|
|
9668 | 9674 |
# update instance structure |
9669 | 9675 |
instance.disks = new_disks |
9670 | 9676 |
instance.disk_template = constants.DT_PLAIN |
... | ... | |
9687 | 9693 |
self.LogWarning("Could not remove metadata for disk %d on node %s," |
9688 | 9694 |
" continuing anyway: %s", idx, pnode, msg) |
9689 | 9695 |
|
9690 |
# this is a DRBD disk, return its port to the pool |
|
9691 |
for disk in old_disks: |
|
9692 |
tcp_port = disk.logical_id[2] |
|
9693 |
self.cfg.AddTcpUdpPort(tcp_port) |
|
9694 | 9696 |
|
9695 | 9697 |
def Exec(self, feedback_fn): |
9696 | 9698 |
"""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 |
... | ... | |
648 | 648 |
def AddTcpUdpPort(self, port): |
649 | 649 |
"""Adds a new port to the available port pool. |
650 | 650 |
|
651 |
@warning: this method does not "flush" the configuration (via |
|
652 |
L{_WriteConfig}); callers should do that themselves once the |
|
653 |
configuration is stable |
|
654 |
|
|
651 | 655 |
""" |
652 | 656 |
if not isinstance(port, int): |
653 | 657 |
raise errors.ProgrammerError("Invalid type passed for port") |
654 | 658 |
|
655 | 659 |
self._config_data.cluster.tcpudp_port_pool.add(port) |
656 |
self._WriteConfig() |
|
657 | 660 |
|
658 | 661 |
@locking.ssynchronized(_config_lock, shared=1) |
659 | 662 |
def GetPortList(self): |
Also available in: Unified diff