Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not send os element when template is present #40

Merged
merged 2 commits into from Jul 31, 2014

Conversation

lzap
Copy link
Collaborator

@lzap lzap commented Jul 7, 2014

Fix for #39

@lzap
Copy link
Collaborator Author

lzap commented Jul 7, 2014

When I try to run integration tests again my RHEV 3.3 instance (Version 3.3.4-0.53.el6ev), I got couple of failures. It looks like a change in the API. I am not sure how much up to date are the integration tests.

[lzap@lzapx rbovirt]$ be rake spec
/home/lzap/.rbenv/versions/2.1.0/bin/ruby -S rspec ./spec/integration/api_spec.rb ./spec/integration/vm_crud_spec.rb ./spec/unit/client_spec.rb ./spec/unit/vm_spec.rb --color
................FFFFFFFF
An error occurred in an after(:all) hook.
  NoMethodError: undefined method `id' for nil:NilClass
  occurred at /home/lzap/work/rbovirt/spec/integration/vm_crud_spec.rb:17:in `block (2 levels) in <top (required)>'

FFFFFFFF
An error occurred in an after(:all) hook.
  NoMethodError: undefined method `id' for nil:NilClass
  occurred at /home/lzap/work/rbovirt/spec/integration/vm_crud_spec.rb:17:in `block (2 levels) in <top (required)>'

............

Failures:

  1) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  2) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  3) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  4) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  5) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  6) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  7) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  8) Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:80
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  9) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  10) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  11) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  12) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  13) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  14) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  15) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

  16) User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
     Failure/Error: @vm = @client.create_vm(:name => name, :template => @template_id, :cluster => @cluster)
     OVIRT::OvirtException:
       302 Found
     Shared Example Group: "Basic VM Life cycle" called from ./spec/integration/vm_crud_spec.rb:95
     # ./lib/rbovirt.rb:180:in `handle_fault'
     # ./lib/rbovirt.rb:114:in `rescue in http_post'
     # ./lib/rbovirt.rb:111:in `http_post'
     # ./lib/client/vm_api.rb:35:in `create_vm'
     # ./spec/integration/vm_crud_spec.rb:9:in `block (2 levels) in <top (required)>'

Finished in 16.12 seconds
44 examples, 16 failures

Failed examples:

rspec ./spec/integration/vm_crud_spec.rb:20 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
rspec ./spec/integration/vm_crud_spec.rb:29 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
rspec ./spec/integration/vm_crud_spec.rb:33 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
rspec ./spec/integration/vm_crud_spec.rb:37 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
rspec ./spec/integration/vm_crud_spec.rb:44 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
rspec ./spec/integration/vm_crud_spec.rb:52 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
rspec ./spec/integration/vm_crud_spec.rb:58 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
rspec ./spec/integration/vm_crud_spec.rb:63 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
rspec ./spec/integration/vm_crud_spec.rb:20 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
rspec ./spec/integration/vm_crud_spec.rb:29 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
rspec ./spec/integration/vm_crud_spec.rb:33 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
rspec ./spec/integration/vm_crud_spec.rb:37 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
rspec ./spec/integration/vm_crud_spec.rb:44 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
rspec ./spec/integration/vm_crud_spec.rb:52 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
rspec ./spec/integration/vm_crud_spec.rb:58 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
rspec ./spec/integration/vm_crud_spec.rb:63 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
/home/lzap/.rbenv/versions/2.1.0/bin/ruby -S rspec ./spec/integration/api_spec.rb ./spec/integration/vm_crud_spec.rb ./spec/unit/client_spec.rb ./spec/unit/vm_spec.rb --color failed

@lzap
Copy link
Collaborator Author

lzap commented Jul 7, 2014

Do you happen to know what is wrong with my tests @abonas ? (I was testing master branch without any changes).

@abonas
Copy link
Collaborator

abonas commented Jul 7, 2014

@lzap it worked for me on clean rbovirt master against latest oVirt master (>3.4)/

  1. Does your RHEV instance have a host that is up and can run VMs?
  2. How does your endpoint.yml file look like in rbovirt? can you paste it here please?
  3. is RHEV REST api accessible? can you invoke it and see if /clusters responds (in GET) and returns clusters list?

@abonas
Copy link
Collaborator

abonas commented Jul 7, 2014

@lzap what does the RHEV log say?

@lzap
Copy link
Collaborator Author

lzap commented Jul 8, 2014

Hello,

@lzap it worked for me on clean rbovirt master against latest oVirt master (>3.4)/

Nice.

  1. Does your RHEV instance have a host that is up and can run VMs?

Yes.

  1. How does your endpoint.yml file look like in rbovirt? can you paste it here please?
