Patch for fixing the rtc/timeoffset entry
PATCH 1/1 Patch for fixing the rtc/timeoffset entry
This patch rewrites the rtc/timeoffset entry so the VM's record can be retrieved with the Java xmlrpc library. If the entry is 'None' it upsets the xmlrpc parser. This fixes it, though maybe there's a better place in xend to place similar code.
tools/python/xen/xend/XendDomainInfo.py +5 -2
@@ -891,9 +894,12 @@ class XendDomainInfo: # Check if the rtc offset has changes if vm_details.get("rtc/timeoffset", 0) != self.info["platform"].get("rtc_timeoffset", 0): - self.info["platform"]["rtc_timeoffset"] = vm_details.get("rtc/timeoffset", 0) + rtc = vm_details.get("rtc/timeoffset") + if not rtc: + rtc = "0" + self.info["platform"]["rtc_timeoffset"] = rtc changed = True - + if changed: # Update the domain section of the store, as this contains some # parameters derived from the VM configuration.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Stefan Berger
This patch rewrites the rtc/timeoffset entry so the VM's record can be retrieved with the Java xmlrpc library. If the entry is 'None' it upsets the xmlrpc parser. This fixes it, though maybe there's a better place in xend to place similar code.
Can't the second argument to vm_details.get() be changed to "0"? If not, could you just do 'foo = vm_details.get(...) or "0"'?
-- Keir
Keir Fraser <[email protected]> wrote on 05/07/2007 09:01:59 AM:
Quoted 4 lines · Stefan Berger
Quoted 3 lines
This patch rewrites the rtc/timeoffset entry so the VM's record can be retrieved with the Java xmlrpc library. If the entry is 'None' it
upsets
Quoted 1 line
Quoted 1 line
the xmlrpc parser. This fixes it, though maybe there's a better place
in
Quoted 4 lines
Quoted 1 line
xend to place similar code.
Can't the second argument to
vm_details.get()be changed to "0"? If not, could you just do 'foo =vm_details.get(...)or "0"'?
The problem is that the 'get' only falls back to the default (currently passed as '0'), if the member of the dictionary is not set at all. Unfortunately the member has the value 'None'. Probably the value "0" should be assigned in the initialization of the dictionary.
Stefan
Quoted 4 lines
-- Keir
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
A simpler solution below:
Stefan
diff -r 3a5722420de7 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu May 03
19:25:47 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Mon May 07
16:33:14 2007 -0400
@@ -868,6 +868,9 @@ class XendDomainInfo:
# convert two lists into a python dictionary
vm_details = dict(zip(cfg_vm, vm_details))+ if vm_details['rtc/timeoffset'] == None:
+ vm_details['rtc/timeoffset'] = "0"
+
for arg, val in vm_details.items():
if arg in XendConfig.LEGACY_CFG_TO_XENAPI_CFG:
xapiarg = XendConfig.LEGACY_CFG_TO_XENAPI_CFG[arg]
Keir Fraser <[email protected]> wrote on 05/07/2007 09:01:59 AM:
Quoted 4 lines · Stefan Berger
Quoted 3 lines
This patch rewrites the rtc/timeoffset entry so the VM's record can be retrieved with the Java xmlrpc library. If the entry is 'None' it
upsets
Quoted 1 line
Quoted 1 line
the xmlrpc parser. This fixes it, though maybe there's a better place
in
Quoted 8 lines
Quoted 1 line
xend to place similar code.
Can't the second argument to
vm_details.get()be changed to "0"? If not, could you just do 'foo =vm_details.get(...)or "0"'?-- Keir
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel