vmware-scripts
vmware-scripts copied to clipboard
make_vcsp_2022.py: vCenter expect an integer/long for the etag
Hi,
I was testing things with Content Libraries and make_vcsp_2022.py
when I got an error from vCenter when trying to synchronize.
Task Name: Sync Library Item
Status: A general runtime error occurred. An error occurred: For input string: "9d38a60e5008c8567ff2ea84273a0bf5"
The error I found in /storage/log/vmware/content-library/cls.log
2023-06-03T02:47:37.302+02:00 | ERROR | 1f01e3a9-9965-4f01-b8ce-f602bff85a34-7d-51-c5 | cls-simple-activity-2 | SimpleActivityWorker | Exception will not be handled by activity VcspGetFileActivity (handle=24efd964-e765-3fca-9df2-bdd442c2339c, entityId=29b95c02-c870-4029-9f9b-6841a8e1c00e): For input string: "9d38a60e5008c8567ff2ea84273a0bf5"
java.lang.NumberFormatException: For input string: "9d38a60e5008c8567ff2ea84273a0bf5"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_362]
at java.lang.Long.parseLong(Long.java:589) ~[?:1.8.0_362]
at java.lang.Long.valueOf(Long.java:803) ~[?:1.8.0_362]
at com.vmware.cl.vcsp.sync.VcspSyncStrategy.isContentOutdated(VcspSyncStrategy.java:44) ~[cls-main-1.0.0.jar:?]
at com.vmware.cl.vcsp.activities.VcspGetFileActivity.phaseBegin(VcspGetFileActivity.java:117) ~[cls-main-1.0.0.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_362]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_362]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_362]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_362]
at com.vmware.vcloud.activity.toolkit.simple.executor.SimpleActivityWorker.executePhase(SimpleActivityWorker.java:358) [activity-framework-toolkit-1.0.0.jar:?]
at com.vmware.vcloud.activity.toolkit.simple.executor.SimpleActivityWorker.executeActivity(SimpleActivityWorker.java:240) [activity-framework-toolkit-1.0.0.jar:?]
at com.vmware.vcloud.activity.toolkit.simple.executor.SimpleActivityWorker.run(SimpleActivityWorker.java:105) [activity-framework-toolkit-1.0.0.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_362]
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125) [guava-30.1-jre.jar:?]
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69) [guava-30.1-jre.jar:?]
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78) [guava-30.1-jre.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_362]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_362]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_362]
I searched the reason and found that "9d38a60e5008c8567ff2ea84273a0bf5" is the etag
property in the items.json, which is a MD5 formatted in HEX and not a Long.
I also found a document for the Content Subscription Endpoint Specification version 1 but nothing for the version 2.
Anyway, in the first version of the spec, the etag
is supposed to be "An integer representing the version of the file." and it seems like it's still the case with the version 2.
And the items.json generated by vCenter is also using a stringified integer/long for that field.
Finally, vCenter accepts (or maybe doesn't use) the etag
under certain circumstance but, except when adding a new Content Library, I couldn't (didn't try to) understand them.
For information: My vCenter version: 8.0.1 (Build 21560480) The content library: https://download3.vmware.com/software/vmw-tools/lib.json (Nested ESXi)
Can you try make_vcsp_2018.py and see if that resolves it? I actually use that version myself and the 2022 version simply adds support for Azure Blob ...
For the existing CL mentioned below, that works with 8.0 Update 1 env. Just created a new CL to confirm subscription, so that shouldn't be hitting any issues and if so, then something else might be going on
Hi,
The problem was also with the make_vcsp_2018.py
and make_vcsp_2015.py
as they don't generate an int/long for the etag.
And after restarting vCenter the error is gone, so this might just be a bug...
Without an official specification it might be safer to assume that it should be an integer, but I don't know if it's worth the time to try to "fix" it.