RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1173018 - RFE : virt-who in offline mode
Summary: RFE : virt-who in offline mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virt-who
Version: 6.6
Hardware: All
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Radek Novacek
QA Contact: xingge
Laura Novich
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-11 10:12 UTC by Christophe Augello
Modified: 2019-07-11 08:27 UTC (History)
10 users (show)

Fixed In Version: virt-who-0.12-1.el6
Doc Type: Release Note
Doc Text:
virt-who supports offline mode The virt-who service can now report the association between host physical machines and guest virtual machines when the hypervisor is offline, and thus no longer requires connection to the hypervisor to perform this operation. When the virt-who service cannot connect to the hypervisor, due to security policies, for example, users can now obtain information about the host-guest mapping file by using the "virt-who --print" command, which displays the information saved in the mapping file, and sends it to the Subscription Manager.
Clone Of:
Environment:
Last Closed: 2015-07-22 07:15:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1377 0 normal SHIPPED_LIVE virt-who bug fix and enhancement update 2015-07-20 17:58:35 UTC

Comment 1 Radek Novacek 2015-02-26 14:47:25 UTC
This ability is now implement upstream like this:

virt-who has parameter --print that will dump host/guests association as a json. Then there is a fake virt backend that will load that json and use it to put the data to SAM/Satellite.

Is this solution acceptable?

Comment 2 Radek Novacek 2015-02-27 19:41:34 UTC
Fixed by rebase to virt-who-0.12-1.el6.

Comment 4 Stephen Gilson 2015-04-02 16:55:44 UTC
CCS has determined that this bug should be described in the RHEL 6.7 Release Notes. Please update the Doc Text field with a summary feature description.

Comment 5 Liushihui 2015-04-09 08:30:33 UTC
Failed to verify it on virt-who-0.12-2.el6.noarch as virt-who can't send host/gust mapping to SAM server when vcenter forbidden virt-who machine access to it.

Precondition:
Make sure virt-who's system can't access to vcenter directly.

Checked process: 
1. Register system to SAM 
2. Run virt-who at esx mode in command line and also use new option "-p"
[root@hp-z220-06 ~]# virt-who --esx --esx-owner=ACME_Corporation --esx-env=Library --esx-server=10.66.79.68 --esx-username=Administrator --esx-password=qwer1234P! -d -p
[root@hp-z220-06 ~]# virt-who --esx --esx-owner=ACME_Corporation --esx-env=Library --esx-server=10.66.79.68 --esx-username=Administrator --esx-password=qwer1234P! -p -d
2015-04-09 16:27:07,410 INFO: Using configuration "env/cmdline" ("esx" mode)
2015-04-09 16:27:07,520 DEBUG: Log into ESX
2015-04-09 16:28:10,610 ERROR: Virt backend 'env/cmdline' fails with exception:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt/virt.py", line 208, in run
    self._run()
  File "/usr/share/virt-who/virt/esx/esx.py", line 52, in _run
    self.login()
  File "/usr/share/virt-who/virt/esx/esx.py", line 187, in login
    self.sc = self.client.service.RetrieveServiceContent(_this=self.moRef)
  File "/usr/lib/python2.6/site-packages/suds/client.py", line 542, in __call__
    return client.invoke(args, kwargs)
  File "/usr/lib/python2.6/site-packages/suds/client.py", line 602, in invoke
    result = self.send(soapenv)
  File "/usr/lib/python2.6/site-packages/suds/client.py", line 643, in send
    reply = transport.send(request)
  File "/usr/lib/python2.6/site-packages/suds/transport/https.py", line 64, in send
    return  HttpTransport.send(self, request)
  File "/usr/lib/python2.6/site-packages/suds/transport/http.py", line 77, in send
    fp = self.u2open(u2request)
  File "/usr/lib/python2.6/site-packages/suds/transport/http.py", line 118, in u2open
    return url.open(u2request, timeout=tm)
  File "/usr/lib64/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.6/urllib2.py", line 1198, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 110] Connection timed out>
{"hypervisors": []}

Result:
It show some error messages and a null host/guest mapping in the log, it should have three esx hosts in this vcenter. Therefore, reopen it.

Comment 6 Radek Novacek 2015-04-09 09:10:47 UTC
The host/guest mapping needs to be obtained with access to the vCenter first. Then write the result (of 'virt-who -p') to some file and create fake hypervisor pointing to this file (according to virt-who-config man page).

Then it no longer needs to be connected to vCenter and should work normally.

Comment 7 Liushihui 2015-04-09 09:23:53 UTC
Verified it on virt-who-0.12-2.el6.noarch as virt-who can send host/guest mapping to SAM server when it can't access to vcenter directly.

