[PATCH] Remove '.iso' extension checking when create new template

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

Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> On 23-05-2014 15:08, 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>

For incoming path param, I think I don't mind ignore the suffix '.iso'. But in deep scanning, we filtered other suffix because we don't want to scan every file head in a directory tree, that is very time consuming, iso_info.py: def probe_iso(): ..... for name in files: if not name.lower().endswith('.iso'): continue And in scan.py, we assumed suffix 'iso' to resolve duplicate. scan.py: def start_scan(self, cb, params): def updater(iso_info): iso_name = os.path.basename(iso_info['path'])[:-3] duplicates = "%s/%s*" % (params['pool_path'], iso_name) If these can be resolved I'm definitely OK with your proposal. Or if you put file with a '.iso.1' I'm afraid deep scan will not able to discover it. But if you just want to cover scenario "specified cdrom path to create template", I think this patch is OK. On 2014年05月24日 02:08, 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": {

Hi Royce, yes, my proposal is just ignore the suffix ".iso" of the cdrom path when create, or update, a template. Because, this might cause error. I am OK about keep the deep scan and pool discover strategies. Rodrigo On 05/25/2014 11:42 PM, Royce Lv wrote:
For incoming path param, I think I don't mind ignore the suffix '.iso'. But in deep scanning, we filtered other suffix because we don't want to scan every file head in a directory tree, that is very time consuming,
iso_info.py:
def probe_iso(): ..... for name in files: if not name.lower().endswith('.iso'): continue
And in scan.py, we assumed suffix 'iso' to resolve duplicate. scan.py:
def start_scan(self, cb, params): def updater(iso_info): iso_name = os.path.basename(iso_info['path'])[:-3]
duplicates = "%s/%s*" % (params['pool_path'], iso_name)
If these can be resolved I'm definitely OK with your proposal. Or if you put file with a '.iso.1' I'm afraid deep scan will not able to discover it. But if you just want to cover scenario "specified cdrom path to create template", I think this patch is OK.
On 2014年05月24日 02:08, 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": {
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

still one place check the name suffix with iso in UI code. It is kimchi.is_iso_file On 05/24/2014 02:08 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

Thanks Sheldon! I think we can remove this checking too, for consistency. Will send new patch On 05/27/2014 06:16 AM, Sheldon wrote:
still one place check the name suffix with iso in UI code. It is kimchi.is_iso_file
On 05/24/2014 02:08 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": {
participants (4)
-
Crístian Viana
-
Rodrigo Trujillo
-
Royce Lv
-
Sheldon