Commit 7e219d1b authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Be aware of the degraded case when cleaning up an instance

In the case of a degraded file-based instance, the file storage directory
for that instance cannot be obtained by looking at the first disk. Use
the standard location, computed from first principles, in this case.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarHrvoje Ribicic <>
parent acd59944
......@@ -291,7 +291,15 @@ def RemoveDisks(lu, instance, target_node_uuid=None, ignore_failures=False):
CheckDiskTemplateEnabled(lu.cfg.GetClusterInfo(), instance.disk_template)
if instance.disk_template in constants.DTS_FILEBASED:
file_storage_dir = os.path.dirname(instance.disks[0].logical_id[1])
if len(instance.disks) > 0:
file_storage_dir = os.path.dirname(instance.disks[0].logical_id[1])
if instance.disk_template == constants.DT_SHARED_FILE:
file_storage_dir = utils.PathJoin(lu.cfg.GetSharedFileStorageDir(),
file_storage_dir = utils.PathJoin(lu.cfg.GetFileStorageDir(),
if target_node_uuid:
tgt = target_node_uuid
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