WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] Fix parsing of the tools .iso filename

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Fix parsing of the tools .iso filename
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 26 Nov 2009 16:44:52 +0000
Delivery-date: Thu, 26 Nov 2009 08:40:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1259253843 0
# Node ID c512a7857329c62e8ba44bc76e70f1068a0d1abb
# Parent  6fd77ef2569ead1d2cbc5ca6a6d496519e966fc0
CA-35383: if the tools filename build number has a non-digit suffix, disregard 
it.

XCP hosts currently have tools isos in
  /opt/xensource/packages/iso/xs-tools-<version>-<build><suffix>.iso
where <build> is an integer and <suffix> is a string.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 6fd77ef2569e -r c512a7857329 ocaml/xapi/xapi_pv_driver_version.ml
--- a/ocaml/xapi/xapi_pv_driver_version.ml      Tue Nov 24 15:17:56 2009 +0000
+++ b/ocaml/xapi/xapi_pv_driver_version.ml      Thu Nov 26 16:44:03 2009 +0000
@@ -43,7 +43,12 @@
        match String.split '.' mid with
        | [ maj; min; mic_plus_build ] ->
            begin match String.split '-' mic_plus_build with
-           | [ mic; build ] -> int_of_string maj, int_of_string min, 
int_of_string mic, int_of_string build
+           | [ mic; build ] -> 
+                         (* Build numbers often have a non-digit suffix: 
remove this *)
+                         let isdigit c = Char.code c >= (Char.code '0') && 
(Char.code c <= (Char.code '9')) in
+                         let build = String.strip (fun c -> not (isdigit c)) 
build in
+
+                         int_of_string maj, int_of_string min, int_of_string 
mic, int_of_string build
            | [ mic ] -> int_of_string maj, int_of_string min, int_of_string 
mic, -1
            | _ -> none (* never happens *)
            end
1 file changed, 6 insertions(+), 1 deletion(-)
ocaml/xapi/xapi_pv_driver_version.ml |    7 ++++++-


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>