mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
instance/clone block new instance creating if instance with same name found
This commit is contained in:
parent
2958a21ad1
commit
16510dee59
1 changed files with 12 additions and 7 deletions
|
@ -498,14 +498,19 @@ def instance(request, compute_id, vname):
|
|||
clone_data = {}
|
||||
clone_data['name'] = request.POST.get('name', '')
|
||||
|
||||
for post in request.POST:
|
||||
if 'disk' or 'meta' in post:
|
||||
clone_data[post] = request.POST.get(post, '')
|
||||
check_instance = Instance.objects.filter(name=clone_data['name'])
|
||||
if check_instance:
|
||||
msg = _("Instance '%s' already exists!" % clone_data['name'])
|
||||
error_messages.append(msg)
|
||||
else:
|
||||
for post in request.POST:
|
||||
if 'disk' or 'meta' in post:
|
||||
clone_data[post] = request.POST.get(post, '')
|
||||
|
||||
conn.clone_instance(clone_data)
|
||||
msg = _("Clone")
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(reverse('instance', args=[compute_id, clone_data['name']]))
|
||||
conn.clone_instance(clone_data)
|
||||
msg = _("Clone")
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(reverse('instance', args=[compute_id, clone_data['name']]))
|
||||
|
||||
if 'change_network' in request.POST:
|
||||
network_data = {}
|
||||
|
|
Loading…
Reference in a new issue