thescouser89 / ovirt-slaves-plugin

Jenkins plugin to control VM slaves managed by ovirt/RHEV
MIT License
8 stars 7 forks source link

Can't see VM when creating new ovirt node #3

Open tollgen opened 7 years ago

tollgen commented 7 years ago

Hi,

Great plugin, I am looking for exactly this. However I am unable to see VM's in my cluster when I try and add a jenkins ovirt slave. I am using the current latest version of Jenkins (2.60.1) and ovirt (4.1)

First I need to put the engine API URL as "https://:443/ovirt-engine/api" within jenkins configuration for successful connection as supposed to "https://:443/api" in your screenshot.

Then when I try and add a new ovirt slave vm, there isn't any of my VM's in the drop down list for my ovirt cloud.

Can you confirm if I am missing something and if this plugin is compatible with the latest jenkins/ovirt?

Thank you

thescouser89 commented 7 years ago

Hi,

Thanks for using it! :)

Thanks for letting me know about the URL. I'm actually using it on a RHEV instance, so maybe that's why we have discrepancies in the URL. Sorry about that!

Does the ovirt user you are using have admin rights? I found out (but cannot 100% confirm) that the only way a user can talk to RHEV via REST and see the VM list is if the user had full admin rights :(

The second thing to know is that it might take some time for the list of VMs to populate, if the authentication process take some time.

Could you check the Jenkins log to see if there are any errors printed to it related to ovirt communication?

I've tested that it works on latest RHEV v3.6.9.2-0.1 and I didn't check if it works in latest Jenkins, but it worked on Jenkins 2.46.x (the LTS version) last time I tried.

tollgen commented 7 years ago

Hi,

I have setup the connection and test succeeded within jenkins using "admin@internal", I don't see anything in the jenkins logs, however I am seeing the below in the ovirt engine logs after I test the connection and get "Test succeeded!" within jenkins, could be a permissions issue, however I am logging in with admin@internal which I would have thought would have the permissions?

2017-06-26 13:58:35,526+01 INFO [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-9) [] User admin@internal successfully logged in with scopes: ovirt-app-api ovirt-ext=token-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate ovirt-ext=token:password-access 2017-06-26 13:58:35,541+01 INFO [org.ovirt.engine.core.bll.aaa.CreateUserSessionCommand] (default task-1) [5fcbbffc] Running command: CreateUserSessionCommand internal: false. 2017-06-26 13:58:35,601+01 INFO [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-1) [5fcbbffc] EVENT_ID: USER_VDC_LOGIN(30), Correlation ID: 5fcbbffc, Call Stack: null, Custom Event ID: -1, Message: User admin@internal-authz logged in. 2017-06-26 13:58:35,625+01 ERROR [org.ovirt.engine.core.bll.GetSystemStatisticsQuery] (default task-1) [bf4e11fd-dcfa-4fa1-9c0e-f4481a4aa978] Query execution failed due to insufficient permissions

thescouser89 commented 7 years ago

Could you try to add 'ClusterAdmin', 'PowerUserRole' to the user you are using? One of these 2 will probably give you access to the VM view, but I don't which one 😛

joaquin386 commented 7 years ago

Same problem here with Jenkins2.60.1 and ovirt 4.1. @tollgen Did you manage to solved the ERROR problem?

@thescouser89 According to this bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=1241111 There should be a filter=.... header

When I do a curl with the admin@internal and filter: false I do not get the error. When I do it with the filter: true I get the error When I do it with a normal user and filter: false I do not get the ERROR When I do it with a normal user and filter: true I do get the ERROR Same behaviour in both cases. So maybe the filter header needs to be removed?

joaquin386 commented 7 years ago

I have seen the plugin is for Jenkins 1.55 & ovirt 3.4..... almost working for Jenkins 2.60.1 & Ovirt 4.1. File: OVirtHypervisor.java Line: #307 --> new Api(ovirtURL, username, password, true, true).shutdown(); change to --> new Api(ovirtURL, username, password, true, false).shutdown(); The fouth is to the filter. From the engine java-sdk 3.4.1 can see:

But then when trying to start the ovirt Slave: java.lang.NullPointerException at org.jenkinsci.plugins.ovirt.OVirtVMLauncher.isVMDown(OVirtVMLauncher.java:122) at org.jenkinsci.plugins.ovirt.OVirtVMLauncher.putVMDown(OVirtVMLauncher.java:224) at org.jenkinsci.plugins.ovirt.OVirtVMLauncher.launch(OVirtVMLauncher.java:339) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:262) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

joaquin386 commented 7 years ago

It is not going to work cause this version of the plugin is for 3.4.1 and currently the sdk has change a lot for sdk4.1 so they are not compatible. Any future plan of doing the change?

tollgen commented 7 years ago

I was actually able to get it working ok.

When 1st adding the new jenkins ovirt node, in the initial configuration page of the new node, the ovirt cloud details are greyed out. However when you save the node then go back and configure the node I am able to see the options for the ovirt cloud and I am able to correctly configure the node, strange that it doesn't pick it up initially however happy that it works

joaquin386 commented 7 years ago

@tollgen yes that works ..... but are you able put a job and make it work? the SDK for the plugin is 3.4 and ovirt 4.1 has the 4.1 which changes basically everything.

thescouser89 commented 7 years ago

