Fix error message for xm create command
RFC PATCH 1/1 Fix error message for xm create command
Hi,
When I tested xm create command, I saw the following error message. I expected an error message "Error: (12, 'Cannot allocate memory')" because I intentionally caused a memory shortage on the test. But the error message was different from my expectation.
# xm create /xen/HVMdomain.1 Using config file "/xen/HVMdomain.1". Error: an integer is required
I looked at xend.log to examine the cause why the error message was shown. (Could you see the attached xend.log?)
xend had the error message "Error: (12, 'Cannot allocate memory')" first. But xend changed the error message to "Error: an integer is required" halfway.
I'm not sure about the cause why an exception occurred in logging processing. But when I applied an attached patch, I confirmed that the error message that I expected was shown. The patch does not call xc.domain_destroy_hook() if self.domid is None.
Could you comment on the patch? I'd like to solve the problem because I think that users want correct error message.
Best regards,
Kan
[2007-08-27 10:37:32 4211] DEBUG (XendDomainInfo:78) XendDomainInfo.create(['vm', ['name', 'HVMdomain.1'], ['memory', 1024], ['vcpus', 4], ['on_xend_start', 'ignore'], ['on_xend_stop', 'ignore'], ['image', ['hvm', ['kernel', '/xen/GFW/guest_firmware/hvmloader'], ['device_model', '/usr/lib/xen/bin/qemu-dm'], ['pae', 1], ['vcpus', 4], ['boot', 'c'], ['fda', ''], ['fdb', ''], ['localtime', 0], ['serial', 'pty'], ['stdvga', 0], ['isa', 0], ['nographic', 0], ['soundhw', ''], ['vnc', 1], ['vncunused', 1], ['vncconsole', 1], ['vnclisten', '0.0.0.0'], ['sdl', 0], ['display', ':1.0'], ['xauthority', '/root/.Xauthority'], ['rtc_timeoffset', '0'], ['monitor', 0], ['acpi', 1], ['apic', 1], ['usb', 0], ['usbdevice', ''], ['keymap', ''], ['vncpasswd', 'XXXXXXXX']]], ['device', ['vbd', ['uname', 'file:/xen/image/rhel4u2-10.124.50.206-5G-shared-VTi.img'], ['dev', 'hda'], ['mode', 'w']]]]) [2007-08-27 10:37:32 4211] DEBUG (XendDomainInfo:1508) XendDomainInfo.constructDomain
[2007-08-27 10:37:32 4211] DEBUG (balloon:116) Balloon: 4116656 KiB free; need 2048; done.
[2007-08-27 10:37:32 4211] DEBUG (XendDomain:435) Adding Domain: 2
[2007-08-27 10:37:32 4211] DEBUG (XendDomainInfo:1573) XendDomainInfo.initDomain: 2 256
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: boot, val: c
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: fda, val: None
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: fdb, val: None
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: soundhw, val: None
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: localtime, val: 0
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: serial, val: pty
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: std-vga, val: 0
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: isa, val: 0
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: acpi, val: 1
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: usb, val: 0
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: usbdevice, val: None
[2007-08-27 10:37:32 4211] DEBUG (image:339) args: k, val: None
[2007-08-27 10:37:32 4211] DEBUG (XendDomainInfo:1604) _initDomain:shadow_memory=0x0, memory_static_max=0x40000000, memory_static_min=0x0.
[2007-08-27 10:37:32 4211] DEBUG (balloon:116) Balloon: 4116576 KiB free; need 1065040; done.
[2007-08-27 10:37:32 4211] INFO (image:130) buildDomain os=hvm dom=2 vcpus=4
[2007-08-27 10:37:32 4211] DEBUG (image:287) domid = 2 [2007-08-27 10:37:32 4211] DEBUG (image:288) image = /xen/GFW/guest_firmware/hvmloader [2007-08-27 10:37:32 4211] DEBUG (image:289) store_evtchn = 1 [2007-08-27 10:37:32 4211] DEBUG (image:290) memsize = 1024 [2007-08-27 10:37:32 4211] DEBUG (image:291) vcpus = 4 [2007-08-27 10:37:32 4211] DEBUG (image:292) pae = 1 [2007-08-27 10:37:32 4211] DEBUG (image:293) acpi = 1 [2007-08-27 10:37:32 4211] DEBUG (image:294) apic = 1
[2007-08-27 10:37:33 4211] ERROR (XendDomainInfo:1646) XendDomainInfo.initDomain: exception occurred Traceback (most recent call last):
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 1621, in _initDomain
channel_details = self.image.createImage()
File "//usr/lib/python/xen/xend/image.py", line 113, in createImage
return self.createDomain()
File "//usr/lib/python/xen/xend/image.py", line 132, in createDomain
result = self.buildDomain()
File "//usr/lib/python/xen/xend/image.py", line 502, in buildDomain
return HVMImageHandler.buildDomain(self)
File "//usr/lib/python/xen/xend/image.py", line 303, in buildDomain
apic = self.apic)
Error: (12, 'Cannot allocate memory')
[2007-08-27 10:37:33 4211] ERROR (XendDomainInfo:418) VM start failed
Traceback (most recent call last):
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 398, in start
XendTask.log_progress(31, 60, self._initDomain)
File "//usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
retval = func(*args, **kwds)
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 1649, in _initDomain
raise VmError(str(exn))
VmError: (12, 'Cannot allocate memory')
[2007-08-27 10:37:33 4211] DEBUG (XendDomainInfo:1767) XendDomainInfo.destroy: domid=2 [2007-08-27 10:37:33 4211] DEBUG (XendDomainInfo:1785) XendDomainInfo.destroyDomain(2) [2007-08-27 10:37:35 4211] ERROR (XendDomainInfo:83) Domain construction failed Traceback (most recent call last):
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 81, in create
vm.start()
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 398, in start
XendTask.log_progress(31, 60, self._initDomain) File "//usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
retval = func(*args, **kwds)
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 1649, in _initDomain
raise VmError(str(exn))
VmError: (12, 'Cannot allocate memory')
[2007-08-27 10:37:35 4211] DEBUG (XendDomainInfo:1767) XendDomainInfo.destroy: domid=None [2007-08-27 10:37:35 4211] ERROR (xmlrpclib2:178) Internal error handling xend.domain.create Traceback (most recent call last):
File "//usr/lib/python/xen/util/xmlrpclib2.py", line 131, in _marshaled_dispatch
response = self._dispatch(method, params)
File "/usr/lib/python2.4/SimpleXMLRPCServer.py", line 406, in _dispatch
return func(*params)
File "//usr/lib/python/xen/xend/server/XMLRPCServer.py", line 72, in domain_create
info = XendDomain.instance().domain_create(config)
File "//usr/lib/python/xen/xend/XendDomain.py", line 939, in domain_create
dominfo = XendDomainInfo.create(config)
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 84, in create
vm.destroy()
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 1774, in destroy
self.destroyDomain()
File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 1785, in destroyDomain
log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
File "/usr/lib/python2.4/logging/__init__.py", line 954, in debug
if DEBUG >= self.getEffectiveLevel():
File "/usr/lib/python2.4/logging/__init__.py", line 1144, in getEffectiveLevel
while logger:
TypeError: an integer is required
tools/python/xen/xend/XendDomainInfo.py +2 -1
@@ -1770,7 +1770,8 @@ class XendDomainInfo: self._cleanupVm() if self.dompath is not None: - xc.domain_destroy_hook(self.domid) + if self.domid is not None: + xc.domain_destroy_hook(self.domid) self.destroyDomain() self._cleanup_phantom_devs(paths)
_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel
RE: [PATCH][RFC] Fix error message for xm createcommand
Hi Kanno:
I did a quick investigation and found some codes perform strange.
As I know, XEND do below flow to create a domain:
XendDomain(single one) ---------> XendDomainInfo(represent a domain) -------->Image(a set of handle)
When XendDomainInfo init, it executes below codes:
( __init__ function)
self.info = info
if domid == None:
self.domid = self.info.get('domid')
else:
self.domid = domid
I originally thought these codes could guarantee domid is not none. But seems it's un-use when a error raise. The domid in info is still none! I am also not familiar with details of Xend. Anyway, I think you patch makes the code strong.
Quoted 36 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Masaki Kanno
Sent: 2007年8月27日 15:22
To: [email protected]; [email protected]
Subject: [Xen-ia64-devel] [PATCH][RFC] Fix error message for xm createcommandHi,
When I tested xm create command, I saw the following error message. I expected an error message "Error: (12, 'Cannot allocate memory')" because I intentionally caused a memory shortage on the test. But the error message was different from my expectation.
# xm create /xen/HVMdomain.1 Using config file "/xen/HVMdomain.1". Error: an integer is requiredI looked at xend.log to examine the cause why the error message was shown. (Could you see the attached xend.log?)
xend had the error message "Error: (12, 'Cannot allocate memory')" first. But xend changed the error message to "Error: an integer is required" halfway.
I'm not sure about the cause why an exception occurred in logging processing. But when I applied an attached patch, I confirmed that the error message that I expected was shown. The patch does not callxc.domain_destroy_hook()if self.domid is None.Could you comment on the patch? I'd like to solve the problem because I think that users want correct error message.
Signed-off-by Masaki Kanno <[email protected]>Best regards,
Kan