I'm not sure why the direct api requests are not working, but in general
I would suggest to use one of the sdks or ansible to interact with ovirt.
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/stop_v...
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_...
https://docs.ansible.com/ansible/latest/modules/ovirt_vm_module.html
Then you have a nice abstraction layer. Makes working with ovirt api
easier for me :)
Greetings
Klaas
On 19.04.20 16:21, Ali Gusainov wrote:
According to
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/...
trying to use
curl --insecure -v -u admin@internal:password -H Content-type: application/xml -X POST
https://FQDN/ovirt-engine/api/vms/VM_NAME/ACTION
where ACTION start or stop
Got following:
* About to connect() to FQDN port 443 (#0)
* Trying SERVER_IP...
* Connected to FQDN (SERVER_IP) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/ovirt-engine/ca.pem
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=FQDN........
* start date: Jan 22 06:12:15 2020 GMT
* expire date: Dec 27 06:12:15 2024 GMT
* common name: FQDN
* issuer: CN=FQDN.........
* Server auth using Basic with user 'admin@internal'
> POST /ovirt-engine/api/vms/VM_NAME/ACTION HTTP/1.1
> Authorization: Basic YWRtaW5AaW50ZXJuYWw6U3lzVGVhbTEzYw==
> User-Agent: curl/7.29.0
> Host: FQDN
> Accept: application/xml
>
< HTTP/1.1 404 Not Found
< Date: Sun, 19 Apr 2020 00:20:04 GMT
< Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
< Content-Length: 0
< Correlation-Id: 15e7a226-8982-47ff-9f68-7a2519705856
<
* Connection #0 to host FQDN left intact
--------------
tail -1000f /var/log/ovirt-engine/server.log:
2020-04-18 20:20:04,354-04 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default
task-385) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: HTTP 404
Not Found
at
org.ovirt.engine.api.restapi.resource.AbstractBackendResource.asGuidOr404(AbstractBackendResource.java:355)
[restapi-jaxrs.jar:]
at
org.ovirt.engine.api.restapi.resource.AbstractBackendSubResource.<init>(AbstractBackendSubResource.java:26)
[restapi-jaxrs.jar:]
at
org.ovirt.engine.api.restapi.resource.AbstractBackendActionableResource.<init>(AbstractBackendActionableResource.java:39)
[restapi-jaxrs.jar:]
at
org.ovirt.engine.api.restapi.resource.BackendVmResource.<init>(BackendVmResource.java:114)
[restapi-jaxrs.jar:]
at
org.ovirt.engine.api.restapi.resource.BackendVmsResource.getVmResource(BackendVmsResource.java:164)
[restapi-jaxrs.jar:]
at sun.reflect.GeneratedMethodAccessor1357.invoke(Unknown Source) [:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_232]
at
org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:69)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:105)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:132)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
[resteasy-jaxrs-3.7.0.Final.jar:3.7.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
[jboss-servlet-api_4.0_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:81)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:227)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:149)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.api.restapi.invocation.VersionFilter.doFilter(VersionFilter.java:178)
[restapi-jaxrs.jar:]
at org.ovirt.engine.api.restapi.invocation.VersionFilter.doFilter(VersionFilter.java:98)
[restapi-jaxrs.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.api.restapi.invocation.CurrentFilter.doFilter(CurrentFilter.java:117)
[restapi-jaxrs.jar:]
at org.ovirt.engine.api.restapi.invocation.CurrentFilter.doFilter(CurrentFilter.java:72)
[restapi-jaxrs.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.RestApiSessionMgmtFilter.doFilter(RestApiSessionMgmtFilter.java:78)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.EnforceAuthFilter.doFilter(EnforceAuthFilter.java:42)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.SsoRestApiNegotiationFilter.doFilter(SsoRestApiNegotiationFilter.java:84)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter.doFilter(SsoRestApiAuthFilter.java:47)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.SessionValidationFilter.doFilter(SessionValidationFilter.java:59)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.aaa.filters.RestApiSessionValidationFilter.doFilter(RestApiSessionValidationFilter.java:35)
[aaa.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.api.restapi.security.CSRFProtectionFilter.doFilter(CSRFProtectionFilter.java:111)
[restapi-jaxrs.jar:]
at
org.ovirt.engine.api.restapi.security.CSRFProtectionFilter.doFilter(CSRFProtectionFilter.java:102)
[restapi-jaxrs.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.ovirt.engine.core.utils.servlet.CORSSupportFilter.doFilter(CORSSupportFilter.java:283)
[utils.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
[undertow-servlet-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
[undertow-core-2.0.21.Final.jar:2.0.21.Final]
at
org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_232]
_______________________________________________
Users mailing list -- users(a)ovirt.org
To unsubscribe send an email to users-leave(a)ovirt.org
Privacy Statement:
https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct:
https://www.ovirt.org/community/about/community-guidelines/
List Archives:
https://lists.ovirt.org/archives/list/users@ovirt.org/message/KCQGVLGCIHJ...