Feature #26600
closedDon't duplicate host record when hypervisor_id changes in virt-who report
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1410601
Description of problem:
for a hypervisor mode, if configure hypervisor_id option to 3 different values(uuid, hostname, hwuuid), it will create 3 entries for the same hypervisor, it should keep an unique entry no matter what hypervisor_id configured.
Version-Release number of selected component (if applicable):
virt-who-0.17-10.el7sat.noarch
subscription-manager-1.17.15-1.el7.x86_64
python-rhsm-1.17.9-1.el7.x86_64
Satellite-6.2.0-RHEL-7-20161219.0/
How reproducible:
always
Steps to Reproduce:
1. configure virt-who for esx mode /etc/virt-who.d/, make sure set hypervisor_id to uuid,such as:
type=esx
hypervisor_id=hostname
owner=Default_Organization
env=Library
server=10.73.130.242
username=administrator@vsphere.local
password=Welcome1!
2. restart virt-who service and check the hypervisor should be sent with uuid:
Host-to-guest mapping: {
"ff9f4d56-f277-a538-9b51-103919b67710": [],
"20024d56-9faa-4267-75c9-0623ef215a23": [
{
"guestId": "422d664a-db1c-2773-462a-d5f308888a54",
"state": 1,
"attributes": {
"active": 1,
"virtWhoType": "esx"
}
},
{
"guestId": "422dbb1d-c5ef-4d58-86f8-fd799f056a9b",
"state": 5,
"attributes": {
"active": 0,
"virtWhoType": "esx"
}
}
]
}
3. check the content host in Satellite webUI, the hypervisors should be registered with uuid:
virt-who-ff9f4d56-f277-a538-9b51-103919b67710-1
virt-who-20024d56-9faa-4267-75c9-0623ef215a23-1
4. change the hypervisor_id to hostname, restart virt-who service, and make sure the hypervisor should be sent with hostname:
Host-to-guest mapping: {
"bootp-73-131-189.rhts.eng.pek2.redhat.com": [],
"bootp-73-130-246.rhts.eng.pek2.redhat.com": [
{
"guestId": "422d664a-db1c-2773-462a-d5f308888a54",
"state": 1,
"attributes": {
"active": 1,
"virtWhoType": "esx"
}
},
{
"guestId": "422dbb1d-c5ef-4d58-86f8-fd799f056a9b",
"state": 5,
"attributes": {
"active": 0,
"virtWhoType": "esx"
}
}
]
}
5. check the content host in Satellite webUI, the hypervisors should be registered with hostname again, but the old uuid entries still exist.
hostname entry:
virt-who-bootp-73-130-246.rhts.eng.pek2.redhat.com-1
virt-who-bootp-73-131-189.rhts.eng.pek2.redhat.com-1
uuid entry:
virt-who-ff9f4d56-f277-a538-9b51-103919b67710-1
virt-who-20024d56-9faa-4267-75c9-0623ef215a23-1
6. change the hypervisor_id to hwuuid, restart virt-who service, and make sure the hypervisor should be sent with hwuuid:
Host-to-guest mapping: {
"host-9": [],
"host-14": [
{
"guestId": "422d664a-db1c-2773-462a-d5f308888a54",
"state": 1,
"attributes": {
"active": 1,
"virtWhoType": "esx"
}
},
{
"guestId": "422dbb1d-c5ef-4d58-86f8-fd799f056a9b",
"state": 5,
"attributes": {
"active": 0,
"virtWhoType": "esx"
}
}
]
7. check the content host in Satellite webUI, the hypervisors should be registered with hwuuid again, but the old uuid entries still exist, now we have three different entries for the same hypervisor:
hwuuid entry:
virt-who-host-14-1
virt-who-host-9-1
hostname entry:
virt-who-bootp-73-130-246.rhts.eng.pek2.redhat.com-1
virt-who-bootp-73-131-189.rhts.eng.pek2.redhat.com-1
uuid entry:
virt-who-ff9f4d56-f277-a538-9b51-103919b67710-1
virt-who-20024d56-9faa-4267-75c9-0623ef215a23-1
Actual results:
for the same hypervisor, will create 3 different entries in Satellite WebUI
Expected results:
for the same hypervisor, no matter what I change the different hypervisor_id value, it should keep the unique entry. for example:
if hypervisor_id=uuid, send the uuid entry to satellite, delete other entries.
if hypervisor_id=hostname, send the hostname entry to satellite, delete other entries.
if hypervisor_id=hwuuid, send the hwuuid entry to satellite, delete other entries.