diff --git a/www/manager/Parser.js b/www/manager/Parser.js index 90c98c79..5a5e47f9 100644 --- a/www/manager/Parser.js +++ b/www/manager/Parser.js @@ -5,6 +5,16 @@ Ext.define('PVE.Parser', { statics: { // this class only contains static functions + parseBoolean: function(value, default_value) { + if (!Ext.isDefined(value)) + return default_value; + value = value.toLowerCase(); + return value === 1 || value === '1' || + value === 'on' || + value === 'yes' || + value === 'true'; + }, + parseQemuNetwork: function(key, value) { if (!(key && value)) { return; diff --git a/www/manager/qemu/HDEdit.js b/www/manager/qemu/HDEdit.js index ffca0b05..a9858764 100644 --- a/www/manager/qemu/HDEdit.js +++ b/www/manager/qemu/HDEdit.js @@ -90,11 +90,11 @@ Ext.define('PVE.qemu.HDInputPanel', { } values.hdimage = drive.file; - values.nobackup = (drive.backup === 'no'); + values.nobackup = !PVE.Parser.parseBoolean(drive.backup, 1); values.diskformat = drive.format || 'raw'; values.cache = drive.cache || ''; values.discard = (drive.discard === 'on'); - values.iothread = (drive.iothread === 'on'); + values.iothread = PVE.Parser.parseBoolean(drive.iothread); me.setValues(values); },