mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
show_clone_disk generates cloned images name with "-*" suffix. fe: vname=vm1 vm1-root becomes vm1-clone-root (was vm1-root-clone)
This commit is contained in:
parent
a34c55d3bc
commit
323e0a10d5
1 changed files with 6 additions and 3 deletions
|
@ -168,12 +168,15 @@ def instance(request, compute_id, vname):
|
||||||
if not userinstace:
|
if not userinstace:
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
def show_clone_disk(disks):
|
def show_clone_disk(disks, vname=''):
|
||||||
clone_disk = []
|
clone_disk = []
|
||||||
for disk in disks:
|
for disk in disks:
|
||||||
if disk['image'] is None:
|
if disk['image'] is None:
|
||||||
continue
|
continue
|
||||||
if disk['image'].count(".") and len(disk['image'].rsplit(".", 1)[1]) <= 7:
|
if disk['image'].count("-") and disk['image'].rsplit("-", 1)[0] == vname:
|
||||||
|
name, suffix = disk['image'].rsplit("-", 1)
|
||||||
|
image = name + "-clone" + "-" + suffix
|
||||||
|
elif disk['image'].count(".") and len(disk['image'].rsplit(".", 1)[1]) <= 7:
|
||||||
name, suffix = disk['image'].rsplit(".", 1)
|
name, suffix = disk['image'].rsplit(".", 1)
|
||||||
image = name + "-clone" + "." + suffix
|
image = name + "-clone" + "." + suffix
|
||||||
else:
|
else:
|
||||||
|
@ -234,7 +237,7 @@ def instance(request, compute_id, vname):
|
||||||
snapshots = sorted(conn.get_snapshot(), reverse=True)
|
snapshots = sorted(conn.get_snapshot(), reverse=True)
|
||||||
inst_xml = conn._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
inst_xml = conn._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||||
has_managed_save_image = conn.get_managed_save_image()
|
has_managed_save_image = conn.get_managed_save_image()
|
||||||
clone_disks = show_clone_disk(disks)
|
clone_disks = show_clone_disk(disks, vname)
|
||||||
console_passwd = conn.get_console_passwd()
|
console_passwd = conn.get_console_passwd()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue