#703606 xen-tools: xen-delete-image does not properly detects running status of guests.

#703606#5
Date:
2013-03-21 10:25:26 UTC
From:
To:
Dear Maintainer,

  The xenRunning function used by xen-delete-image to detect if the guest to
delete
is running uses the xm list command. Yet that particular command displays all
created
guests not only those running. There is a --state option that should be used to
check
the machines status.

Here are sample output from one of our Dom0:

 # xm list
  Name                                        ID   Mem VCPUs      State
Time(s)
  Domain-0                                     0  1023     8     r-----
208.0
  machine0.subdomain.domain.tld                1  1024     1     -b----
768.7
  machine1.subdomain.domain.tld                    256     1
0.0
  machine2.subdomain.domain.tld                2   512     1     -b----
38.3
  machine3.subdomain.domain.tld                   2096     2
0.0
  machine4.subdomain.domain.tld                   1024     1
3.8
  machine5.subdomain.domain.tld                   1024     2
113.7
  machine6.subdomain.domain.tld                   1024     1
5.2
  machine7.subdomain.domain.tld                    512     1
0.0
  machine8.subdomain.domain.tld                   4096     3
0.0

 # xm list --state running
  Name                                        ID   Mem VCPUs      State
Time(s)
  Domain-0                                     0  1023     8     r-----
208.0
  machine0.subdomain.domain.tld                1  1024     1     -b----
768.7
  machine2.subdomain.domain.tld                2   512     1     -b----
38.3

Note that 'running' may not be the only state to check and that the --state
option does not seem to accept mulptiple states (e.g. like in --state
running,dying
or --state running --state dying); and looks fairly broken, e.g.:
  # xm list --state blocked

Never lists blocked machines...
So a proper solution might be to more accurately parse the whole output of the
xm list (with no other arguments) command.

Regards

#703606#10
Date:
2013-03-21 10:58:39 UTC
From:
To:
Hi Nicolas,

Nicolas Caniart wrote:

Hrm. I've never seen cases where the State column is empty. From the
xm man page on wheezy I can't get an idea how that can happen either.

How did you create these non-running DomUs?

"paused" is likely to be relevant, too.

		Regards, Axel

#703606#15
Date:
2013-03-21 14:22:11 UTC
From:
To:
Hi Axel:

I believe it is because I use:

  # xm new /etc/xen/<domain>.cfg
  # xm start <domain>
  # xm shutdown <domain>

Which leaves the domain in xen's domain list. Reading other docs,
tutorial and such, I believe most people use:

  # xm create /etc/xen/<domain>.cfg   # create + boot at once
  # xm destroy <domain>

Obviously there are slight differences in the semantics of the new and
create commands. But I'm not completely sure I understand which.
Reading the manual page it would seem they are strictly equivalent,
but it also looks like the part documenting the new command is just a
plain kill/yank of the create one (e.g. it shows the -c option which
makes no sense).

Another way to see the problem is that since xen-tools never operates
on the machines only builds their disks and configuration file, you
should only warn the user that it has not deleted (issued an xm delete
<domain> command), not that the machine is running. It would be more
consistent with the whole xen-tools stack behaviour and provide a more
helpful information.

Regards,

2013/3/21 Axel Beckert <abe@debian.org>:

#703606#20
Date:
2013-03-21 14:42:25 UTC
From:
To:
severity 703606 minor
thank you

Hi,

  But xm new works just fine for me, which surely is because I have
python-lxml installed on the Dom0
(checked, python-lxml is still not a dependency of xen-utils-4.1 so I
must have installed it for another
reason).

I still feel the term "running" in the xen-delete-image message is
misleading (and its way easier to fix than what I thought at first).
I am no xen guru and it's the second time that issue hit me and each
time I scratched my head... Maybe its just me.
Obviously the bug is of lower priority.

Regards,

2013/3/21 Axel Beckert <abe@deuxchevaux.org>: