xen-xs: fix uuid of renamed domain
xen-xs: fix uuid of renamed domain

When the XenStore tdb lives persistently and is not cleared between host
reboots, Xend (version 3.4 and 4.1) re-creates the domain information
located in XenStore below /vm/$UUID. (According to the xen-3.2-commit
hg265950e3df69 to fix a problem when locally migrating a domain to the
host itself.)

When doing so a version number is added to the UUID separated by one
dash, which confuses xenStoreDomainIntroduced(): It iterates over all
domains and tries to lookup all inactive domains using
xenStoreDomainGetUUID(), which fails if the running domain is renamed:
virUUIDParse() fails to parse the versioned UUID and the domain is
flagged as missing. When this happens the function delays .2s and
re-tries 20 times again, multiplied by the number of renamed VMs.
  14:48:38.878: 4285: debug : xenStoreDomainIntroduced:1354 : Some domains were missing, trying again

This adds a significant delay:
  # time virsh list >/dev/null
  real    0m6.529s
  # xenstore-list /vm
  00000000-0000-0000-0000-000000000000
  00000000-0000-0000-0000-000000000000-1
  00000000-0000-0000-0000-000000000000-2
  00000000-0000-0000-0000-000000000000-3
  00000000-0000-0000-0000-000000000000-4
  00000000-0000-0000-0000-000000000000-5
  7c06121e-90c3-93d4-0126-50481d485cca
  00000000-0000-0000-0000-000000000000-6
  00000000-0000-0000-0000-000000000000-7
  144ad19d-dfb4-2f80-8045-09196bb8784f
  00000000-0000-0000-0000-000000000000-8
  144ad19d-dfb4-2f80-8045-09196bb8784f-1
  00000000-0000-0000-0000-000000000000-9
  00000000-0000-0000-0000-000000000000-10
  00000000-0000-0000-0000-000000000000-11
  00000000-0000-0000-0000-000000000000-12
  00000000-0000-0000-0000-000000000000-13
  00000000-0000-0000-0000-000000000000-14
  144ad19d-dfb4-2f80-8045-09196bb8784f-2
  00000000-0000-0000-0000-000000000000-15
  144ad19d-dfb4-2f80-8045-09196bb8784f-3
  00000000-0000-0000-0000-000000000000-16

The patch adds truncation of the UUID as read from the XenStore path
before passing it to virUUIDParse().

The same issue is reported at
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666135>

Signed-off-by: Philipp Hahn <8cb7a2c205789112a9f61bc3102305826b6a8db1@univention.de>

taget/libvirt,jeckersb/libvirt,fabianfreyer/libvirt,agx/libvirt,VenkatDatta/libvirt,crobinso/libvirt,shugaoye/libvirt,iam-TJ/libvirt,elmarco/libvirt,novel/fbsd-libvirt,siboulet/libvirt-openvz,fabianfreyer/libvirt,novel/fbsd-libvirt,iam-TJ/libvirt,crobinso/libvirt,jardasgit/libvirt,jfehlig/libvirt,wiedi/libvirt,emaste/libvirt,shugaoye/libvirt,taget/libvirt,andreabolognani/libvirt,VenkatDatta/libvirt,jeckersb/libvirt,elmarco/libvirt,eskultety/libvirt,crobinso/libvirt,libvirt/libvirt,jeckersb/libvirt,jardasgit/libvirt,cbosdo/libvirt,bjzhang/libvirt,crobinso/libvirt,nertpinx/libvirt,datto/libvirt,datto/libvirt,zippy2/libvirt,wiedi/libvirt,jeckersb/libvirt,bjzhang/libvirt,jardasgit/libvirt,novel/fbsd-libvirt,novel/fbsd-libvirt,VenkatDatta/libvirt,trainstack/libvirt,shugaoye/libvirt,zhlcindy/libvirt-1.1.4-maintain,wiedi/libvirt,andreabolognani/libvirt,bjzhang/libvirt,zippy2/libvirt,nertpinx/libvirt,zhlcindy/libvirt-1.1.4-maintain,olafhering/libvirt,rlaager/libvirt,olafhering/libvirt,warewolf/libvirt,libvirt/libvirt,trainstack/libvirt,taget/libvirt,jardasgit/libvirt,siboulet/libvirt-openvz,emaste/libvirt,jeckersb/libvirt,siboulet/libvirt-openvz,zippy2/libvirt,emaste/libvirt,libvirt/libvirt,wiedi/libvirt,eskultety/libvirt,siboulet/libvirt-openvz,zhlcindy/libvirt-1.1.4-maintain,novel/fbsd-libvirt,iam-TJ/libvirt,olafhering/libvirt,warewolf/libvirt,iam-TJ/libvirt,shugaoye/libvirt,trainstack/libvirt,siboulet/libvirt-openvz,jardasgit/libvirt,jeckersb/libvirt,libvirt/libvirt,datto/libvirt,elmarco/libvirt,cbosdo/libvirt,taget/libvirt,jfehlig/libvirt,rlaager/libvirt,trainstack/libvirt,eskultety/libvirt,agx/libvirt,warewolf/libvirt,trainstack/libvirt,wiedi/libvirt,zippy2/libvirt,cbosdo/libvirt,jeckersb/libvirt,warewolf/libvirt,warewolf/libvirt,VenkatDatta/libvirt,novel/fbsd-libvirt,jfehlig/libvirt,warewolf/libvirt,cbosdo/libvirt,elmarco/libvirt,elmarco/libvirt,andreabolognani/libvirt,datto/libvirt,rlaager/libvirt,rlaager/libvirt,cbosdo/libvirt,bjzhang/libvirt,novel/fbsd-libvirt,novel/fbsd-libvirt,trainstack/libvirt,andreabolognani/libvirt,olafhering/libvirt,agx/libvirt,warewolf/libvirt,agx/libvirt,eskultety/libvirt,trainstack/libvirt,nertpinx/libvirt,iam-TJ/libvirt,wiedi/libvirt,zhlcindy/libvirt-1.1.4-maintain,fabianfreyer/libvirt,rlaager/libvirt,andreabolognani/libvirt,fabianfreyer/libvirt,iam-TJ/libvirt,fabianfreyer/libvirt,taget/libvirt,emaste/libvirt,eskultety/libvirt,VenkatDatta/libvirt,emaste/libvirt,bjzhang/libvirt,nertpinx/libvirt,datto/libvirt,shugaoye/libvirt,wiedi/libvirt,emaste/libvirt,agx/libvirt,jfehlig/libvirt,zhlcindy/libvirt-1.1.4-maintain,novel/fbsd-libvirt,nertpinx/libvirt,iam-TJ/libvirt,emaste/libvirt