On 12/02/2014 06:24 PM, Klaus Aehlig wrote:
On Tue, Dec 02, 2014 at 06:06:54PM +0100, Niklas Hambuechen wrote:
On 12/02/2014 03:32 PM, 'Klaus Aehlig' via ganeti-devel wrote:
When an instance is committed, the, so far forthcoming, disks
will be replaced by the actual ones. This requires AddInstanceDisk
to be able to replace existing disks. So add support for this.
Signed-off-by: Klaus Aehlig <[email protected]>
---
lib/config/__init__.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
[...]
LGTM
Following your "replaces -> replace" suggestion, I'd like to add the following
interdiff.
commit 950e615768cffea940aa4ff8cf15e8711b383f67
Author: Klaus Aehlig <[email protected]>
Date: Tue Dec 2 18:23:00 2014 +0100
Interdiff [PATCH master 04/10] Support replacing a disk in the
configuration
diff --git a/lib/config/__init__.py b/lib/config/__init__.py
index 0a7e084..2e09d6f 100644
--- a/lib/config/__init__.py
+++ b/lib/config/__init__.py
@@ -329,7 +329,7 @@ class ConfigWriter(object):
"""
return self._UnlockedGetInstanceDisks(inst_uuid)
- def _UnlockedAddDisk(self, disk, replaces=False):
+ def _UnlockedAddDisk(self, disk, replace=False):
"""Add a disk to the config.
@type disk: L{objects.Disk}
@@ -341,7 +341,7 @@ class ConfigWriter(object):
logging.info("Adding disk %s to configuration", disk.uuid)
- if replaces:
+ if replace:
self._CheckUUIDpresent(disk)
else:
self._CheckUniqueUUID(disk, include_temporary=False)
@@ -392,14 +392,14 @@ class ConfigWriter(object):
instance.mtime = time.time()
@ConfigSync()
- def AddInstanceDisk(self, inst_uuid, disk, idx=None, replaces=False):
+ def AddInstanceDisk(self, inst_uuid, disk, idx=None, replace=False):
"""Add a disk to the config and attach it to instance.
This is a simple wrapper over L{_UnlockedAddDisk} and
L{_UnlockedAttachInstanceDisk}.
"""
- self._UnlockedAddDisk(disk, replaces=replaces)
+ self._UnlockedAddDisk(disk, replace=replace)
self._UnlockedAttachInstanceDisk(inst_uuid, disk.uuid, idx)
def _UnlockedDetachInstanceDisk(self, inst_uuid, disk_uuid):
LGTM
--
Niklas Hambüchen
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores