Project

General

Profile

Bug #2093

vmware compute resources don't support folders

Added by Kevin Cormier over 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
VM management
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When using vmware compute resources, any VMs inside of folders are not detected by foreman.

I found this with Foreman 1.1RC3.

Associated revisions

Revision aba96a74 (diff)
Added by Martin Matuška almost 6 years ago

fixes #2093 - list VMs in every VMware folder

Revision df599f74 (diff)
Added by Martin Matuška almost 6 years ago

fixes #2093 - list VMs in every VMware folder

(cherry picked from commit aba96a743f566eda5f81c451f52c040267a9cf04)

Conflicts:
app/views/compute_resources_vms/index/_vmware.html.erb

History

#1 Updated by Kevin Cormier over 6 years ago

I forgot to mention this was reproduced with vmware vsphere 5.1.0. Running foreman installed via rpm on a vanilla CentOS 6.3 box fully patched.

#2 Updated by Ohad Levy over 6 years ago

Sam, I had a few minutes to play, its not complete (UI part) but working:

http://pastie.org/5615993

#3 Updated by Duncan Innes almost 6 years ago

Any chance of the priority of this being raised a bit?

As far as VMware is concerned, I've not worked at any sites where folders were not used in some way.

#5 Updated by Dominic Cleal almost 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee changed from Sam Kottler to Martin Matuška
  • Target version set to 1.4.0

#6 Updated by Duncan Innes almost 6 years ago

I'm getting errors after applying this patch:

There was an error listing VMs: No route matches {:action=>"show", :controller=>"compute_resources_vms", :compute_resource_id=>#<Foreman::Model::Vmware id: 1, name: "Datacentre_1", description: "", url: "vspherehost.domain.com", user: "DOMAIN\\username", password: "secret", uuid: "Gotts Road", type: "Foreman::Model::Vmware", created_at: "2013-09-17 10:39:19", updated_at: "2013-09-17 10:40:29", attrs: {:setpw=>0, :pubkey_hash=>"8b12a6aa3993211aa3bf66f00dd18225c299b8be2b9dd967a37a5f2720733f33"}>, :id=>nil}

What else can I provide to help with this?

#7 Updated by Dominic Cleal almost 6 years ago

Duncan, could you try applying this patch on top and then paste the new error you get? https://gist.github.com/6620345

The issue here is the last "id" field in the error, which is showing :id => nil. This indicates that one of the VMs we're reading back from vSphere is missing a UUID, so I guess there's some strange type of VM coming back from the API that we should ignore and skip while listing. The patch above will make it list the VM's name, so if you can find it in vSphere and tell us a bit more about it - we might be able to work out what to do then.

#8 Updated by Duncan Innes almost 6 years ago

OK - patched and re-run.

"There was an error listing VMs: vm: W2K8 Template (, VirtualMachine("vm-3776"))"

Not sure if it's the first template that the code will have come across as we've got several in this Datacenter. Don't think there's anything special about it compared to other templates. I had a quick check and didn't see anything different.

Do templates have UUID?

#9 Updated by Dominic Cleal almost 6 years ago

Strange, the templates on the vSphere 5.1.0 instance I can see all have UUIDs and show up in the VM list.

Martin, maybe we can change the all method to skip over entries where vm.identity.nil?.

#10 Updated by Duncan Innes almost 6 years ago

Can a blank UUID be replaced with "<Unknown>" at all? I'd rather have systems/templates like this displayed rather than being missing from the Foreman screen, but showing in vSphere. Hiding them in Foreman is just going to create confusion at the user end.

#11 Updated by Ohad Levy almost 6 years ago

Duncan Innes wrote:

Can a blank UUID be replaced with "<Unknown>" at all? I'd rather have systems/templates like this displayed rather than being missing from the Foreman screen, but showing in vSphere. Hiding them in Foreman is just going to create confusion at the user end.

afair, templates should not be shown under the vm tab, if they do, its a bug.

#12 Updated by Ohad Levy almost 6 years ago

Dominic Cleal wrote:

Duncan, could you try applying this patch on top and then paste the new error you get? https://gist.github.com/6620345

The issue here is the last "id" field in the error, which is showing :id => nil. This indicates that one of the VMs we're reading back from vSphere is missing a UUID, so I guess there's some strange type of VM coming back from the API that we should ignore and skip while listing. The patch above will make it list the VM's name, so if you can find it in vSphere and tell us a bit more about it - we might be able to work out what to do then.

Dominic, I guess we should handle errors better in this case, I personally had a similar issue with the association fails on a 'bad' vm.. many times this can happen because of another bug (e.g. its a template that shown as a vm) or if its a very old vm that its config has not been updated (or it was imported but never started etc).

#13 Updated by Duncan Innes almost 6 years ago

Ohad Levy wrote:

afair, templates should not be shown under the vm tab, if they do, its a bug.

Fair point. Could live with this being a list of VM's only for now.

If/when Foreman becomes interested in deploying VM's from templates, a solution would need to be found. Perhaps another tab for Templates? Or a combined tab that shows a tree view of folders, sub-folders etc and the contained VM's/Templates.

#14 Updated by Dominic Cleal almost 6 years ago

Sounds like we've got a few related issues then with empty UUIDs. Excluding templates from the list and showing VMs without UUIDs as "unknown" sounds like a sensible compromise, and skipping over VMs during association (and other times we iterate) with missing UUIDs. I think we need a new # for these bits.

#15 Updated by Duncan Innes almost 6 years ago

Dominic Cleal wrote:

Excluding templates from the list and showing VMs without UUIDs as "unknown" sounds like a sensible compromise

Sounds like a way forward to me. I'll test whatever code is available as soon as I can.

#16 Updated by Dominic Cleal almost 6 years ago

  • Target version changed from 1.4.0 to 1.3.1

#17 Updated by Martin Matuška almost 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#18 Updated by Greg Sutcliffe almost 6 years ago

  • Legacy Backlogs Release (now unused) set to 1

#19 Updated by Duncan Innes almost 6 years ago

Just upgraded to 1.3.0 and tried this patch.

Works a charm. Cheers.

Also available in: Atom PDF