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] make it more likely that new exports will work on old

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] make it more likely that new exports will work on old hosts
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Wed, 7 Apr 2010 21:10:04 +0100
Delivery-date: Wed, 07 Apr 2010 13:07:12 -0700
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 1270670956 -3600
# Node ID 45015680f6b772e4028df28a37b053c4172eccb4
# Parent  27bad449e0035f08da470f6bda2ba69c987f8452
CA-39952: explicitly blank {allowed,current}_operations fields in VM exports. 
The values stored here are redundant sources of potential import failures on 
older s/w versions.

The operation enums are often extended rendering them unparsable by older 
software versions. Although we don't guarantee that a new export can be 
imported on an old host it nevertheless should almost always work.. (apart from 
this)

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

diff -r 27bad449e003 -r 45015680f6b7 ocaml/xapi/export.ml
--- a/ocaml/xapi/export.ml      Wed Apr 07 17:43:56 2010 +0100
+++ b/ocaml/xapi/export.ml      Wed Apr 07 21:09:16 2010 +0100
@@ -159,6 +159,8 @@
                        if with_snapshot_metadata
                        then lookup table (Ref.string_of vm.API.vM_parent)
                        else Ref.null;
+               API.vM_current_operations = [];
+               API.vM_allowed_operations = [];
                API.vM_VIFs = filter table (List.map Ref.string_of 
vm.API.vM_VIFs);
                API.vM_VBDs = filter table (List.map Ref.string_of 
vm.API.vM_VBDs);
                API.vM_crash_dumps = [];
@@ -187,7 +189,10 @@
                API.vIF_currently_attached = if preserve_power_state then 
vif.API.vIF_currently_attached else false;
                API.vIF_network = lookup table (Ref.string_of 
vif.API.vIF_network);
                API.vIF_VM = lookup table (Ref.string_of vif.API.vIF_VM);
-               API.vIF_metrics = Ref.null; } in
+               API.vIF_metrics = Ref.null; 
+               API.vIF_current_operations = [];
+               API.vIF_allowed_operations = [];
+  } in
   { cls = Datamodel._vif; 
     id = Ref.string_of (lookup table (Ref.string_of self)); 
     snapshot = API.To.vIF_t vif }
@@ -197,7 +202,10 @@
   let net = Db.Network.get_record ~__context ~self in
   let net = { net with 
                API.network_VIFs = filter table (List.map Ref.string_of 
net.API.network_VIFs);
-               API.network_PIFs = []; } in
+               API.network_PIFs = []; 
+               API.network_current_operations = [];
+               API.network_allowed_operations = [];
+  } in
   { cls = Datamodel._network; 
     id = Ref.string_of (lookup table (Ref.string_of self)); 
     snapshot = API.To.network_t net }
@@ -210,6 +218,8 @@
                API.vBD_VDI = lookup table (Ref.string_of vbd.API.vBD_VDI); 
                API.vBD_VM = lookup table (Ref.string_of vbd.API.vBD_VM);
                API.vBD_metrics = Ref.null;
+               API.vBD_current_operations = [];
+               API.vBD_allowed_operations = [];
            } in
   { cls = Datamodel._vbd; 
     id = Ref.string_of (lookup table (Ref.string_of self)); 
@@ -221,7 +231,10 @@
   let vdi = { vdi with 
                API.vDI_VBDs = filter table (List.map Ref.string_of 
vdi.API.vDI_VBDs);
                API.vDI_crash_dumps = [];
-               API.vDI_SR = lookup table (Ref.string_of vdi.API.vDI_SR); } in
+               API.vDI_SR = lookup table (Ref.string_of vdi.API.vDI_SR);
+               API.vDI_current_operations = [];
+               API.vDI_allowed_operations = [];
+  } in
   { cls = Datamodel._vdi; 
     id = Ref.string_of (lookup table (Ref.string_of self)); 
     snapshot = API.To.vDI_t vdi }  
@@ -231,10 +244,14 @@
   let sr = Db.SR.get_record ~__context ~self in
   let sr = { sr with 
                API.sR_VDIs = filter table (List.map Ref.string_of 
sr.API.sR_VDIs);
-               API.sR_PBDs = []; } in
+               API.sR_PBDs = []; 
+               API.sR_current_operations = [];
+               API.sR_allowed_operations = [];
+  } in
   { cls = Datamodel._sr; 
     id = Ref.string_of (lookup table (Ref.string_of self)); 
-    snapshot = API.To.sR_t sr }    
+    snapshot = API.To.sR_t sr;
+  }    
 
 let make_all ~with_snapshot_metadata ~preserve_power_state table __context = 
        let filter table rs = List.filter (fun x -> lookup table (Ref.string_of 
x) <> Ref.null) rs in
1 file changed, 22 insertions(+), 5 deletions(-)
ocaml/xapi/export.ml |   27 ++++++++++++++++++++++-----


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>
  • [Xen-API] [PATCH] make it more likely that new exports will work on old hosts, David Scott <=