Verified version:
virt-who-0.12-2.el6.noarch
subscription-manager-1.14.1-1.el6.x86_64
python-rhsm-1.14.1-1.el6.x86_64
candlepin-0.9.6.5-1.el6sam.noarch
katello-headpin-1.4.3.28-1.el6sam_splice.noarch

Verified process:
1. Make sure system with virt-who can connect to vcenter, register system and run virt-who with "-p"
[root@hp-z220-06 virt-who.d]# virt-who --esx --esx-owner=ACME_Corporation --esx-env=Library --esx-server=10.66.79.68 --esx-username=Administrator --esx-password=qwer1234P! -p -d > /root/aaa
2. Make sure this system can't connect to vcenter directly.Configure virt-who as the following:
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/virt 
[fake-virt]
type=fake
file=/root/aaa
is_hypervisor=True
owner=ACME_Corporation
env=Library 
[root@hp-z220-06 virt-who.d]# cat /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=10
3. Restart virt-who service 
[root@hp-z220-06 virt-who.d]# service virt-who restart
4. Check the virt-who log.
2015-04-09 16:59:07,997 [DEBUG]  @virtwho.py:84 - Using config named 'fake-virt'
2015-04-09 16:59:07,997 [INFO]  @virtwho.py:475 - Using configuration "fake-virt" ("fake" mode)
2015-04-09 16:59:07,997 [DEBUG]  @virtwho.py:131 - Starting infinite loop with 10 seconds interval
2015-04-09 16:59:08,150 [INFO]  @subscriptionmanager.py:124 - Sending update in hosts-to-guests mapping: {u'564d20f4-71b7-acdb-f875-d64ecec4a6c0': [u'4226082e-2746-17dc-6f01-dc91c6fc7fbb', u'4224d6d4-b9ef-cd33-8f19-56bcfc179ed5'], u'86b2bd00-8bad-11e2-87f4-6c3be514699d': [u'4224a77f-1c50-42cb-3507-2b68b447ed60', u'4224e5d2-4fcf-2bc2-2559-5846035d3a78']}
2015-04-09 16:59:08,151 [DEBUG]  @subscriptionmanager.py:76 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-04-09 16:59:09,065 [INFO]  @virtwho.py:127 - Created host: cd07723f-7032-4a60-9eb4-0c05dc0c2251 with guests: [4226082e-2746-17dc-6f01-dc91c6fc7fbb, 4224d6d4-b9ef-cd33-8f19-56bcfc179ed5]
2015-04-09 16:59:09,065 [INFO]  @virtwho.py:127 - Created host: 1e864c41-0e41-4370-a8f1-8d18fa0ffd49 with guests: [4224a77f-1c50-42cb-3507-2b68b447ed60, 4224e5d2-4fcf-2bc2-2559-5846035d3a78]

Result:virt-who has send the host/guest mapping to SAM, host/guest mapping can show on the SAM web UI. Therefore, verify it.

Comment 9 Radek Novacek 2015-05-07 15:27:36 UTC
The format is just quite simple JSON:

{
    "hypervisors": [
        {
            "uuid": "<unique-identification-of-the-host-1>",
            "guests": [
                "<guest-1-uuid>",
                "<guest-2-uuid>",
                "<guest-3-uuid>",
                ...
            ]
        },
        {
            "uuid": "<unique-identification-of-the-host-2>",
            "guests": [
                "<guest-4-uuid>",
                "<guest-5-uuid>",
                "<guest-6-uuid>",
                ...
            ]
        },
        ...
    ]
}

But getting this info from ESX is quite tricky as this information can't be obtained from vSphere Web Client.

It is possible to use MOB:
1) Go to MOB service content: https://<esx-or-vcenter-server>/mob/?moid=ServiceInstance&doPath=content
2) Note value in the 3rd column on line "rootFolder"
3) Then go to https://<esx-or-vcenter-server>/mob/?moid=ha-property-collector&method=retrievePropertiesEx
4) Paste content of following file into the first box and change the comment starting with "<!-- TODO" to value from step 3
5) Increase the 0 in the second box to something high (like 1000)
6) Press "Invoke method"
7) You should see table with hosts and guests and their uuids bellow
8) Use uuid to build JSON as shown above

Comment 10 Radek Novacek 2015-05-07 15:28:30 UTC
Sorry, I forgot to paste the link to that file (step 4): https://rnovacek.fedorapeople.org/esx-enumerate.xml

Comment 12 errata-xmlrpc 2015-07-22 07:15:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1377.html


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