Bug 1633345 - Unable to create the host using "hammer host create" by providing the interface and compute attributes in command line
Summary: Unable to create the host using "hammer host create" by providing the interfa...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning
Version: 6.3.3
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On: 1529252
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-26 18:12 UTC by Ganesh Patil
Modified: 2022-03-13 15:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-01 14:15:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ganesh Patil 2018-09-26 18:12:35 UTC
Description of problem:

Unable to create the host using "hammer host create" by providing the interface and compute attributes in command line.

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

Red Hat Satellite 6.3.3


Steps to Reproduce:
1. Setup the provisioning environment in Satellite.
2. Add the required components in the Satellite i.e. Compute Resource, Subnet, Domain
3.The command which is failing while creating the host is as follows 

# hammer host create \
--name test \
--environment-id 1 \
--organization-id 2 \
--location-id 1 \
--lifecycle-environment-id 2 \
--hostgroup-id 3 \
--operatingsystem-id 3 \
--architecture "x86_64" \
--domain-id 1 \
--subnet-id 1 \
--compute-resource-id 1 \
--provision-method image \
--content-view "CV_RHEL7" \
--compute-attributes "cpus=1, corespersocket=2, memory_mb=4096, cluster=Production, scsi_controller_type=ParaVirtual, start=1" \
--interface "compute_type=VirtualVmxnet3, compute_network=Data, ip=192.168.122.89, host=test, managed=1, primary=1, provision=1, type=interface" \
--build 1 \
--volume "datastore=test_lab, size_gb=36, thin=true" \
--image "Test-template" \
--parameters "new_ip=192.168.122.190" \
--ask-root-password true



