This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 503290 - long xen domains do not work for storing xen guests during reboot
long xen domains do not work for storing xen guests during reboot
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: xen (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Michal Novotny
Virtualization Bugs
Depends On:
Blocks: 514498
  Show dependency treegraph
Reported: 2009-05-30 16:53 EDT by Florian La Roche
Modified: 2014-02-02 17:37 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-01-13 17:17:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch by Mark (applicable to latest RHEL-5 codebase as well) (2.82 KB, patch)
2010-08-20 10:22 EDT, Michal Novotny
no flags Details | Diff

  None (edit)
Description Florian La Roche 2009-05-30 16:53:01 EDT
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/ 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 @@

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


Florian La Roche

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

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

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

Comment 3 Michal Novotny 2010-08-20 10:22:30 EDT
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.


Comment 7 Jinxin Zheng 2010-09-08 04:59:00 EDT
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.

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


[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 17:17:18 EST
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.

Note You need to log in before you can comment on or make changes to this bug.