Bug 503290

Summary: long xen domains do not work for storing xen guests during reboot
Product: Red Hat Enterprise Linux 5 Reporter: Florian La Roche <florian.laroche>
Component: xenAssignee: Michal Novotny <minovotn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: areis, clalance, jzheng, llim, minovotn, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 22:17:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 514498    
Attachments:
Description Flags
Patch by Mark (applicable to latest RHEL-5 codebase as well) none

Description Florian La Roche 2009-05-30 20:53:01 UTC
Description of problem:

If XENDOMAINS_SAVE is enabled and very long domain names are used, then
saving the domains will fail.
/usr/lib/python2.4/site-packages/xen/xm/main.py contains this for "xm list":
def xm_brief_list(doms):
    print '%-40s %3s %8s %5s %5s %9s' % \
          ('Name', 'ID', 'Mem(MiB)', 'VCPUs', 'State', 'Time(s)')

But the init-Script truncates at another place: /etc/init.d/xendomain.


Here a quick fix for this:
--- /etc/init.d/xendomains
+++ /etc/init.d/xendomains
@@ -175,9 +177,9 @@

 parseln()
 {
-    name=`echo "$1" | cut -c0-17`
+    name=`echo "$1" | cut -c0-40`
     name=${name%% *}
-    rest=`echo "$1" | cut -c18- `
+    rest=`echo "$1" | cut -c41- `
     read id mem cpu vcpu state tm < <(echo "$rest")
 }


Even better would be to not rely on parsing "xm list" as already done
in other parts of the same initscript, but the above would be a good
start for RHEL5.

regards,

Florian La Roche



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 Michal Novotny 2010-06-29 13:52:14 UTC
Well, based on definition with /usr/lib/python2.4/site-packages/xen/xm/main.py I guess it would be better to go with the patch from Florian rather than thinking about different logic implementation.

Michal

Comment 3 Michal Novotny 2010-08-20 14:22:30 UTC
Created attachment 439957 [details]
Patch by Mark (applicable to latest RHEL-5 codebase as well)

Well, I've been investigating this in upstream version and they have introduced in c/s 15384 at [2] to make the name working with more than 16 characters by using `xm list -l` instead of `xm list`. I tried to apply the patch with no modifications and it was working fine so I did the testing using some longer names, i.e. both short (rhel5-32fv) and long names (Red-Hat-Enterprise-Linux-5-32-bit-version) and both domains were saved (using `service xendomains stop`) and restored (using `service xendomains start`) successfully.

This is the original version from Mark (original) - the version is well-applicable to our codebase.

Michal

[1] http://xenbits.xensource.com/staging/xen-unstable.hg?rev/865c4ae59be3

Comment 7 Jinxin Zheng 2010-09-08 08:59:00 UTC
I can verify this by placing a domain whose name length is >18 chars under xendomains control, e.g:

# xm li
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     7226     4 r-----    218.3
pv0123456789abcdefg                        2      511     1 r-----     14.5

# /etc/init.d/xendomains stop
Shutting down Xen domains: pv0123456789abcde(save).
An error occured while saving domain:
Error: Domain 'fg' does not exist.

!
(shut).
An error occured while shutting down domain:
Error: Domain 'fg' does not exist.

!
 SHUTDOWN_ALL        

[failed]                                                   [FAILED]

The above test is with xen-3.0.3-115.el5

Updated to xen-3.0.3-116.el5, this case works correctly:

...
# /etc/init.d/xendomains stop
Shutting down Xen domains: pv0123456789abcdefg(save)..........
[done]                                                     [  OK  ]

So put this bug to VERIFIED.

Comment 9 errata-xmlrpc 2011-01-13 22:17:18 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0031.html