[pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2
Fabian Ebner
f.ebner at proxmox.com
Thu Mar 17 09:37:48 CET 2022
For future or external storages where the assumption "multiple formats implies
qcow2 is supported" doesn't hold.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
www/manager6/form/DiskStorageSelector.js | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
index 14a678b7..abd46deb 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -57,17 +57,24 @@ Ext.define('PVE.form.DiskStorageSelector', {
return;
}
- var selectformat = false;
+ let validFormats = {};
+ let selectFormat = 'raw';
if (rec.data.format) {
- var format = rec.data.format[0]; // 0 is the formats, 1 the default in the backend
- delete format.subvol; // we never need subvol in the gui
- selectformat = Ext.Object.getSize(format) > 1;
+ validFormats = rec.data.format[0]; // 0 is the formats, 1 the default in the backend
+ delete validFormats.subvol; // we never need subvol in the gui
+ if (validFormats.qcow2) {
+ selectFormat = 'qcow2';
+ } else if (validFormats.raw) {
+ selectFormat = 'raw';
+ } else {
+ selectFormat = rec.data.format[1];
+ }
}
var select = !!rec.data.select_existing && !me.hideSelection;
- formatsel.setDisabled(!selectformat || me.hideFormat);
- formatsel.setValue(selectformat ? 'qcow2' : 'raw');
+ formatsel.setDisabled(me.hideFormat || Ext.Object.getSize(validFormats) <= 1);
+ formatsel.setValue(selectFormat);
hdfilesel.setDisabled(!select);
hdfilesel.setVisible(select);
--
2.30.2
More information about the pve-devel
mailing list