VMware {code} Community
ICTKevinWong
Contributor
Contributor

Local Plugin: Sending an API call to another vCenter instance LinkedMode

I am working on a defect for my company and we send API calls to the alternative vCenter if it is in linkedMode (pseudo code below). I am looking for ways to redirect or figure out CrossCall calls from one to the other, but it is failing with a 401 unauth before it even gets to the homebrewed authentication method.
 
vCenter 7u2
YaviJava 6.0.05 GA
 
 
What the API call looks like and how redirection is essentially done.
On vCenter A:
@RequestMapping(method = POST, value = "/{vsphereAddress}/account")
public @ResponseBody Account createAccount(@PathVariable @NOTNULL String vsphereAddress)
 
...
// homebrewed auth method
...
 
if (vsphere.isLocal(vsphereAddress)) {
// DO ACTION
}
else {
// Use Jersey Client to send exact same API call to vCenter B
}
 
 
 
To Resolve this, I added Spring Security to add 'permitAll' for noauth calling and the deployment seems to be timing out and failing to deploy.
 
 
Error Deploying Plug-in. The Deployment operation timed out
 
In vCenter: Under Tasks:
Error Deploying Plug-in. The Deployment operation timed out
 
Under administration-> Client Plugins when I hover over my failed plugin status
Error deploying plug-in. java.lang.InterruptedException java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1041)
 
 
 
Pom.XML excerpt
 

<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

 
Spring Security Configuration
 
<security:http use-expressions="true" auto-config="true">
<security:intercept-url pattern="/**" access="permitAll" />
</security:http>
 
Eventlog.log shows no errors
 
[2021-07-30T02:06:21.739Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=RESOLVED
[2021-07-30T02:06:21.739Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=RESOLVED
[2021-07-30T02:06:21.739Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=RESOLVED
[2021-07-30T02:06:21.739Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=RESOLVED
[2021-07-30T02:06:21.740Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=RESOLVED
[2021-07-30T02:06:21.740Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=RESOLVED
[2021-07-30T02:06:21.750Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=STARTING
[2021-07-30T02:06:21.750Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=STARTED
[2021-07-30T02:06:21.751Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=STARTING
[2021-07-30T02:06:21.751Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=STARTED
[2021-07-30T02:06:21.751Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=STARTING
[2021-07-30T02:06:21.751Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=STARTED
[2021-07-30T02:06:21.751Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=STARTING
[2021-07-30T02:06:21.752Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=STARTED
[2021-07-30T02:06:21.752Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=STARTING
[2021-07-30T02:06:22.065Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=STARTED
[2021-07-30T02:06:22.065Z] [INFO ] blueprint-postprocessor-34 Initializing context for bundle com.<COMPANY>-dataservice
[2021-07-30T02:06:22.065Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=STARTING
[2021-07-30T02:06:22.066Z] [INFO ] blueprint-postprocessor-34 Initialization of an application context for bundle com.<COMPANY>-dataservice STARTED
[2021-07-30T02:06:22.068Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=STARTED
[2021-07-30T02:06:22.079Z] [INFO ] blueprint-postprocessor-35 Initializing context for bundle com.<COMPANY>-war
[2021-07-30T02:06:22.080Z] [INFO ] blueprint-postprocessor-35 Initializing spring context for web bundle: com.<COMPANY>-war
[2021-07-30T02:08:22.196Z] [INFO ] http-nio-5090-exec-13 70000065 100006 200002 [BundleEvent] Bundle=org.apache.thrift:0.13.0 Type=STARTING
[2021-07-30T02:08:22.198Z] [INFO ] http-nio-5090-exec-13 70000065 100006 200002 [BundleEvent] Bundle=org.apache.thrift:0.13.0 Type=STARTED
[2021-07-30T02:16:21.266Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=STOPPING
[2021-07-30T02:16:21.267Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=STOPPED
[2021-07-30T02:16:21.270Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=STOPPING
[2021-07-30T02:16:21.272Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=STOPPED
[2021-07-30T02:16:21.283Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=STOPPING
[2021-07-30T02:16:21.284Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=STOPPED
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=STOPPING
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=STOPPED
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=STOPPING
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=STOPPED
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=STOPPING
[2021-07-30T02:16:21.285Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=STOPPED
[2021-07-30T02:16:21.326Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=UNRESOLVED
[2021-07-30T02:16:21.351Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-war:4.8.0 Type=UNINSTALLED
[2021-07-30T02:16:21.354Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=UNRESOLVED
[2021-07-30T02:16:21.355Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.javax.validation:1.0.0.GA Type=UNINSTALLED
[2021-07-30T02:16:21.368Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=UNRESOLVED
[2021-07-30T02:16:21.385Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.<COMPANY>-dataservice:4.8.0 Type=UNINSTALLED
[2021-07-30T02:16:21.397Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=UNRESOLVED
[2021-07-30T02:16:21.401Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.hsqldb.hsqldb:2.5.2 Type=UNINSTALLED
[2021-07-30T02:16:21.402Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=UNRESOLVED
[2021-07-30T02:16:21.412Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm.attrs:1.5.3 Type=UNINSTALLED
[2021-07-30T02:16:21.415Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=UNRESOLVED
[2021-07-30T02:16:21.423Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=com.springsource.org.objectweb.asm:1.5.3 Type=UNINSTALLED
[2021-07-30T02:16:21.430Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.osgi.service.subsystem.region.context.10:1.0.0 Type=STOPPING
[2021-07-30T02:16:21.430Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.osgi.service.subsystem.region.context.10:1.0.0 Type=STOPPED
[2021-07-30T02:16:21.431Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.osgi.service.subsystem.region.context.10:1.0.0 Type=UNRESOLVED
[2021-07-30T02:16:21.431Z] [INFO ] plugin-deploy15 [BundleEvent] Bundle=org.osgi.service.subsystem.region.context.10:1.0.0 Type=UNINSTALLED
 
Any ideas or thoughts?
Labels (1)
0 Kudos
1 Reply
_vladi_
VMware Employee
VMware Employee

The plugin war bundle did not deploy successfully. You need to fix this before testing any further.

The cause of the InterruptedException that is thrown can be seen in full from the Task Console or the vsphere_client_virgo.log. Please check that to analyze the issue.

Other than that, you have a login to the SSO (session ID) which means access to all vCenters. Please verify if the requests to the first vCenter (in the local case) matches the request to the second vCenter (in the other case).

Cheers,

Vladi

0 Kudos