[PATCH 1/2] Remove '.iso' extension checking from json schema

Libvirt accepts iso files with names that do not end with '.iso' extension. Also, Kimchi discovers ISOs stored in storagepools by the file format, it does not care about file name. This patch removes the .iso checking from API.json schema, then files ending with '.iso.1', '.iso.bkp' or any other, can be used. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- src/kimchi/API.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kimchi/API.json b/src/kimchi/API.json index b9d371a..44a1439 100644 --- a/src/kimchi/API.json +++ b/src/kimchi/API.json @@ -361,7 +361,7 @@ "cdrom": { "description": "Path for cdrom", "type": "string", - "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$", + "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$", "required": true, "error": "KCHTMPL0014E" }, @@ -532,7 +532,7 @@ "cdrom": { "description": "Path for cdrom", "type": "string", - "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$", + "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$", "error": "KCHTMPL0014E" }, "disks": { -- 1.9.0

This patch removes the '.iso' checking of the path of a given cdrom image, when create a new template. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_add_main.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ui/js/src/kimchi.template_add_main.js b/ui/js/src/kimchi.template_add_main.js index dbb3952..2bf48a4 100644 --- a/ui/js/src/kimchi.template_add_main.js +++ b/ui/js/src/kimchi.template_add_main.js @@ -210,10 +210,6 @@ kimchi.template_add_main = function() { $('#btn-template-file-create').click(function() { var isoFile = $('#iso-file').val(); - if (!kimchi.is_iso_file(isoFile)) { - kimchi.message.error.code('KCHTMPL6002E'); - return; - } if (!kimchi.template_check_path(isoFile)) { kimchi.message.error.code('KCHAPI6003E'); return; @@ -408,16 +404,9 @@ kimchi.template_check_url = function(url) { }; kimchi.template_check_path = function(filePath) { - var reg = /((\/([0-9a-zA-Z-_ \.]+))+[\.]iso)$/; + var reg = /((\/([0-9a-zA-Z-_ \.]+))+)$/; if (filePath.constructor === String) { return reg.test(filePath); } return false; }; - -kimchi.is_iso_file = function(isoFile) { - if (/.iso$/.test(isoFile)) { - return true; - } - return false; -}; -- 1.9.0

Reviewed-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> On 05/29/2014 03:09 AM, Rodrigo Trujillo wrote:
This patch removes the '.iso' checking of the path of a given cdrom image, when create a new template.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_add_main.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/ui/js/src/kimchi.template_add_main.js b/ui/js/src/kimchi.template_add_main.js index dbb3952..2bf48a4 100644 --- a/ui/js/src/kimchi.template_add_main.js +++ b/ui/js/src/kimchi.template_add_main.js @@ -210,10 +210,6 @@ kimchi.template_add_main = function() {
$('#btn-template-file-create').click(function() { var isoFile = $('#iso-file').val(); - if (!kimchi.is_iso_file(isoFile)) { - kimchi.message.error.code('KCHTMPL6002E'); - return; - } if (!kimchi.template_check_path(isoFile)) { kimchi.message.error.code('KCHAPI6003E'); return; @@ -408,16 +404,9 @@ kimchi.template_check_url = function(url) { };
kimchi.template_check_path = function(filePath) { - var reg = /((\/([0-9a-zA-Z-_ \.]+))+[\.]iso)$/; + var reg = /((\/([0-9a-zA-Z-_ \.]+))+)$/; if (filePath.constructor === String) { return reg.test(filePath); } return false; }; - -kimchi.is_iso_file = function(isoFile) { - if (/.iso$/.test(isoFile)) { - return true; - } - return false; -};
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center

Reviewed-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> And this is the V2 patch. Rodrigo forget to add V2 tag in the title. On 05/29/2014 03:09 AM, Rodrigo Trujillo wrote:
Libvirt accepts iso files with names that do not end with '.iso' extension. Also, Kimchi discovers ISOs stored in storagepools by the file format, it does not care about file name. This patch removes the .iso checking from API.json schema, then files ending with '.iso.1', '.iso.bkp' or any other, can be used.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- src/kimchi/API.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json index b9d371a..44a1439 100644 --- a/src/kimchi/API.json +++ b/src/kimchi/API.json @@ -361,7 +361,7 @@ "cdrom": { "description": "Path for cdrom", "type": "string", - "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$", + "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$", "required": true, "error": "KCHTMPL0014E" }, @@ -532,7 +532,7 @@ "cdrom": { "description": "Path for cdrom", "type": "string", - "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$", + "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$", "error": "KCHTMPL0014E" }, "disks": {
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center
participants (3)
-
Aline Manera
-
Rodrigo Trujillo
-
Sheldon