Hyper-v VM does not have uuid set which breaks virt-who mapping

Solution Verified - Updated

Environment

Hypervisor details:

"hypervisor.type": "hyperv",
"hypervisor.version": "10.0.14393.1532"

For the VM:

RHEL 7.2 VM running on hyper-v

Issue

The RHEL VMs running on hyper-v do not have uuid set which breaks the virt-who mapping

# dmidecode| egrep -i uuid | tr '[:upper:]' '[:lower:]'

uuid: not settable
# subscription-manager facts:

...
virt.host_type: hyperv
virt.is_guest: True
virt.uuid: Not Settable

Resolution

Print out the virt-who mapping with # virt-who -op

...
 "facts": {
                "cpu.cpu_socket(s)": "2",
                "hypervisor.type": "hyperv",
                "hypervisor.version": "10.0.14393.1532"
            },
            "guests": [
                {
                    "attributes": {
                        "active": 1,
                        "virtWhoType": "hyperv"
                    },
                    "guestId": "4546B285-6C41-5D6R-86G5-0BFR4B3625FD",
                    "state": 1
                },
...

From above output we can see a "guestId": "4546B285-6C41-5D6R-86G5-0BFR4B3625FD" for each VM on hyper-v

We can workaround the issue by setting one of these uuid's manually on each VM:

# echo '{"virt.uuid": "4546B285-6C41-5D6R-86G5-0BFR4B3625FD"}' > /etc/rhsm/facts/virt_uuid.facts

Confirm if all was set correctly with:

# subscription-manager facts | grep virt.uuid

You should now have the VM mapped and should be able to subscribe it:

# subscription-manager refresh
# subscription-manager list --available

For more KB articles/solutions related to Virt-who and Virtual Datacenter (VDC) Subscriptions Issues, please refer to the Consolidated Troubleshooting Article for Virt-who and Virtual Datacenter (VDC) Subscriptions Issues

Root Cause

The virt-who mapping fails because the uuid of the VM is not set:

# dmidecode| egrep -i uuid | tr '[:upper:]' '[:lower:]'

uuid: not settable

There is a This content is not included.bugzilla open for this issue

Diagnostic Steps

Verify the uuid for the VM on hyper-v:

# dmidecode| egrep -i uuid | tr '[:upper:]' '[:lower:]'

uuid: not settable

Verify the virt.uuid fact for subscription-manager facts:

# subscription-manager facts:

...
virt.host_type: hyperv
virt.is_guest: True
virt.uuid: Not Settable
SBR
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.