mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
Fix UUID change in xml view
This commit is contained in:
@@ -1966,6 +1966,20 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function nvram_rename($uuid,$newuuid) {
|
||||
// rename backup OVMF VARS if this domain had them
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd_backup', '/etc/libvirt/qemu/nvram/'.$newuuid.'_VARS-pure-efi.fd');
|
||||
return true;
|
||||
}
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd')) {
|
||||
rename('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi-tpm.fd_backup', '/etc/libvirt/qemu/nvram/'.$newuuid.'_VARS-pure-efi-tpm.fd');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function nvram_create_snapshot($uuid,$snapshotname) {
|
||||
// snapshot backup OVMF VARS if this domain had them
|
||||
if (is_file('/etc/libvirt/qemu/nvram/'.$uuid.'_VARS-pure-efi.fd')) {
|
||||
|
||||
@@ -217,11 +217,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newuuid = $uuid;
|
||||
$olduuid = $uuid;
|
||||
// construct updated config
|
||||
if (isset($_POST['xmldesc'])) {
|
||||
// XML view
|
||||
$xml = $_POST['xmldesc'];
|
||||
$arrExistingConfig = custom::createArray('domain',$xml);
|
||||
$newuuid = $arrExistingConfig['uuid'] ;
|
||||
$xml = str_replace($olduuid,$newuuid,$xml);
|
||||
} else {
|
||||
// form view
|
||||
if ($error = create_vdisk($_POST) === false) {
|
||||
@@ -240,6 +244,7 @@
|
||||
$lv->nvram_backup($uuid);
|
||||
$lv->domain_undefine($dom);
|
||||
$lv->nvram_restore($uuid);
|
||||
if ($newuuid != $olduuid) $lv->nvram_rename($olduuid,$newuuid);
|
||||
$new = $lv->domain_define($xml);
|
||||
if ($new) {
|
||||
$lv->domain_set_autostart($new, $newAutoStart);
|
||||
|
||||
Reference in New Issue
Block a user