Actual results:

 ActiveRecord::AssociationTypeMismatch: Host::Base(#49325760) expected, got String(#8110140)


Expected results:

The machine should get created.


Additional info:

However, using the "compute profile" the machine is getting created without any errors.
The reference Bugzilla, i have found out over is  :

 https://bugzilla.redhat.com/show_bug.cgi?id=1529252

But this is not the case where customer is not trying to override the --image option. He is only specifying the image option if he did not use a compute profile.  If he is using a compute profile then he don't need to override the image option as he is having only one image.

Comment 3 Shira Maximov 2018-10-17 13:22:56 UTC
Ganesh, In your commands there are some parameters that are not valid parameters.

for example: 
* corespersocket,memory_mb - doesn't exist in our hammer cli
* cluster - should get the cluster id and not the name,

please look at hammer host create --help command:

Usage:
    hammer host create [OPTIONS]

Options:
 --architecture ARCHITECTURE_NAME          >Architecture name<
 --architecture-id ARCHITECTURE_ID          
 --ask-root-password ASK_ROOT_PW           >One of true/false, yes/no, 1/0.<
 --build BUILD                             >One of true/false, yes/no, 1/0.<
 --comment COMMENT                         Additional information about this host
 --compute-attributes COMPUTE_ATTRS        >Compute resource attributes<
                                           >Comma-separated list of key=value<
 --compute-profile COMPUTE_PROFILE_NAME    >Name to search by<
 --compute-profile-id COMPUTE_PROFILE_ID    
 --compute-resource COMPUTE_RESOURCE_NAME  >Compute resource name<
 --compute-resource-id COMPUTE_RESOURCE_ID  
 --config-group-ids CONFIG_GROUP_IDS       IDs of associated config groups
                                           >Comma separated list of values. Values containing comma should be quoted or escaped with backslash<
 --config-groups CONFIG_GROUP_NAMES        >Comma separated list of values. Values containing comma should be quoted or escaped with backslash<
 --domain DOMAIN_NAME                      >Domain name<
 --domain-id DOMAIN_ID                     Numerical ID or domain name
 --enabled ENABLED                         Include this host within Foreman reporting
                                           >One of true/false, yes/no, 1/0.<
 --environment ENVIRONMENT_NAME            >Environment name<
 --environment-id ENVIRONMENT_ID            
 --hostgroup HOSTGROUP_NAME                >Hostgroup name<
 --hostgroup-id HOSTGROUP_ID                
 --hostgroup-title HOSTGROUP_TITLE         >Hostgroup title<
 --image IMAGE_NAME                        >Name to search by<
 --image-id IMAGE_ID                        
 --interface INTERFACE                     >Interface parameters<
                                           >Comma-separated list of key=value<
                                           >Can be specified multiple times.<
 --ip IP                                   Not required if using a subnet with DHCP proxy
 --location LOCATION_NAME                  >Location name<
 --location-id LOCATION_ID                  
 --location-title LOCATION_TITLE           >Location title<
 --mac MAC                                 Required for managed host that is bare metal, not required if it’s a virtual machine
 --managed MANAGED                         True/False flag whether a host is managed or unmanaged. Note: this value also determines whether several parameters are required or not
                                           >One of true/false, yes/no, 1/0.<
 --medium MEDIUM_NAME                      >Medium name<
 --medium-id MEDIUM_ID                      
 --model MODEL_NAME                        >Model name<
 --model-id MODEL_ID                        
 --name NAME                                
 --operatingsystem OPERATINGSYSTEM_TITLE   >Operating system title<
 --operatingsystem-id OPERATINGSYSTEM_ID    
 --organization ORGANIZATION_NAME          >Organization name<
 --organization-id ORGANIZATION_ID          
 --organization-title ORGANIZATION_TITLE   >Organization title<
 --overwrite OVERWRITE                     >One of true/false, yes/no, 1/0.<
                                           >Default:< "true"
 --owner OWNER_LOGIN                       >Login of the owner<
 --owner-id OWNER_ID                       >ID of the owner<
 --owner-type OWNER_TYPE                   Host’s owner type
                                           >Possible value(s): 'User', 'Usergroup'<
 --parameters PARAMS                       >Host parameters<
                                           >Comma-separated list of key=value<
 --partition-table PARTITION_TABLE_NAME    >Partition table name<
 --partition-table-id PARTITION_TABLE_ID    
 --progress-report-id PROGRESS_REPORT_ID   UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks
 --provision-method PROVISION_METHOD       The method used to provision the host.
                                           >Possible value(s): 'build', 'image'<
 --puppet-ca-proxy PUPPET_CA_PROXY_NAME     
 --puppet-ca-proxy-id PUPPET_CA_PROXY_ID   Puppet CA proxy ID
 --puppet-class-ids PUPPET_CLASS_IDS       >Comma separated list of values. Values containing comma should be quoted or escaped with backslash<
 --puppet-classes PUPPET_CLASS_NAMES       >Comma separated list of values. Values containing comma should be quoted or escaped with backslash<
 --puppet-proxy PUPPET_PROXY_NAME           
 --puppet-proxy-id PUPPET_PROXY_ID         Puppet proxy ID
 --pxe-loader PXE_LOADER                   DHCP filename option (Grub2/PXELinux by default)
                                           >Possible value(s): 'None', 'PXELinux BIOS', 'PXELinux UEFI', 'Grub UEFI', 'Grub2 UEFI', 'Grub2 UEFI SecureBoot', 'Grub2 UEFI HTTP', 'Grub2 UEFI HTTPS', 'Grub2 UEFI HTTPS SecureBoot', 'iPXE Embedded', 'iPXE UEFI HTTP', 'iPXE Chain BIOS', 'iPXE Chain UEFI'<
 --realm REALM_NAME                        >Name to search by<
 --realm-id REALM_ID                       Numerical ID or realm name
 --root-password ROOT_PW                   >Required if host is managed and value is not inherited from host group or default password in settings<
 --subnet SUBNET_NAME                      >Subnet name<
 --subnet-id SUBNET_ID                      
 --volume VOLUME                           >Volume parameters<
                                           >Comma-separated list of key=value<
                                           >Can be specified multiple times.<
 -h, --help                                Print help

>Available keys for --interface<:
  mac
  ip
  type                >Possible values: interface, bmc, bond, bridge<
  name
  subnet_id
  domain_id
  identifier
  managed             true/false
  primary             >true/false, each managed hosts needs to have one primary interface.<
  provision           true/false
  virtual             true/false

  >For virtual=true<:
    tag                 >VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces.<
    attached_to         >Identifier of the interface to which this interface belongs, e.g. eth1.<

  >For type=bond<:
    mode                >Possible values: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb<
    attached_devices    >Identifiers of slave interfaces, e.g. [eth1,eth2]<
    bond_options

  >For type=bmc<:
    provider            >always IPMI<
    username
    password

  >oVirt<:
    --compute-attributes:
      cluster
      template            >Hardware profile to use<
      cores               >Integer value, number of cores<
      memory              >Amount of memory, integer value in bytes<
      start               >Boolean (expressed as 0 or 1), whether to start the machine or not<

    --interface:
      compute_name        >Eg. eth0<
      compute_network     >Select one of the available networks for a cluster<

    --volume:
      size_gb             >Volume size in GB, integer value<
      storage_domain      >Select one of available storage domains<
      bootable            >Boolean, only one volume can be bootable<

  >Rackspace<:
    --compute-attributes:
      flavor_id
      image_id


please let me know if you still un able to create the host.

Comment 4 Ganesh Patil 2018-10-19 06:26:27 UTC
Hello Shira Maximov,

Thanks for sharing the observation, I have shared the same details with the customer and requested him to apply those changes and once we get an update from the customer will reply you back.

Ganesh.

Comment 5 Ganesh Patil 2018-10-26 13:22:19 UTC
Hello,

Do find the customer udpate over the same :

===============================================================================
These parameters do exist in the VMWare section of hammer host create under --compute-attributes.
 VMWare:
    --compute-attributes:
      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

==============================================================================

Can you please suggest on this.

Ganesh.

Comment 6 Shira Maximov 2018-10-28 12:17:17 UTC
sorry, I thought that the compute resource is ovirt.
Please try to run the same command with the cluster id. and not the name under --compute-attributes.

Comment 7 Ganesh Patil 2018-11-02 02:14:16 UTC
Hello Shira,

As per your suggestion, updated the customer with the same details.
However, that did not work. Also, as per the documentation ,one can use the cluster name rather than the ID. 
For your reference : 

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/pdf/provisioning_guide/Red_Hat_Satellite-6.3-Provisioning_Guide-en-US.pdf

Page : 82/83

Please suggest on this.

Ganesh.

Comment 8 Shira Maximov 2018-11-06 08:18:51 UTC
Hey, 
I wasn't able to reproduce the same error,
Can you please provide the production.log in order to figure out the parameters that are passed in both cases : with the compute profile and without.
thanks.

Comment 10 Shira Maximov 2018-11-25 08:20:33 UTC
Please try the following and let me know if it worked.
Add path and image_id parameters in the command line under compute attributes section: 
* path - In order to find the value of path, check out: https://satellite.example.com/api/v2/compute_resources/<compute_resource_id>/available_folders
* image_id - In order to find the value of image_id, check out:  http://<satellite .example.com>/api/v2/compute_resources/<compute_resource_id>/available_images

Comment 11 Ganesh Patil 2018-11-28 20:55:27 UTC
Hello Shira,

Customer tried suggested steps but that did not help. Please find the error below 

Could not create the host:
  Host::Base(#17827680) expected, got String(#6283320)

Ganesh.

Comment 14 Shira Maximov 2018-11-29 12:47:41 UTC
Hey,
I manged to reproduce the issue,

please try the following and share with me the results:
- please remove host from --interface section, 
- please put image_id inside the --compute-attributes section. The image_id value should be the image UUID.

Comment 16 Shira Maximov 2018-12-16 08:01:01 UTC
thanks, 
So the problems to be fixed in this BZ are: 
1. Image_id is expected in "compute attributes" section even though was given already. 
2. Unclear errors in case: 
   - Wrong cluster was given
   - path is missing from the "compute attributes section" 

Please also ask the log file of there VMware resource, because it seems that the timeout came from it.

Comment 18 Bryan Kearney 2020-05-01 14:15:22 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.


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