user: "admin@internal"
password: "123456"
url: "http://xxx.lab.eng.xxx.redhat.com/api"
network: 'internal3'
  1. is RHEV REST api accessible? can you invoke it and see if /clusters responds (in GET) and returns clusters list?

It's not my instance, I have no root access. But the problem could be
that datacenter that should be used is named "localDC". I guess the
tests run in the "Default" datacenter. Can I configure one?

Thanks for the test run. Do you think the patch is correct?

Later,

Lukas "lzap" Zapletal
irc: lzap #theforeman

@abonas
Copy link
Collaborator

abonas commented Jul 8, 2014

Hi Lukas, so Default data center afaik is present "out of the box" in all RHEV/oVirts. but let me recheck this and recheck what the tests are doing.
The patch content itself - haven't reviewed it yet, is there any RHEV side discussion on how to correctly call this api in 3.3 and newer versions so I can rely on for review of the logic in the patch?

@lzap
Copy link
Collaborator Author

lzap commented Jul 8, 2014

@lzap
Copy link
Collaborator Author

lzap commented Jul 9, 2014

Also relevant bug describing the root cause for the os element not to work is: https://bugzilla.redhat.com/show_bug.cgi?id=1104235

@lzap
Copy link
Collaborator Author

lzap commented Jul 29, 2014

So I am able to confirm that the following tests fail with master against oVirt 3.4.1 (stable):

Finished in 1.11 seconds
44 examples, 22 failures

Failed examples:

rspec ./spec/unit/vm_spec.rb:224 # OVIRT::VM xml parsing should parse VM xml
rspec ./spec/unit/vm_spec.rb:229 # OVIRT::VM xml parsing create vm xml
rspec ./spec/unit/vm_spec.rb:235 # OVIRT::VM xml parsing should be running
rspec ./spec/unit/vm_spec.rb:240 # OVIRT::VM xml parsing should have one interface
rspec ./spec/unit/vm_spec.rb:252 # OVIRT::VM xml parsing should have one volume
rspec ./spec/unit/vm_spec.rb:262 # OVIRT::VM xml parsing should still fallback to the client
rspec ./spec/integration/vm_crud_spec.rb:20 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
rspec ./spec/integration/vm_crud_spec.rb:29 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
rspec ./spec/integration/vm_crud_spec.rb:33 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
rspec ./spec/integration/vm_crud_spec.rb:37 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
rspec ./spec/integration/vm_crud_spec.rb:44 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
rspec ./spec/integration/vm_crud_spec.rb:52 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
rspec ./spec/integration/vm_crud_spec.rb:58 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
rspec ./spec/integration/vm_crud_spec.rb:63 # Admin API VM Life cycle admin basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
rspec ./spec/integration/vm_crud_spec.rb:20 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_template
rspec ./spec/integration/vm_crud_spec.rb:29 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_template
rspec ./spec/integration/vm_crud_spec.rb:33 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_return_a_vm
rspec ./spec/integration/vm_crud_spec.rb:37 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_start_and_stop_vm
rspec ./spec/integration/vm_crud_spec.rb:44 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_set_vm_ticket
rspec ./spec/integration/vm_crud_spec.rb:52 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_destroy_vm
rspec ./spec/integration/vm_crud_spec.rb:58 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_update_vm
rspec ./spec/integration/vm_crud_spec.rb:63 # User API VM Life cycle user basic vm and templates operations behaves like Basic VM Life cycle test_should_create_a_vm
rake aborted!

This patch does not introduce any failures.

@lzap
Copy link
Collaborator Author

lzap commented Jul 29, 2014

It looks like most of these are thank to wrong SSL/cert configuration. Did @abenari explain to you how to setup this? I can see it expects ca_cert.pem file, but when I try to put it there, it does not validate. When I use http, then I get many 302 replies (https).

@lzap
Copy link
Collaborator Author

lzap commented Jul 29, 2014

Got it working, I will push some tests changes, it looks like some tests needs to be fixed.

@lzap
Copy link
Collaborator Author

lzap commented Jul 31, 2014

All tests are green now, I've refactored the configuration a bit, now it is possible to provide both datacenter and cluster by name. Also changed README and added more info about how to setup certificates for this. Please review.

@abenari
Copy link
Owner

abenari commented Jul 31, 2014

@lzap Both the os fix and the, tests and readme looks good. It could be great if you could separate it into two comeets in the same pull request. One for the is fix and one for the rest.

@lzap
Copy link
Collaborator Author

lzap commented Jul 31, 2014

Ok good idea, I re-pushed. Also added few more examples without template to cover the case.

All good.

abenari added a commit that referenced this pull request Jul 31, 2014
Do not send os element when template is present
@abenari abenari merged commit ea55230 into abenari:master Jul 31, 2014
@lzap lzap deleted the os-elem-template branch August 1, 2014 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants