Project

General

Profile

Actions

Bug #24852

closed

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

Added by Ivan Necas about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Compute resources - libvirt
Target version:
-
Difficulty:
Triaged:
No
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

Actions #1

Updated by Aditi Puntambekar about 5 years ago

  • 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
  • Assignee set to Aditi Puntambekar
Actions #2

Updated by Aditi Puntambekar about 5 years ago

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

Actions #3

Updated by Ivan Necas about 5 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

Actions #4

Updated by The Foreman Bot about 5 years ago

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

Updated by The Foreman Bot about 4 years ago

  • Fixed in Releases 2.0.0 added
Actions #6

Updated by Aditi Puntambekar about 4 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF