diff --git a/lib/config.py b/lib/config.py index a639fd8782ec4b2b8986ef3c8d69fbf200e056fe..86b98fc5602b4f9a59d3f268f229c026a881694f 100644 --- a/lib/config.py +++ b/lib/config.py @@ -942,6 +942,16 @@ class ConfigWriter: if check_uuid: self._EnsureUUID(group, ec_id) + try: + existing_uuid = self._UnlockedLookupNodeGroup(group.name) + except errors.OpPrereqError: + pass + else: + raise errors.OpPrereqError("Desired group name '%s' already exists as a" + " node group (UUID: %s)" % + (group.name, existing_uuid), + errors.ECODE_EXISTS) + group.serial_no = 1 group.ctime = group.mtime = time.time() group.UpgradeConfig()