Bug 1337859 - virt-who will show "Communication with subscription manager failed with code 500" for hyper-v mode
Summary: virt-who will show "Communication with subscription manager failed with code ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: Unspecified
Hardware: x86_64
OS: Linux
high
high
Target Milestone: Unspecified
Assignee: Partha Aji
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: GSS_Sat6Beta_Tracker, GSS_Sat6_Tracker
TreeView+ depends on / blocked
 
Reported: 2016-05-20 09:30 UTC by Eko
Modified: 2019-09-26 14:00 UTC (History)
11 users (show)

Fixed In Version: rubygem-katello-3.0.0.53-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:26:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
foreman debug info (305.62 KB, application/x-xz)
2016-05-25 07:04 UTC, Eko
no flags Details

Description Eko 2016-05-20 09:30:24 UTC
Description of problem:
configure virt-who with hyper-v, sometimes, virt-who will show error message:
Unable to send data: Communication with subscription manager failed with code 500: Task 280df62d-63f6-49fb-a2c3-bf02d299b70e: ActiveRecord::StatementInvalid: PG::Error: ERROR:  null value in column "host_id" violates not-null constraint
: INSERT INTO "katello_subscription_facets" ("autoheal", "registered_at", "uuid") VALUES ($1, $2, $3) RETURNING "id"


Version-Release number of selected component (if applicable):
- Satellite-6.2.0-20160518.1
- RHEL-7.3-20160517.n.0 Server x86_64
- virt-who-0.17-1.el7.noarch
- subscription-manager-1.17.6-1.el7.x86_64

How reproducible:
80%

Steps to Reproduce:
1. deploy Satellite-6.2.0-20160518.1

2. install host with RHEL-7.3-20160517.n.0 Server x86_64 for testing

3. register host to sat6.2

4. run virt-who with hyper-v mode
# virt-who --hyperv --hyperv-owner=ACME_Corporation --hyperv-env=Library --hyperv-server=10.73.5.220 --hyperv-username=Administrator --esx-password=Welcome1 -d
2016-05-20 05:18:26,878 [virtwho.init INFO] MainProcess(32401):MainThread @main.py:main:157 - Using configuration "env/cmdline" ("hyperv" mode)
2016-05-20 05:18:26,879 [virtwho.init INFO] MainProcess(32401):MainThread @main.py:main:159 - Using reporter_id='hp-z220-12.qe.lab.eng.nay.redhat.com-981fc52581194b43af6115db34651494'
2016-05-20 05:18:26,880 [virtwho.main DEBUG] MainProcess(32401):MainThread @executor.py:run:171 - Starting infinite loop with 60 seconds interval
2016-05-20 05:18:26,906 [virtwho.env_cmdline DEBUG] MainProcess(32401):MainThread @hyperv.py:__init__:472 - Hyper-V url: http://10.73.5.220:5985/wsman
2016-05-20 05:18:26,907 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @virt.py:run:364 - Virt backend 'env/cmdline' started
2016-05-20 05:18:26,920 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_negotitate:64 - Using NTLM authentication
2016-05-20 05:18:26,923 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_authenticate:77 - Sending NTLM authentication data
2016-05-20 05:18:26,942 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_authenticate:100 - NTLM authentication successful
2016-05-20 05:18:26,944 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:getHostGuestMapping:520 - Unable to enumerate using root/virtualization namespace, trying root/virtualization/v2 namespace
2016-05-20 05:18:29,545 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @virt.py:enqueue:357 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-05-20 05:18:29,555 [virtwho.main DEBUG] MainProcess(32401):MainThread @subscriptionmanager.py:_connect:123 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-05-20 05:19:14,099 [virtwho.main DEBUG] MainProcess(32401):MainThread @subscriptionmanager.py:hypervisorCheckIn:168 - Checking if server has capability 'hypervisor_async'
2016-05-20 05:19:27,609 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_negotitate:64 - Using NTLM authentication
2016-05-20 05:19:27,612 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_authenticate:77 - Sending NTLM authentication data
2016-05-20 05:19:27,636 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @hyperv.py:retry_ntlm_authenticate:100 - NTLM authentication successful
2016-05-20 05:19:30,215 [virtwho.env_cmdline DEBUG] HyperV-1(32408):MainThread @virt.py:enqueue:357 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-05-20 05:19:38,395 [virtwho.main DEBUG] MainProcess(32401):MainThread @subscriptionmanager.py:hypervisorCheckIn:180 - Server does not have 'hypervisors_async' capability
2016-05-20 05:19:38,395 [virtwho.main INFO] MainProcess(32401):MainThread @subscriptionmanager.py:hypervisorCheckIn:191 - Sending update in hosts-to-guests mapping for config "env/cmdline": 1 hypervisors and 1 guests found
2016-05-20 05:19:38,395 [virtwho.main DEBUG] MainProcess(32401):MainThread @subscriptionmanager.py:hypervisorCheckIn:192 - Host-to-guest mapping: {
    "564D900A-2E82-672D-2CB7-C17F0B3FF876": [
        {
            "guestId": "EBBF4A99-85AD-0947-AB31-45DD18FE96E5", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "hyperv"
            }
        }
    ]
}
2016-05-20 05:20:07,550 [virtwho.main ERROR] MainProcess(32401):MainThread @executor.py:send:143 - Unable to send data: Communication with subscription manager failed with code 500: Task c712acda-3ba0-4102-9060-b82e78c1bc15: ActiveRecord::StatementInvalid: PG::Error: ERROR:  null value in column "host_id" violates not-null constraint
: INSERT INTO "katello_subscription_facets" ("autoheal", "registered_at", "uuid") VALUES ($1, $2, $3) RETURNING "id"
2016-05-20 05:20:07,550 [virtwho.main DEBUG] MainProcess(32401):MainThread @executor.py:send_report:108 - Report from "env/cmdline" failed to sent


