Bug 1502821

Summary: Enabling VIRTWHO_DISABLE_ASYNC breaks virt-who reporting
Product: Red Hat Enterprise Linux 7 Reporter: Chris Snyder <csnyder>
Component: virt-whoAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: csnyder, wpoteat, yuefliu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:47:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chris Snyder 2017-10-16 19:08:32 UTC
Description of problem:

Using the environment variable 'VIRTWHO_DISABLE_ASYNC' causes virt-who to send data formatted for the synchronous hypervisor checkin API endpoint to the asynchronous hypervisor checkin API endpoint.

Version-Release number of selected component (if applicable):
versions of virt-who newer than (or equal to) virt-who-0.15-1 (including upstream master) 

How reproducible:
100%

Steps to Reproduce:
1) Start up candlepin master (or any version newer than or equal to 2.0)
2) Configure virt-who to report to that instance of Candlepin (example below)
3) `export VIRTWHO_DISABLE_ASYNC=1` (in the shell you're about to use to execute virt-who)
4) run virt-who: `./virt-who -o -d`
5) watch candlepin logs to see it blow up: `tail -f /var/log/candlepin/candlepin.log`


Example.conf:
"""
[fake_candle]
type=fake
file=/tmp/fake.json
is_hypervisor=True
owner=admin
env=admin
rhsm_hostname=localhost
rhsm_port=8443
rhsm_username=admin
rhsm_password=admin
rhsm_prefix=/candlepin
rhsm_insecure=1

"""

Contents of /tmp/fake.json:
"""
{
    "hypervisors": [
        {
            "uuid": "CSNYDER_TEST_HYPERVISOR_ID",
            "guests": [
                {
                    "guestId": "07ED8178-95D5-4244-BC7D-582A54A48FF8",
                    "state": 1,
                    "attributes": {
                        "active": 1,
                        "virtWhoType": "esx"
                    }
                }
            ]
        }
    ]
}
"""

Actual results:

Failure to perform the hypervisorUpdateJob (with a traceback like the following in /var/log/candlepin/candlepin.log):
"""
2017-10-16 14:34:52,027 [thread=QuartzScheduler_Worker-15] [job=hypervisor_update_24e9b6da-69b3-4951-9c76-a25ea63d21e3, org=, csid=] ERROR org.candlepin.util.Util - Could no de-serialize the following json {"CSN
YDER_TEST_HYPERVISOR_ID": [{"guestId": "07ED8178-95D5-4244-BC7D-582A54A48FF8", "state": 1, "attributes": {"active": 1, "virtWhoType": "esx"}}]}
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "CSNYDER_TEST_HYPERVISOR_ID" (class org.candlepin.pinsetter.tasks.HypervisorUpdateJob$HypervisorList), not marked as ignorable
 (2 known properties: "hypervisors", "consumers"])
 at [Source: {"CSNYDER_TEST_HYPERVISOR_ID": [{"guestId": "07ED8178-95D5-4244-BC7D-582A54A48FF8", "state": 1, "attributes": {"active": 1, "virtWhoType": "esx"}}]}; line: 1, column: 33] (through reference chain: o
rg.candlepin.pinsetter.tasks.HypervisorList["CSNYDER_TEST_HYPERVISOR_ID"])
        at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:744) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1306) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1284) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:243) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066) ~[jackson-databind-2.4.5.jar:2.4.5]
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2161) ~[jackson-databind-2.4.5.jar:2.4.5]
        at org.candlepin.util.Util.fromJson(Util.java:378) ~[classes/:]
        at org.candlepin.pinsetter.tasks.HypervisorUpdateJob.toExecute(HypervisorUpdateJob.java:214) [classes/:]
        at org.candlepin.pinsetter.tasks.HypervisorUpdateJob$$EnhancerByGuice$$edffeb1.CGLIB$toExecute$1(<generated>) [guice-3.0.jar:]
        at org.candlepin.pinsetter.tasks.HypervisorUpdateJob$$EnhancerByGuice$$edffeb1$$FastClassByGuice$$af260766.invoke(<generated>) [guice-3.0.jar:]
        at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228) [guice-3.0.jar:na]
        at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:72) [guice-3.0.jar:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) [guice-persist-3.0.jar:na]
        at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:72) [guice-3.0.jar:na]
        at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:52) [guice-3.0.jar:na]
        at org.candlepin.pinsetter.tasks.HypervisorUpdateJob$$EnhancerByGuice$$edffeb1.toExecute(<generated>) [guice-3.0.jar:]
        at org.candlepin.pinsetter.tasks.KingpinJob.execute(KingpinJob.java:89) [classes/:]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.1.jar:na]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:na]
2017-10-16 14:34:52,028 [thread=QuartzScheduler_Worker-15] [job=hypervisor_update_24e9b6da-69b3-4951-9c76-a25ea63d21e3, org=, csid=] ERROR org.candlepin.pinsetter.tasks.HypervisorUpdateJob - HypervisorUpdateJob 
encountered a problem.
"""


Expected results:

I either expect this environment variable to be removed,
 OR 
to have it cause virt-who to report to the synchronous endpoint with properly formatted data when enabled.

Comment 1 Eko 2017-10-17 05:50:31 UTC
we never tested this variable before because there is no any documents included this feature, and also can't find it by "man virt-who" or "man virt-who-config", I agree to remove it.

Comment 6 errata-xmlrpc 2018-10-30 10:47:13 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-2018:3169