Bug 973663 - virt-what does not detect that this is a xen vm
virt-what does not detect that this is a xen vm
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: virt-what (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-12 09:02 EDT by James Patterson
Modified: 2013-09-22 20:25 EDT (History)
6 users (show)

See Also:
Fixed In Version: virt-what-1.13-2.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-20 12:19:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
virt-what patch to better identify non-hypervisors (735 bytes, text/plain)
2013-08-21 07:55 EDT, Need Real Name
no flags Details
virt-what patch to better identify non-hypervisors (fixed) (735 bytes, text/plain)
2013-08-21 07:58 EDT, Need Real Name
no flags Details
virt-what patch to better identify non-hypervisors (fixed) (586 bytes, patch)
2013-08-21 07:59 EDT, Need Real Name
no flags Details | Diff

  None (edit)
Description James Patterson 2013-06-12 09:02:01 EDT
Description of problem:
# virt-what
xen
# virt-version
1.11

On a RHEL6.3 Xen VM, the following file does not exist:
 /proc/xen/capabilities

# ls -R /proc/xen/capabilities
(nothing)

Looking at the code, it seems that this file is relied on.

I'd suggest changing the logic to:
1. If /proc/xen exists, it's a xen vm or hypervisor
2. If /proc/xen/capabilities exists and contains the string control_d, it's a Xen Hypervisor
3. Otherwise it's a Xen VM

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Richard W.M. Jones 2013-06-12 16:16:42 EDT
(In reply to James Patterson from comment #0)
> Description of problem:
> # virt-what
> xen

This is working isn't it?

> # virt-version
> 1.11
> 
> On a RHEL6.3 Xen VM, the following file does not exist:
>  /proc/xen/capabilities

The RHEL 6.3 machine is a guest?

> # ls -R /proc/xen/capabilities
> (nothing)

I don't get this because if I do a similar command I get an error:

$ ls -R /foobar
ls: cannot access /foobar: No such file or directory

Do you mean there is an error, or something else?

Can you run something more informative such as:

  ls -lR /proc/xen

I'm afraid I won't be able to fix this because I don't have a Xen
VM.  However you can send patches or suggestions upstream to the
virt-tools mailing list.
Comment 2 James Patterson 2013-06-13 05:15:22 EDT
> This is working isn't it?

Kind of. It's telling me it's a Xen thing, but not that it's a Xen VM.

> The RHEL 6.3 machine is a guest?

Yes.

> ls -lR /proc/xen

This returns nothing.
Comment 3 James Patterson 2013-06-14 04:11:26 EDT
Reported to mailing list:
 https://www.redhat.com/archives/virt-tools-list/2013-June/msg00070.html
Comment 4 Evan Stachowiak 2013-08-13 11:05:44 EDT
I am also seeing this issue on an AWS (Xen) instance: 

CentOS release 6.4

virt-what --version
1.11
sudo virt-what
xen
Comment 5 Richard W.M. Jones 2013-08-21 07:43:11 EDT
This still needs someone to come up with & test an actual patch.
I don't have access to a suitable Xen VM right now.
Comment 6 Need Real Name 2013-08-21 07:50:59 EDT
You mean you want me to write the logic from my original bug report description in the form of a patch? It's a simple change, but I can do that if you want.

Won't that mean paperwork and assignment of copyright, etc.?
Comment 7 Need Real Name 2013-08-21 07:51:30 EDT
I will get the patch and post it here.
Comment 8 Need Real Name 2013-08-21 07:55:49 EDT
Created attachment 788830 [details]
virt-what patch to better identify non-hypervisors
Comment 9 Need Real Name 2013-08-21 07:58:39 EDT
Created attachment 788832 [details]
virt-what patch to better identify non-hypervisors (fixed)

Patch needs testing.
Comment 10 Need Real Name 2013-08-21 07:59:59 EDT
Created attachment 788834 [details]
virt-what patch to better identify non-hypervisors (fixed)
Comment 11 Richard W.M. Jones 2013-08-21 08:05:34 EDT
I don't quite understand certain things about this:

(1) Why did you move the echo xen inside both branches of the
if statement?  That appears unnecessary.

(2) In comment 0 you said that:

  # ls -R /proc/xen/capabilities

prints nothing.  However if a file does not exist,
I get an error message, not no output.

--

No copyright assignment is necessary.
Comment 12 Need Real Name 2013-08-21 11:08:05 EDT
1. Because the first if block does this. Seems strange to me but...

2. It prints nothing to STDOUT.
Comment 13 Richard W.M. Jones 2013-09-02 12:02:00 EDT
OK, I hope this (rather simple in the end) change is
correct:

http://git.annexia.org/?p=virt-what.git;a=commitdiff;h=acd6bec92a99550ad98011d44f6381fdf7fa5992

If it is, please put the bug in "POST" state and I'll
push the change to Fedora.
Comment 14 Need Real Name 2013-09-11 09:09:26 EDT
Looks good. Not sure how to put it in the POST state.
Comment 15 Fedora Update System 2013-09-11 09:39:56 EDT
virt-what-1.13-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/virt-what-1.13-2.fc19
Comment 16 Fedora Update System 2013-09-11 09:39:58 EDT
virt-what-1.13-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/virt-what-1.13-2.fc20
Comment 17 Fedora Update System 2013-09-11 12:59:59 EDT
Package virt-what-1.13-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing virt-what-1.13-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-16439/virt-what-1.13-2.fc20
then log in and leave karma (feedback).
Comment 18 Fedora Update System 2013-09-20 12:19:30 EDT
virt-what-1.13-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2013-09-22 20:25:29 EDT
virt-what-1.13-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

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