Project

General

Profile

Actions

Bug #8827

open

new hosts built from images fail with Ip address is invalid

Added by Benjamin Roberts over 9 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When creating virtual machine hosts via the API (v2) hosts with provision_method="image" set fail to build with the error "IP address is invalid".

I am not specifying the IP's of these hosts anywhere (as verified in the production.log) as with my regular (not-image) hosts I do not too (IP autosuggest seems to work).

When provisioning an identical host via the web interface I encounter no such issues. I believe this is because the web interface is able to call /subnets/freeip (where as API users are not, csrf etc).

Either autosuggest should work for image hosts the same as other hosts or /subnets/freeip should be exposed via the API such that it can be used without csrf/authenticity tokens.

Happy to provide my configurations if needed.


Files

WindowsHost.json WindowsHost.json 1.49 KB Failing VM Hash (Windows, Image) Benjamin Roberts, 01/13/2015 05:21 PM
LinuxHost.json LinuxHost.json 1.19 KB Successful VM Hash (Linux, Network) Benjamin Roberts, 01/13/2015 05:21 PM
ProductionGui.log ProductionGui.log 2 KB Log Entry for creating Windows host in Web GUI Benjamin Roberts, 01/13/2015 05:27 PM
ProductionAPI.log ProductionAPI.log 1.34 KB Log entry for failing to create Windows host via API Benjamin Roberts, 01/13/2015 05:27 PM
Actions #1

Updated by Daniel Lobato Garcia over 9 years ago

On nightly I've tried creating a libvirt host and it worked well, please supply more information (logs, hash used to create the vm, compute resource provider..)

Updated by Benjamin Roberts over 9 years ago

Attached are:
+ The hash used to make the windows host (Image based) which fails with IP Address is Invalid
+ The hash used to make the linux host (Kickstart based) which succeeds
+ The log entry of the windows host failing (created via API)
+ The log entry of the windows host succeeding (created via GUI)

The host can be created through the GUI because it provides the IP address retrieved from /subnets/freeip in its hash. However the linux host (created through the API) can be created without specifying its IP

Actions #3

Updated by Benjamin Roberts over 9 years ago

Deploying against a oVirt compute resource

Actions #4

Updated by Benjamin Roberts over 9 years ago

If I manually set the IP address in the hash the host can be created. If I check its configuration in the GUI I can see that it hasn't inherited its primary interface subnet from its hostgroup. Getting the subnet_id from the hostgroup hash and adding it to the host hash allows the host to be created.

It subequently fails when SSH'ing into the box (windows, no sshd) which the WebGUI does not seem to do.

There seems to be some difference with hostgroups et al are dealt with when provisioning from an image vs' PXE?

Actions #5

Updated by Dominic Cleal over 9 years ago

The issue appears to be in set_hostgroup_defaults in Host::Managed - it only fills in subnet_id from the host group if pxe_build?. I don't think that's correct, as app/views/hosts/_unattended.html.erb for the UI uses a different check (whether the CR supports PXE building, which is still a bit odd, but works).

Actions #6

Updated by Benjamin Roberts over 9 years ago

I don't quite follow why omitting the subnet_id was chosen as correct behavior for image based hosts. Is there a use case I'm missing?

Actions #7

Updated by Dominic Cleal over 9 years ago

It was probably from when image builds were only EC2, Rackspace etc, which supply their own IP address, so don't need a subnet_id.

Image builds on libvirt, VMware and oVirt were added more recently and work differently - more like PXE building, where we manage IP allocations.

Actions #8

Updated by Benjamin Roberts over 9 years ago

Should the Compute Providers be able to override this behavior then maybe?

Actions #9

Updated by Dominic Cleal over 9 years ago

Yeah, it should probably be a method on the compute resource class to say what behaviour's expected. Thinking about it, there's something similar already - "provided_attributes" which is used to say which attrs are supplied by the compute resource, e.g. IP and MAC.

Actions #10

Updated by Benjamin Roberts over 9 years ago

On a related note, it apepars that image based hosts dont remove their dhcp leases on deletion

Actions

Also available in: Atom PDF