]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: restore: disallow empty storage selection if it wouldn't work
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 26 Apr 2022 12:30:53 +0000 (14:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 28 Apr 2022 06:43:36 +0000 (08:43 +0200)
Namely, if there is a storage in the backup configuration that's not
available on the current node.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
www/manager6/window/Restore.js

index e48aac1aa92372c55b6be1182c6e71b5096e7d5b..51f7d0637dd746a7e9d6070c6f60c9cdfb8e3a0e 100644 (file)
@@ -94,6 +94,37 @@ Ext.define('PVE.window.Restore', {
                executeRestore();
            }
        },
+
+       afterRender: function() {
+           let view = this.getView();
+
+           Proxmox.Utils.API2Request({
+               url: `/nodes/${view.nodename}/vzdump/extractconfig`,
+               method: 'GET',
+               waitMsgTarget: view,
+               params: {
+                   volume: view.volid,
+               },
+               failure: response => Ext.Msg.alert('Error', response.htmlStatus),
+               success: function(response, options) {
+                   let allStoragesAvailable = response.result.data.split('\n').every(line => {
+                       let match = line.match(/^#qmdump#map:(\S+):(\S+):(\S*):(\S*):$/);
+                       if (!match) {
+                           return true;
+                       }
+                       // if a /dev/XYZ disk was backed up, ther is no storage hint
+                       return !!match[3] && !!PVE.data.ResourceStore.getById(
+                           `storage/${view.nodename}/${match[3]}`);
+                   });
+
+                   if (!allStoragesAvailable) {
+                       let storagesel = view.down('pveStorageSelector[name=storage]');
+                       storagesel.allowBlank = false;
+                       storagesel.setEmptyText('');
+                   }
+               },
+           });
+       },
     },
 
     initComponent: function() {