Bug 973663

Summary: virt-what does not detect that this is a xen vm
Product: [Fedora] Fedora Reporter: James Patterson <jamespatterson>
Component: virt-whatAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: evan.stachowiak, jamespatterson, lsof, mbooth, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 16:19:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
virt-what patch to better identify non-hypervisors
none
virt-what patch to better identify non-hypervisors (fixed)
none
virt-what patch to better identify non-hypervisors (fixed) none

Description James Patterson 2013-06-12 13:02:01 UTC
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 20:16:42 UTC
(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 09:15:22 UTC
> 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 08:11:26 UTC
Reported to mailing list:
 https://www.redhat.com/archives/virt-tools-list/2013-June/msg00070.html

Comment 4 Evan Stachowiak 2013-08-13 15:05:44 UTC
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 11:43:11 UTC
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 11:50:59 UTC
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 11:51:30 UTC
I will get the patch and post it here.

Comment 8 Need Real Name 2013-08-21 11:55:49 UTC
Created attachment 788830 [details]
virt-what patch to better identify non-hypervisors

Comment 9 Need Real Name 2013-08-21 11:58:39 UTC
Created attachment 788832 [details]
virt-what patch to better identify non-hypervisors (fixed)

Patch needs testing.

Comment 10 Need Real Name 2013-08-21 11:59:59 UTC
Created attachment 788834 [details]
virt-what patch to better identify non-hypervisors (fixed)

Comment 11 Richard W.M. Jones 2013-08-21 12:05:34 UTC
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 15:08:05 UTC
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 16:02:00 UTC
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 13:09:26 UTC
Looks good. Not sure how to put it in the POST state.

Comment 15 Fedora Update System 2013-09-11 13:39:56 UTC
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 13:39:58 UTC
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 16:59:59 UTC
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 16:19:30 UTC
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-23 00:25:29 UTC
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.