Commit 9e14897d authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Preserve disk basename on instance rename

For file-based instances, upon rename, the directory containing
the instance disks is moved. Therefore, the basename needs to
be preserved in this case. Fix this. Note that so far, this
worked by accident as before 94e252a3

 file names used to be
"disk" followed by the index.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarHrvoje Ribicic <>
parent 2a199cbb
......@@ -1569,13 +1569,13 @@ class ConfigWriter:
inst = self._config_data.instances[inst_uuid] = new_name
for (idx, disk) in enumerate(inst.disks):
for (_, disk) in enumerate(inst.disks):
if disk.dev_type in [constants.DT_FILE, constants.DT_SHARED_FILE]:
# rename the file paths in logical and physical id
file_storage_dir = os.path.dirname(os.path.dirname(disk.logical_id[1]))
disk.logical_id = (disk.logical_id[0],
"disk%s" % idx))
disk.physical_id = disk.logical_id
# Force update of ssconf files
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment