From 3a15b49796dddba4f0c318575c6aa8cbd6639310 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 29 Apr 2019 14:10:54 +0300 Subject: [PATCH] Fix image clone/add logs --- storages/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/storages/views.py b/storages/views.py index ea14f5f..d128de2 100644 --- a/storages/views.py +++ b/storages/views.py @@ -155,8 +155,8 @@ def storage(request, compute_id, pool): if data['meta_prealloc'] and data['format'] == 'qcow2': meta_prealloc = True try: - conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc) - messages.success(request, _("Image file {} is created successfully".format(data['name']+".img"))) + name = conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc) + messages.success(request, _("Image file {} is created successfully".format(name))) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err) @@ -184,10 +184,10 @@ def storage(request, compute_id, pool): form = CloneImage(request.POST) if form.is_valid(): data = form.cleaned_data - img_name = data['name'] + '.img' + img_name = data['name'] meta_prealloc = 0 if img_name in conn.update_volumes(): - msg = _("Name of volume name already use") + msg = _("Name of volume already in use") error_messages.append(msg) if not error_messages: if data['convert']: @@ -197,8 +197,8 @@ def storage(request, compute_id, pool): else: format = None try: - conn.clone_volume(data['image'], data['name'], format, meta_prealloc) - messages.success(request, _("{} image cloned as {} successfully".format(data['image'], data['name'] + ".img"))) + name = conn.clone_volume(data['image'], data['name'], format, meta_prealloc) + messages.success(request, _("{} image cloned as {} successfully".format(data['image'], name))) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err)