Namely, if there is a storage in the backup configuration that's not
available on the current node.

Signed-off-by: Fabian Ebner <[email protected]>
---

Changes from v2:
    * Improve style.
    * Handle when no storage hint is present correctly.

 www/manager6/window/Restore.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js
index e48aac1a..51f7d063 100644
--- a/www/manager6/window/Restore.js
+++ b/www/manager6/window/Restore.js
@@ -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() {
-- 
2.30.2



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to