Actual results:
sent mapping info to sat6.2 failed
Communication with subscription manager failed with code 500
ERROR:  null value in column "host_id" violates not-null constraint
: INSERT INTO "katello_subscription_facets" ("autoheal", "registered_at", "uuid") VALUES ($1, $2, $3) RETURNING "id"

Expected results:
virt-who should send the info normally

Additional info:

Comment 2 Radek Novacek 2016-05-24 12:39:24 UTC
virt-who is getting error 500 from candlepin, reassigning.

ERROR:  null value in column "host_id" violates not-null constraint
: INSERT INTO "katello_subscription_facets" ("autoheal", "registered_at", "uuid") VALUES ($1, $2, $3) RETURNING "id"

Comment 3 Barnaby Court 2016-05-24 13:32:25 UTC
Looks like an issue with the katello API given the error about inserting into the katello_subscription_facets table.

Comment 5 Tom McKay 2016-05-24 16:42:09 UTC
Please attach foreman-debug logs

Comment 6 Eko 2016-05-25 07:04:41 UTC
Created attachment 1161321 [details]
foreman debug info

Comment 10 Eko 2016-06-02 08:40:46 UTC
still can reproduce with Satellite-6.2.0-RHEL-7-20160601.0 build.
1). run virt-who with hyper-v first time, the info can be sent normally
2). re-run virt-who again, send info failed with "INSERT INTO "katello_subscription_facets" ...
3). unregister the hypervisor uuid from WebUI, choose "Completely deletes the host record and removes all reporting, provisioning, and configuration information. " 
4). re-run virt-who with hyper-v, the info can be sent

the result is if the hyper-v hypervisor UUID is already exist in sat6.2 database, restart vrit-who to send info failed.

Comment 11 Eko 2016-06-08 05:57:40 UTC
still can reproduce with Satellite-6.2.0-RHEL-7-20160607.1 build.
virt-who + hyper-v testing blocked

Comment 12 Eko 2016-06-13 05:49:57 UTC
reproduced with Satellite-6.2.0-RHEL-7-20160610.0 build.

Comment 13 Tom McKay 2016-06-20 20:10:42 UTC
satellite-6.2.0-15.1.beta.el7sat.noarch

I tried:

1. register a physical system
2. register a libvirt vm running on that system
3. run virt-who --one-shot --debug which succeeds
4. re-run virt-who --one-shot --debug which succeeds
5. remove vm using ui, removing completely
6. virt-who works
7. re-register vm
8. virt-who works

I am unsure how to proceed in reproducing this.

Comment 24 Mike McCune 2016-06-24 16:59:59 UTC
This is being moved to POST as it depends on the code in https://bugzilla.redhat.com/show_bug.cgi?id=1340088

and should be retested when that bug lands.

Comment 25 Eko 2016-07-08 09:32:42 UTC
verified with Satellite-6.2.0-RHEL-7-20160707.1,

virt-who can send hyper-v host/guests info to sat server normally.

Comment 26 Bryan Kearney 2016-07-27 11:26:58 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://access.redhat.com/errata/RHBA-2016:1501


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