Project

General

Profile

Bug #24852

Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host

Added by Ivan Necas about 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources - libvirt
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1625258

Description of problem:
When creating a new Host and specifying on Virtual Machine tab "Allocation(GB)" as empty, Host create fails with

NoMethodError: undefined method `[]' for nil:NilClass

error. It is more user-unfriendly also due to the fact that the Allocation(GB) is purged when one clicks to "Size" button right from the value.

How reproducible:
100%

Steps to Reproduce:
1. Start creating a new Host
2. In Virtual Machine tab, click to "Size" button (or leave "Allocation(GB)" empty either way)
3. Fill all other parameters properly.
4. Submit the Host

Actual results:
Host create fails with "undefined method `[]' for nil:NilClass"

Expected results:
Either no error (if the parameter can have empty value with some meaning), or provide some meaningfull error message before tryng to create the host (e.g. similar to leaving root password empty).

Additionally, we could default to size value value in the UI, so that people don't run into the empty value issue that likely + it would provide a good example of what values are expected.

Additional info:
backtrace:
2018-09-04 15:20:37 18507e4a [app] [W] Failed to create a compute satotest (Libvirt) instance pmoravec-test.sysmgmt.lan: undefined method `[]' for nil:NilClass

NoMethodError: undefined method `[]' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.2.0/lib/fog/libvirt/models/compute/volume.rb:119:in `split_size_unit'
(erb):3:in `to_xml'

Relevant code:

112 def split_size_unit(text)
113 if text.kind_of? Integer
114 # if text is an integer, match will fail
115 size = text
116 unit = 'G'
117 else
118 matcher = text.match(/(\d+)(.+)/)
119 size = matcher1
120 unit = matcher2
121 end
122 [size, unit]
123 end

that simply does not count with empty value in text

Associated revisions

Revision 23dbf2cd (diff)
Added by Aditi Puntambekar about 1 year ago

Fixes #24852 - Creating Host with empty allocation fails

History

#1 Updated by Aditi Puntambekar about 2 years ago

  • Assignee set to Aditi Puntambekar
  • Subject changed from Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host to Having empty "Allocation (GB)" when creating a new Host, nil:NilClass returned on creating the Host

#2 Updated by Aditi Puntambekar almost 2 years ago

Hello,
I was able to reproduce this on libvirt compute resource, but is this also an issue for other compute resources ?

#3 Updated by Ivan Necas almost 2 years ago

As the report says: the source of the issue seems to be in fog-libvirt, so I don't expect other compute resources being affected by this

#4 Updated by The Foreman Bot almost 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6300 added

#5 Updated by The Foreman Bot about 1 year ago

  • Fixed in Releases 2.0.0 added

#6 Updated by Aditi Puntambekar about 1 year ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF