1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Random mac address for cloned vm issue fixed by @honza801

This commit is contained in:
catborise 2018-07-26 15:29:56 +03:00
parent 1700ddf8f1
commit 340d93463e
3 changed files with 51 additions and 31 deletions

View file

@ -1197,15 +1197,10 @@
}
</script>
<script>
function random_mac(net) {
var hexDigits = "0123456789abcdef";
var macAddress="52:54:00:";
for (var i=0; i<3; i++) {
macAddress+=hexDigits.charAt(Math.round(Math.random()*16));
macAddress+=hexDigits.charAt(Math.round(Math.random()*16));
if (i != 2) macAddress+=":";
}
$('input[name="clone-net-mac-'+net+'"]').val(macAddress);
function random_mac(net) {
$.getJSON('/instance/random_mac_address/', function(data) {
$('input[name="clone-net-mac-'+net+'"]').val(data['mac']);
});
};
</script>
<script>
@ -1305,7 +1300,11 @@
$("#console_select_listen_address option[value='" + console_listen_address + "']").prop('selected', true);
}
});
{% if not request.user.is_superuser %}
{% if request.user.is_superuser %}
$(document).ready(function () {
random_mac(0);
});
{% else %}
$('#select_clone_name').on('change', function () {
update_clone_disk_name($(this).val());
guess_mac_address('#select_clone_name', 0);
@ -1328,7 +1327,6 @@
<script>
function network_select_enable(){
// set network button enabled
var selected = $('network_select').val();
if (selected != "to Change") {
$('button[name="change_network"]').removeAttr('disabled');