Host to guest mapping with Virt-who and fake hypervisor

Problem:
Host to guest mapping not working on katello using virt-who and a fake hypervisor (AHV)

Expected outcome:
When sending to katello a fake virt-who mapping json file
I expect to assign licenses to my guests correctly.

The wirt-who log says: Hosts-to-guests mapping for config “fake-virt”: 1 hypervisors and 3 guests found
And the json file is uploaded correctly.

I can assign to my fake hypervisor a VDC license
but I cannot see my guests as part of the content host.

When I try to assign a license, on candelpin server (in debug mode) I can see:
WARN org.candlepin.bind.PreEntitlementRulesCheckOp - Entitlement not granted: [virt.guest.host.does.not.match.pool.owner] for pool: 8a84becb68cd8f140168dc73f91e04cc
ERROR org.candlepin.bind.BindChain - Skipped chain in preprocess of operation PreEntitlementRulesCheckOp

And on client side I see:
Pool “8a84becb68cd8f140168dc73f91e04cc” is restricted to guests running on host: “0ea35d1d-3f34-450f-9289-47bfb9193519”

Foreman and Proxy versions:
1.20.1

Foreman and Proxy plugin versions:
foreman_virt_who_configure 0.3.0
katello 3.10.0

Other relevant data:

logs


#/etc/virt-who.d/fake.conf
[fake-virt]
type=fake
file=/etc/virt-who.d/json/fake.json
is_hypervisor=True
owner=XXXX
env=Library
rhsm_hostname=foreman.XXXX
rhsm_username=virt_who_reporter_2
rhsm_encrypted_password=my_encrypted_password
rhsm_prefix=/rhsm


#/etc/virt-who.d/json/fake.json
{
"hypervisors":[
{"uuid": "myfake-ahv",
"guests":[
   {"guestId": "995b396b-1aed-4624-9dd8-e8bb3eb4353e", "state":1, "attributes": {"active": 1, "virtWhoType": "fake"} },
   {"guestId": "7c5917bf-b412-4cd8-a60c-2375291e21ab", "state":1, "attributes": {"active": 1, "virtWhoType": "fake"} },
   {"guestId": "e25a3fa8-59b2-42a0-b645-b78f09872fa9", "state":1, "attributes": {"active": 1, "virtWhoType": "fake"} }
	]	
}
]}


# virt-who -d -o -c /etc/virt-who.d/fake.conf

2019-02-12 10:21:28,305 [virtwho.destination_7213977238706796299 DEBUG] MainProcess(145005):Thread-3 @subscriptionmanager.py:hypervisorCheckIn:246 - Host-to-guest mapping being sent to 'XXXX': {
    "hypervisors": [
        {
            "hypervisorId": {
                "hypervisorId": "myfake-ahv"
            }, 
            "guestIds": [
                {
                    "guestId": "7c5917bf-b412-4cd8-a60c-2375291e21ab", 
                    "state": 1, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "fake"
                    }
                }, 
                {
                    "guestId": "995b396b-1aed-4624-9dd8-e8bb3eb4353e", 
                    "state": 1, 
                    "attributes": {
                        "active": 1, 
                        "virtWhoType": "fake"
                    }
                }, 
                {
                    "guestId": "e25a3fa8-59b2-42a0-b645-b78f09872fa9", 
                    "state": 1, 
                    "attributes": {
                        "active": 1, 
                        "virtWhoType": "fake"
                    }
                }
            ]
        }
    ]
}


Hi,

this is just a wild guess based on my experience with virt-who.
The env setting seems off to me. I would expect something like Library/Content_View.
On your virt-who host, could you run subscription-manager identity and update the env field wih the content of the environment_name from that output.

Thanks for the quick answer. I double checked that setting.
My output for subscription-manager identity env name is correct:

environment name: Library

Is there a way to query candlepin asking for “current host to guest map” ?

I’m quite sure there is some way to do that, but none that I am aware of.
Maybe someone with better knowledge if the inner workings with candlepin can help, but if the config is correct, I’m out of ideas.

please confirm that those are system uuids for the guests and not consumer uuids.

1 Like

The guest

hammer host info --id 52

Id:                       52
[...]
Global Status: Warning

Subscription Information: 
    UUID:                          7c5917bf-b412-4cd8-a60c-2375291e21ab
    Last Checkin:                  2019-02-13 07:21:12 UTC
    Service Level:                 Standard
    Release Version:               5.11
    Autoheal:                      true
    Registered To:                 xxxxx
    Registered At:                 2019-02-11 17:03:13 UTC
    Registered by Activation Keys:

And the fake hypervisor:

# hammer host info --id 60
Id:                       60
Name:                     virt-who-myfake-ahv-3
Cert name:                virt-who-myfake-ahv-3
Managed:                  no
Installed at:             
Last report:              
Status:                   
    Global Status: OK

Operating system:         
    Build:                  no
    Custom partition table:
Parameters:               

All parameters:           

Additional info:          
    Owner:      Anonymous Admin
    Owner Type: User
    Enabled:    no
    Comment:
Content Information:      
    Applicable Packages: 
    Upgradable Packages:
Subscription Information: 
    UUID:            0ea35d1d-3f34-450f-9289-47bfb9193519
    Last Checkin:    2019-02-11 17:08:37 UTC
    Service Level:   Standard
    Release Version: 
    Autoheal:        true
    Registered To:   
    Registered At:   2019-02-11 11:57:03 UTC

Solved.
I used the wrong uuids in fake wirt-who maping.
When you send your JSON data you have to be sure to NOT use “foreman uuids” assigned to machines
but the real ones from:

# subscription-manager facts | grep virt.uuid