Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1571086 - can't use hammer CLI to create a new host in VMware [NEEDINFO]
Summary: can't use hammer CLI to create a new host in VMware
Status: CLOSED DUPLICATE of bug 1529252
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.3.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
Depends On:
Blocks: 1316897
TreeView+ depends on / blocked
Reported: 2018-04-24 05:48 UTC by matt jia
Modified: 2019-08-12 14:37 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-12-23 09:27:10 UTC
Target Upstream Version:
mshira: needinfo? (mjia)

Attachments (Terms of Use)

Description matt jia 2018-04-24 05:48:14 UTC
Description of problem:

Can't create a new host by using hammer CLI with Vmware compute options.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:

use a hammer command like this 

hammer -d  host create \
  --name "lonlxt90014" \
  --organization "NOMURA" \
  --location "rnd" \
  --hostgroup-id 22 \
  --content-source-id 1 \
  --compute-resource-id 3 \
  --provision-method image \
  --image "RHEL7.4-16042018" \
  --ip xx.xx.xxx.xx
  --subnet-id 1 \
  --managed true \
  --interface="compute_type=VirtualVmxnet3, \
               compute_network=network-44"  \
  --compute-attributes="cpus=1, \
                        corespersocket=2, \
                        cluster='Woking RND', \
                        path='/Datacenters/Woking RND/vm/Discovered virtual machine',guest_id=rhel6_64Guest,hardware_version=vmx-08" \
  --volume="size_gb=60, \
            datastore=ESX_DataStore_ISO, \
            name='Hard disk 1', \
            thin=true, eager_zero=false,mode=persistent"

Actual results:

[ERROR 2018-04-20 07:26:04 Exception] Failed to create a compute lonwst90002.rndeurope.nom (VMware) instance lonlxt90014.nomura.com: undefined method `include?' for nil:NilClass

Expected results:

Creating a new host should see no errors.

Additional info:

If a compute profile is given, it works. UI also works.

Comment 2 matt jia 2018-04-24 07:05:29 UTC
After digging a little bit more, it seems like the image_id is not populated in the /usr/share/foreman/app/models/concerns/orchestration/compute.rb:77:in `setCompute'

As I understand, it should use the given image's id. 

On the other hand, the hammer CLI accepts --image-id. Will this be used as the image id of the compute attributes? SIt seems like the image id can be set with  --compute-attributes, but the doc doesn't mention it.

hammer host create --help

      cpus                  Cpu count
      corespersocket        Number of cores per socket (applicable to hardware versions < 10 only)
      memory_mb             Integer number, amount of memory in MB
      cluster               Cluster id from VMware
      path                  Path to folder
      guest_id              Guest OS id form VMware
      scsi_controller_type  Id of the controller from VMware
      hardware_version      Hardware version id from VMware

Comment 5 Marek Hulan 2018-04-26 06:33:24 UTC
I guess tha same would happen for other CRs as well. Matt, could you please try using --image-id as you suggest in comment 2? Also try it as an attribute of compute_attributes hash, I'd expect this should work. I haven't looked to API code yet, but perhaps it's just documentation issue.

Comment 6 matt jia 2018-04-26 07:01:10 UTC
Hi Marek,

Using --image-id gives me the same error. Using it as an attribute of compute_attributes hash works. It would make more sense that the API can
populate the image_id attribute of compute_attributes from the given --image/--image-id.

Comment 9 Shira Maximov 2018-12-05 13:31:23 UTC
I saw the same issue in 
please try to add image_id under --compute-attributes section.

Comment 10 Shira Maximov 2018-12-23 09:27:10 UTC

*** This bug has been marked as a duplicate of bug 1529252 ***

Note You need to log in before you can comment on or make changes to this bug.