Adds a checkbox to the restore window, allowing the user to avoid MAC address
collisions when restoring a VM/CT to a different vmid.
When restoring to the same vmid the checkbox is not visible.

Signed-off-by: Christian Ebner <c.eb...@proxmox.com>
---
 www/manager6/window/Restore.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js
index ddea6a37..6d565f2d 100644
--- a/www/manager6/window/Restore.js
+++ b/www/manager6/window/Restore.js
@@ -28,6 +28,7 @@ Ext.define('PVE.window.Restore', {
        });
 
        var IDfield;
+       var unique;
        if (me.vmid) {
            IDfield = Ext.create('Ext.form.field.Display', {
                name: 'vmid',
@@ -41,6 +42,11 @@ Ext.define('PVE.window.Restore', {
                loadNextGuestID: true,
                validateExists: false
            });
+           unique = Ext.create('Proxmox.form.Checkbox', {
+               name: 'unique',
+               fieldLabel: gettext('Unique MAC address'),
+               checked: false
+           });
        }
 
        var items = [
@@ -61,7 +67,8 @@ Ext.define('PVE.window.Restore', {
                    tag: 'div',
                    'data-qtip': gettext("Use '0' to disable all bandwidth 
limits.")
                }
-           }
+           },
+           unique
        ];
 
        /*jslint confusion: true*/
@@ -119,6 +126,7 @@ Ext.define('PVE.window.Restore', {
                    vmid: me.vmid || values.vmid,
                    force: me.vmid ? 1 : 0
                };
+               if (values.unique) { params.unique = 1; }
 
                if (values.bwlimit !== undefined) {
                    params.bwlimit = values.bwlimit * 1024;
-- 
2.11.0

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to