diff --git a/instances/templates/instance.html b/instances/templates/instance.html index b18836a..0ca9c87 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -1052,6 +1052,7 @@ guessed_name = data['name'].split(".")[0]; $('#clone_name').val(guessed_name); update_clone_disk_name(guessed_name); + guess_mac_address('#clone_name', 0); }); } diff --git a/instances/views.py b/instances/views.py index 76d29ec..028891c 100644 --- a/instances/views.py +++ b/instances/views.py @@ -790,7 +790,8 @@ def guess_clone_name(request): for line in f: line = line.strip() if "host %s" % prefix in line: - hostname = line.split(' ')[1] + fqdn = line.split(' ')[1] + hostname = fqdn.split('.')[0] if hostname.startswith(prefix) and hostname not in instance_names: return HttpResponse(json.dumps({'name': hostname})) return HttpResponse(json.dumps({}));