[pve-devel] [PATCH manager] Fix #1144: set a default disk format for VM disk widgets

Emmanuel Kasper e.kasper at proxmox.com
Tue Oct 25 17:42:41 CEST 2016


Up to now Qemu Wizard, Clone, and Hard Disk Move components had
a different idea of what should be the proposed format
of a disk image.
Make all them auto select qcow2.
---
Not especially proud of using variable called "PVE.qemu.OSDefaults.generic.diskFormat" (39 characters) but can't find a better name.

 www/manager6/qemu/Clone.js      | 1 +
 www/manager6/qemu/HDEdit.js     | 2 +-
 www/manager6/qemu/HDMove.js     | 1 +
 www/manager6/qemu/OSDefaults.js | 3 ++-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/www/manager6/qemu/Clone.js b/www/manager6/qemu/Clone.js
index 617b66e..63366ab 100644
--- a/www/manager6/qemu/Clone.js
+++ b/www/manager6/qemu/Clone.js
@@ -76,6 +76,7 @@ Ext.define('PVE.window.Clone', {
             me.formatsel.setValue('raw');
             me.formatsel.setDisabled(true);
         } else {
+            me.formatsel.setValue(PVE.qemu.OSDefaults.generic.diskFormat);
             me.formatsel.setDisabled(false);
         }
     },
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 219fe9d..e804455 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -56,7 +56,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		    } else {
 			me.hdfilesel.setDisabled(true);
 			me.hdfilesel.setVisible(false);
-			me.formatsel.setValue('qcow2');
+			me.formatsel.setValue(PVE.qemu.OSDefaults.generic.diskFormat);
 			me.formatsel.setDisabled(false);
 			me.hdsizesel.setDisabled(false);
 			me.hdsizesel.setVisible(true);
diff --git a/www/manager6/qemu/HDMove.js b/www/manager6/qemu/HDMove.js
index 745c791..a1a058b 100644
--- a/www/manager6/qemu/HDMove.js
+++ b/www/manager6/qemu/HDMove.js
@@ -85,6 +85,7 @@ Ext.define('PVE.window.HDMove', {
                             me.formatsel.setValue('raw');
                             me.formatsel.setDisabled(true);
                         } else {
+                            me.formatsel.setValue(PVE.qemu.OSDefaults.generic.diskFormat);
                             me.formatsel.setDisabled(false);
                         }
 
diff --git a/www/manager6/qemu/OSDefaults.js b/www/manager6/qemu/OSDefaults.js
index 89d9c15..50e2ad7 100644
--- a/www/manager6/qemu/OSDefaults.js
+++ b/www/manager6/qemu/OSDefaults.js
@@ -43,7 +43,8 @@ Ext.define('PVE.qemu.OSDefaults', {
 		    scsi: 2,
 		    virtio: 1
 	    },
-	    scsihw: 'virtio-scsi-pci'
+	    scsihw: 'virtio-scsi-pci',
+	    diskFormat: 'qcow2'
 	};
 
        // virtio-net is in kernel since 2.6.25
-- 
2.1.4





More information about the pve-devel mailing list