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-changelog

[Xen-changelog] [xen-unstable] Save elfnotes in VM sxpr under image/note

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Save elfnotes in VM sxpr under image/notes, and load them on restore.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Feb 2007 15:45:32 -0800
Delivery-date: Mon, 26 Feb 2007 15:45:41 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1172483996 0
# Node ID 64d80037e5248bd3eadc4409e42a0ae67594e51d
# Parent  a20ec270998b6b2a637552db6285ac80d64a5101
Save elfnotes in VM sxpr under image/notes, and load them on restore.
Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |   34 +++++++++++++++++++++++++++++++-
 tools/python/xen/xend/XendDomainInfo.py |    5 +---
 2 files changed, 35 insertions(+), 4 deletions(-)

diff -r a20ec270998b -r 64d80037e524 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Mon Feb 26 09:59:33 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Mon Feb 26 09:59:56 2007 +0000
@@ -729,6 +729,10 @@ class XendConfig(dict):
                 image['hvm'] = image_hvm
                 image['hvm']['devices'] = image_hvm_devices
 
+            notes = sxp.children(image_sxp, 'notes')
+            if notes:
+                image['notes'] = self.notes_from_sxp(notes[0])
+
             self['image'] = image
 
             for apikey, imgkey in XENAPI_HVM_CFG.items():
@@ -1363,6 +1367,9 @@ class XendConfig(dict):
                             
                     image.append([arg, val])
 
+        if 'notes' in self['image']:
+            image.append(self.notes_sxp(self['image']['notes']))
+
         return image
 
     def update_with_image_sxp(self, image_sxp, bootloader = False):
@@ -1420,6 +1427,10 @@ class XendConfig(dict):
             image['hvm'] = image_hvm
             image['hvm']['devices'] = image_hvm_devices
 
+        notes = sxp.children(image_sxp, 'notes')
+        if notes:
+            image['notes'] = self.notes_from_sxp(notes[0])
+
         self['image'] = image
 
         for apikey, imgkey in XENAPI_HVM_CFG.items():
@@ -1432,7 +1443,28 @@ class XendConfig(dict):
                     self[apikey] = val
         self._hvm_boot_params_from_sxp(image_sxp)
 
-
+    def set_notes(self, notes):
+        'Add parsed elfnotes to image'
+        self['image']['notes'] = notes
+
+    def get_notes(self):
+        try:
+            return self['image']['notes'] or {}
+        except KeyError:
+            return {}
+
+    def notes_from_sxp(self, nsxp):
+        notes = {}
+        for note in sxp.children(nsxp):
+            notes[note[0]] = note[1]
+        return notes
+
+    def notes_sxp(self, notes):
+        nsxp = ['notes']
+        for k, v in notes.iteritems():
+            nsxp.append([k, str(v)])
+        return nsxp
+        
     def _hvm_boot_params_from_sxp(self, image_sxp):
         boot = sxp.child_value(image_sxp, 'boot', None)
         if boot is not None:
diff -r a20ec270998b -r 64d80037e524 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Feb 26 09:59:33 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Feb 26 09:59:56 2007 +0000
@@ -356,7 +356,6 @@ class XendDomainInfo:
         self.store_mfn = None
         self.console_port = None
         self.console_mfn = None
-        self.notes = {}
 
         self.vmWatch = None
         self.shutdownWatch = None
@@ -790,7 +789,7 @@ class XendDomainInfo:
         f('store/ring-ref',   self.store_mfn)
 
         # elfnotes
-        for n, v in self.notes.iteritems():
+        for n, v in self.info.get_notes().iteritems():
             n = n.lower().replace('_', '-')
             if n == 'features':
                 for v in v.split('|'):
@@ -1482,7 +1481,7 @@ class XendDomainInfo:
             if 'console_mfn' in channel_details:
                 self.console_mfn = channel_details['console_mfn']
             if 'notes' in channel_details:
-                self.notes = channel_details['notes']
+                self.info.set_notes(channel_details['notes'])
 
             self._introduceDomain()
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Save elfnotes in VM sxpr under image/notes, and load them on restore., Xen patchbot-unstable <=