Project

General

Profile

Actions

Bug #23342

closed

vsphere - failed to create resource - undefined method first

Added by Michael Speth almost 6 years ago. Updated almost 6 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Compute resources - VMware
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

After upgrading to version 1.17 of foreman via ubuntu package, provisioning to vsphere no longer functions.

Here is the output from the console.

Here is the code that fails in /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb

# === Power on
#
# Foreman will try and start this vm after clone in a seperate request.
#
def clone_vm(raw_args)
  args = parse_args(raw_args)

  opts = {
    "datacenter" => datacenter,
    "template_path" => args[:image_id],
    "dest_folder" => args[:path],
    "power_on" => false,
    "start" => args[:start],
    "name" => args[:name],
    "numCPUs" => args[:cpus],
    "numCoresPerSocket" => args[:corespersocket],
    "memoryMB" => args[:memory_mb],
    "datastore" => args[:volumes].first[:datastore],
    "storage_pod" => args[:volumes].first[:storage_pod],
    "resource_pool" => [args[:cluster], args[:resource_pool]],
    "boot_order" => [:disk],
  }

Line 498 is the line that fails which is the datastore line. I think this indicates that args[:volumes] is returning as undef. So runtime indicates that functions cannot be run from undef.

The problem is the args[:volumes] is not getting populated, although in the web ui, volumes is populated with a pull down list. I have selected the same volume as I have in previous versions of foreman which all have worked.

Foreman OS: Ubuntu 16.04
hypervisor: VMware ESXi, 6.0.0, 4600944


Files

production.log.tar production.log.tar 70 KB Michael Speth, 04/19/2018 09:16 PM

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #23335: Cannot create VM in a vCenter. NoMethodError.ClosedTimo GoebelActions
Actions #1

Updated by Timo Goebel almost 6 years ago

Michael, can you try if the patch from #23335 works for you? I believe (though have not tested it myself) that the issues have the same root cause.

Actions #2

Updated by Timo Goebel almost 6 years ago

  • Related to Bug #23335: Cannot create VM in a vCenter. NoMethodError. added
Actions #3

Updated by Michael Speth almost 6 years ago

I tried to apply https://patch-diff.githubusercontent.com/raw/theforeman/foreman/pull/5475.patch

I didn't read far enough down, that this patch wouldn't work. So I then tried to apply https://gist.github.com/timogoebel/783d746a524964d8d81a8b7a828969a0

Now my system has failed:

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

This is the only line repeated in production.log

2018-04-23T10:08:48  [app] [I] Current user: foreman_admin (administrator)
Actions #4

Updated by Timo Goebel almost 6 years ago

Michael, we have updated the patch.
Can you please test with this patch again?

https://github.com/theforeman/foreman/pull/5481.patch

Make sure to revert the hold patch (with patch -R) before and restart httpd after applying the patch. Thanks.

Actions #5

Updated by Michael Speth almost 6 years ago

Timo Goebel wrote:

Michael, we have updated the patch.
Can you please test with this patch again?

https://github.com/theforeman/foreman/pull/5481.patch

Make sure to revert the hold patch (with patch -R) before and restart httpd after applying the patch. Thanks.

This worked!

Actions #6

Updated by Anonymous almost 6 years ago

  • Status changed from New to Duplicate

duplicate of #23335 then

Actions

Also available in: Atom PDF