@joaquin386 Is there a new Java SDK? The latest I see is 3.6.10.0. I'll update it soon and see if it causes any issues on my end.

https://mvnrepository.com/artifact/org.ovirt.engine.sdk/ovirt-engine-sdk-java

thescouser89 commented 7 years ago

@joaquin386 I'll try tomorrow with the filter=false. I don't remember anymore why I had this set to true 🙍

joaquin386 commented 7 years ago

@thescouser89 We are running th ovirt4.1 (latest version) and I think in the 4.X version they have change the sdk, so it is not compatible anymore with 4.X, for 3.6 seems it is the same API call as you have. For example you do not have anymore the decorators.VM calls, etc... and the api is called now sdk4.

I change the value of the filter to false and the ERROR doesn;t happen anymore at the time when checking the connection in the Configure System, but maybe in 4.X it suppose to be true ....

Their Gitlab: https://github.com/oVirt/ovirt-engine-sdk-java/releases

joaquin386 commented 7 years ago

I find this repo for the 4.1.4: https://mvnrepository.com/artifact/org.ovirt.engine.api/sdk/4.1.4 A nice document: https://access.redhat.com/documentation/en-US/Red_Hat_Virtualization/4.0/pdf/Java_SDK_Guide/Red_Hat_Virtualization-4.0-Java_SDK_Guide-en-US.pdf

thescouser89 commented 7 years ago

I'll try that 4.1.4 sdk in the next few hours. Let see what this breaks 😄

thescouser89 commented 7 years ago

@joaquin386 I've pushed my initial support work for Ovirt 4: https://github.com/thescouser89/ovirt-slaves-plugin/tree/ovirt-4

Note: I actually didn't test it! 😭 I worked on the modifications via the SDK. I'll try to get something setup with ovirt 4 for further testing.

Could you also try it and let me know what's broken?

joaquin386 commented 7 years ago

/org/jenkinsci/plugins/ovirt/OVirtVMSlave/configure-entries.jelly:37:104: Could not initialize class org.ovirt.api.metamodel.runtime.xml.XmlReader <j:forEach var="vc" items="${descriptor.getVMNamesList(it.hypervisorDescription)}" varStatus="loop">

        </j:forEach>
thescouser89 commented 7 years ago

Gotcha! I made the connection trusst anything cause I'm lazy so it shouldn't be a problem even if you don't specify the trusstore location.

That Jenkins error is not good though. Is it on Jenkins 2.60?

I'll try to get a local ovirt 4 installation ASAP for proper testing!

joaquin386 commented 7 years ago

Yes I am runnning on the latest Jenkins version 2.60.2 :( I have my ovirt4.1 configured but I suppose it would be quicker for you to set it locally.

thescouser89 commented 7 years ago

@joaquin386 Do you have any tips on how to setup ovirt 4.1 on a single machine?

joaquin386 commented 7 years ago

self hosted --> http://www.ovirt.org/develop/release-management/features/engine/self-hosted-engine/

This is more two node (or two VM) --> http://www.ovirt.org/documentation/quickstart/quickstart-guide/#install-ovirt-engine-fedora--red-hat-enterprise-linux--centos

thescouser89 commented 7 years ago

Found an old laptop where I can try the self hosted solution! Weee down the rabbit hole I go

thescouser89 commented 7 years ago

Update: Installed Cent OS 7 on the machine and went with the self hosted engine thing. I'm currently stuck with figuring out how to setup the engine vm fqdn and getting it right. Will ask for some help around the office

tollgen commented 7 years ago

Easiest workaround is just update the hosts file with your hostname/ip

thescouser89 commented 7 years ago

@tollgen hmm I tried to use nip.io, pointing to the IP of the machine, but it would then complain that the IP was used locally.

joaquin386 commented 7 years ago

I think what tollgen is saying is teh easiert. Modify the /etc/hosts with the IP/host pair. You have one file in the system nsswitch.conf that tells the system were to firstly search for names and their translation and normally in that file the first option is the /etc/hosts so no need for a DNS.

thescouser89 commented 7 years ago

Gotcha! will play with that! No need for dnsmasq setup for the VM?

joaquin386 commented 7 years ago

https://www.ovirt.org/blog/2016/11/testing-ovirt-changes-without-cluster/

You have this: If you do not feel like touching the NetworkManager configuration, there is an alternative approach. You can add additional static localhost aliases to /etc/hosts. Please check the example line below to see how:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 host1.vdsm.fake host2.vdsm.fake host3.vdsm.fake

The disadvantage of the /etc/hosts approach is that you have to edit the file always when you want to create an additional hostname for your virtual hosts.

thescouser89 commented 7 years ago

Just an update: I'm out of town right now and don't have access to the laptop I used to try to install ovirt. I got access to the web console but then I'm not sure how to install a host :(

I'll probably just focus on the Jenkins stacktrace for now with the latest Jenkins + plugin to see if I can fix this.

Sorry for lack of progress on this :(

joaquin386 commented 7 years ago

More than welcome you are doing this :100:

joaquin386 commented 7 years ago

Any news on this for Ovirt 4.X?

thescouser89 commented 7 years ago

No progress :( I gave up on trying to figure out how to install Ovirt 4.x for testing. We might be upgrading our internal RHEV instance, but I don't know when.

joaquin386 commented 7 years ago

Thx.