1.4.0 Host Create API compute resource interface issues

This may need to be in the users group, but I will start here. I have
noticed an issue with the host create api in 1.4.0 (POST /api/hosts). We
are using vmware as a compute resource and use scripts to deploy
application nodes via foreman. In 1.3.x I was able to pass the vmware
network name as defined in vmware (ex cloud-app-dev). In the 1.4.0 api,
this appears to have changed to a network ID. I have not been able to find
where this association is stored. Is there a recommended way to set
compute resource parameters in 1.4? I also attempted to use compute
profiles, but it appears the api does not support using those yet in a host
create workflow.

Here is the POST parameters and the error received back from foreman

POSTBODY: {'host': {'comment': '', 'is_owned_by': '', 'managed': 'true',
'name': 'foremant-1.cloud.dev', 'model_id': '', 'provision_method':
'build', 'enabled': '1', 'hostgroup_id': 4, 'compute_attributes':
{'volumes_attributes': {'0': {'size_gb': '10', 'datastore': 'n1dev1',
'_delete': '', 'name': 'Hard disk', 'thin': 'true'}, 'new_volumes':
{'size_gb': '10', 'datastore': 'n1dev1', '_delete': '', 'name': 'Hard
disk', 'thin': 'true'}}, 'interfaces_attributes': {'0': {'_delete': '',
'type': 'VirtualVmxnet3',* 'network': 'cloud-app-dev'*}, 'new_interfaces':
{'_delete': '', 'network': 'VM Network'}}, 'cpus': '1', 'memory_mb':
'2048', 'cluster': 'CloudCluster', 'path':
'/Datacenters/Mandan/vm/app-dev', 'start': '1'}, 'interfaces_attributes':
{'new_interfaces': {'mac': '', 'name': '', '_destroy': 'false',
'subnet_id': '', 'ip': '', 'provider': 'IPMI', 'type': 'Nic::Managed',
'domain_id': ''}}, 'mac': '', 'build': '1', 'puppetclass_ids': ['', '121'],
'disk': '', 'type': 'Host::Managed', 'overwrite': 'false',
'compute_resource_id': '2'}, 'capabilities': 'build'}\

ERROROUTPUT: {

"error": {"id":null,"errors":{"base":["Failed to create a compute
VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
cloud-app-dev\n "]},"full_messages":["Failed to create a compute
VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
cloud-app-dev\n "]}

}

When using the UI and checking the logs, I see the following in the post
data for the interface attributes: "0"=>{"type"=>"VirtualVmxnet3",
"network"=>"network-73", "_delete"=>""}

Thanks for any assistance!

-Andrew

> This may need to be in the users group, but I will start here. I have
> noticed an issue with the host create api in 1.4.0 (POST /api/hosts). We
> are using vmware as a compute resource and use scripts to deploy
> application nodes via foreman. In 1.3.x I was able to pass the vmware
> network name as defined in vmware (ex cloud-app-dev). In the 1.4.0 api,
> this appears to have changed to a network ID. I have not been able to find
> where this association is stored. Is there a recommended way to set
> compute resource parameters in 1.4? I also attempted to use compute
> profiles, but it appears the api does not support using those yet in a host
> create workflow.
>
> Here is the POST parameters and the error received back from foreman
>
> POSTBODY: {'host': {'comment': '', 'is_owned_by': '', 'managed': 'true',
> 'name': 'foremant-1.cloud.dev', 'model_id': '', 'provision_method':
> 'build', 'enabled': '1', 'hostgroup_id': 4, 'compute_attributes':
> {'volumes_attributes': {'0': {'size_gb': '10', 'datastore': 'n1dev1',
> '_delete': '', 'name': 'Hard disk', 'thin': 'true'}, 'new_volumes':
> {'size_gb': '10', 'datastore': 'n1dev1', '_delete': '', 'name': 'Hard
> disk', 'thin': 'true'}}, 'interfaces_attributes': {'0': {'_delete': '',
> 'type': 'VirtualVmxnet3',* 'network': 'cloud-app-dev'*},
> 'new_interfaces': {'_delete': '', 'network': 'VM Network'}}, 'cpus': '1',
> 'memory_mb': '2048', 'cluster': 'CloudCluster', 'path':
> '/Datacenters/Mandan/vm/app-dev', 'start': '1'}, 'interfaces_attributes':
> {'new_interfaces': {'mac': '', 'name': '', '_destroy': 'false',
> 'subnet_id': '', 'ip': '', 'provider': 'IPMI', 'type': 'Nic::Managed',
> 'domain_id': ''}}, 'mac': '', 'build': '1', 'puppetclass_ids': ['', '121'],
> 'disk': '', 'type': 'Host::Managed', 'overwrite': 'false',
> 'compute_resource_id': '2'}, 'capabilities': 'build'}
>
> ERROROUTPUT: {
>
> "error": {"id":null,"errors":{"base":["Failed to create a compute
> VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
> cloud-app-dev\n "]},"full_messages":["Failed to create a compute
> VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
> cloud-app-dev\n "]}
>
> }
>
>
> When using the UI and checking the logs, I see the following in the post
> data for the interface attributes: "0"=>{"type"=>"VirtualVmxnet3",
> "network"=>"network-73", "_delete"=>""}
>
>
> if you use compute_profiles instead of passing the compute_attributes,
does it work?

Ohad

··· On Mon, Feb 10, 2014 at 7:45 PM, Andrew Cooper wrote:

Thanks for any assistance!

-Andrew


You received this message because you are subscribed to the Google Groups
“foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Here is what I get when using the bare minimum parameters and using v2 api.
Note: I have set a default compute profile and all provisioning
information (OS, Partition Table, etc) at the host group level. It seems
like it's not realizing it needs to dynamically retrieve the mac address.
I have also posted the output from the hostgroups api for the particular
hostgroup we are working with

Posted parameters to api/hosts:
{"host":{"name":"testbuild", "hostgroup_id":"4", "compute_resource_id":"2",
"environment_id":"1", "puppet_ca_proxy_id":"7", "puppet_proxy_id":"7",
"puppetclass_ids":["", "129"], "domain_id":"2", "subnet_id":"8",
"architecture_id":"1"}}

Response:
{
"error": {
"id": null,
"errors": {
"mac": [
"has already been taken",
"is invalid",
"can't be blank"
]
},
"full_messages": [
"MAC address has already been taken",
"MAC address is invalid",
"MAC address can't be blank"
]
}
}

Hostgroup id 4 via api/hostgroups:
{
"id": 4,
"name": "JettyApp",
"label": "Dev/JettyApp",
"subnet_id": 2,
"subnet_name": "App-Dev",
"operatingsystem_id": 3,
"operatingsystem_name": "OpenSuSE 12.1",
"domain_id": 1,
"domain_name": "cloud.dev",
"environment_id": 1,
"environment_name": "production",
"compute_profile_id": 1,
"compute_profile_name": "1-Small",
"ancestry": "1",
"parameters": {
"ntp_initial": "208.53.158.34",
"settings_environment": "QA",
"cassandra_hostgroup": "Dev/Cassandra",
"cassandra_instance": "DevCass1",
"hadoop_instance": "1",
"ldapnode": "ldap.cloud.dev",
"zoo_instance": "1"
},

··· On Monday, February 10, 2014 11:45:04 AM UTC-6, Andrew Cooper wrote: > > This may need to be in the users group, but I will start here. I have > noticed an issue with the host create api in 1.4.0 (POST /api/hosts). We > are using vmware as a compute resource and use scripts to deploy > application nodes via foreman. In 1.3.x I was able to pass the vmware > network name as defined in vmware (ex cloud-app-dev). In the 1.4.0 api, > this appears to have changed to a network ID. I have not been able to find > where this association is stored. Is there a recommended way to set > compute resource parameters in 1.4? I also attempted to use compute > profiles, but it appears the api does not support using those yet in a host > create workflow. > > Here is the POST parameters and the error received back from foreman > > POSTBODY: {'host': {'comment': '', 'is_owned_by': '', 'managed': 'true', > 'name': 'foremant-1.cloud.dev', 'model_id': '', 'provision_method': > 'build', 'enabled': '1', 'hostgroup_id': 4, 'compute_attributes': > {'volumes_attributes': {'0': {'size_gb': '10', 'datastore': 'n1dev1', > '_delete': '', 'name': 'Hard disk', 'thin': 'true'}, 'new_volumes': > {'size_gb': '10', 'datastore': 'n1dev1', '_delete': '', 'name': 'Hard > disk', 'thin': 'true'}}, 'interfaces_attributes': {'0': {'_delete': '', > 'type': 'VirtualVmxnet3',* 'network': 'cloud-app-dev'*}, > 'new_interfaces': {'_delete': '', 'network': 'VM Network'}}, 'cpus': '1', > 'memory_mb': '2048', 'cluster': 'CloudCluster', 'path': > '/Datacenters/Mandan/vm/app-dev', 'start': '1'}, 'interfaces_attributes': > {'new_interfaces': {'mac': '', 'name': '', '_destroy': 'false', > 'subnet_id': '', 'ip': '', 'provider': 'IPMI', 'type': 'Nic::Managed', > 'domain_id': ''}}, 'mac': '', 'build': '1', 'puppetclass_ids': ['', '121'], > 'disk': '', 'type': 'Host::Managed', 'overwrite': 'false', > 'compute_resource_id': '2'}, 'capabilities': 'build'}\ > > ERROROUTPUT: { > > "error": {"id":null,"errors":{"base":["Failed to create a compute > VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID: > cloud-app-dev\n "]},"full_messages":["Failed to create a compute > VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID: > cloud-app-dev\n "]} > > } > > > When using the UI and checking the logs, I see the following in the post > data for the interface attributes: "0"=>{"type"=>"VirtualVmxnet3", > *"network"=>"network-73"*, "_delete"=>""} > > > Thanks for any assistance! > > -Andrew >

I have noticed the same thing, and it does not look like the API (or
hammer) supports using compute_profiles yet.

··· On Tuesday, February 11, 2014 6:40:58 AM UTC-5, ohadlevy wrote: > > > > > On Mon, Feb 10, 2014 at 7:45 PM, Andrew Cooper <coop...@gmail.com > > wrote: > >> This may need to be in the users group, but I will start here. I have >> noticed an issue with the host create api in 1.4.0 (POST /api/hosts). We >> are using vmware as a compute resource and use scripts to deploy >> application nodes via foreman. In 1.3.x I was able to pass the vmware >> network name as defined in vmware (ex cloud-app-dev). In the 1.4.0 api, >> this appears to have changed to a network ID. I have not been able to find >> where this association is stored. Is there a recommended way to set >> compute resource parameters in 1.4? I also attempted to use compute >> profiles, but it appears the api does not support using those yet in a host >> create workflow. >> >> Here is the POST parameters and the error received back from foreman >> >> POSTBODY: {'host': {'comment': '', 'is_owned_by': '', 'managed': 'true', >> 'name': 'foremant-1.cloud.dev', 'model_id': '', 'provision_method': >> 'build', 'enabled': '1', 'hostgroup_id': 4, 'compute_attributes': >> {'volumes_attributes': {'0': {'size_gb': '10', 'datastore': 'n1dev1', >> '_delete': '', 'name': 'Hard disk', 'thin': 'true'}, 'new_volumes': >> {'size_gb': '10', 'datastore': 'n1dev1', '_delete': '', 'name': 'Hard >> disk', 'thin': 'true'}}, 'interfaces_attributes': {'0': {'_delete': '', >> 'type': 'VirtualVmxnet3',* 'network': 'cloud-app-dev'*}, >> 'new_interfaces': {'_delete': '', 'network': 'VM Network'}}, 'cpus': '1', >> 'memory_mb': '2048', 'cluster': 'CloudCluster', 'path': >> '/Datacenters/Mandan/vm/app-dev', 'start': '1'}, 'interfaces_attributes': >> {'new_interfaces': {'mac': '', 'name': '', '_destroy': 'false', >> 'subnet_id': '', 'ip': '', 'provider': 'IPMI', 'type': 'Nic::Managed', >> 'domain_id': ''}}, 'mac': '', 'build': '1', 'puppetclass_ids': ['', '121'], >> 'disk': '', 'type': 'Host::Managed', 'overwrite': 'false', >> 'compute_resource_id': '2'}, 'capabilities': 'build'}\ >> >> ERROROUTPUT: { >> >> "error": {"id":null,"errors":{"base":["Failed to create a compute >> VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID: >> cloud-app-dev\n "]},"full_messages":["Failed to create a compute >> VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID: >> cloud-app-dev\n "]} >> >> } >> >> >> When using the UI and checking the logs, I see the following in the post >> data for the interface attributes: "0"=>{"type"=>"VirtualVmxnet3", >> *"network"=>"network-73"*, "_delete"=>""} >> >> >> if you use compute_profiles instead of passing the compute_attributes, > does it work? > > Ohad > >> Thanks for any assistance! >> >> -Andrew >> >> -- >> You received this message because you are subscribed to the Google Groups >> "foreman-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-dev...@googlegroups.com . >> For more options, visit https://groups.google.com/groups/opt_out. >> > >

I have also noticed this issue. Previously, we would POST something like
this to /api/hosts:

{
"subnet_id" : null,
"compute_attributes" : {
"interfaces_attributes" : {
"0" : {
"network" : "<network>",
"_delete" : ""
}
},
"cluster" : "<cluster>",
"volumes_attributes" : {
"1" : {
"thin" : "0",
"datastore" : "<datastore>",
"name" : "Hard disk 1",
"size_gb" : 30
}
},
"power_action" : "start",
"memory_mb" : 2048,
"path" : "<path>",
"cpus" : 1,
"start" : "1"
},
"hostgroup_id" : "81",
"environment_id" : 40,
"provision_method" : "build",
"ptable_id" : 11,
"operatingsystem_id" : null,
"domain_id" : null,
"overwrite" : "false",
"enabled" : "1",
"name" : "<fqdn>",
"build" : "1",
"architecture_id" : null,
"medium_id" : null,
"managed" : "true",
"compute_resource_id" : 2,
"puppet_proxy_id" : null
}

Now I am trying this:

{
"subnet_id" : null,
"hostgroup_id" : "81",
"compute_profile_id" : 1,
"environment_id" : 40,
"provision_method" : "build",
"ptable_id" : 11,
"operatingsystem_id" : null,
"domain_id" : null,
"overwrite" : "false",
"enabled" : "1",
"name" : "<fqdn>",
"build" : "1",
"architecture_id" : null,
"medium_id" : null,
"managed" : "true",
"puppet_proxy_id" : null
}

And the errors I get back are the same as what Andrew reported. I can't
provision a VM through the web interface either, as the MAC address is
required. Previously, this was generated by Foreman/VMware.

Is there any other info I can provide to help find the source of the
problem?

Thanks,

Greg

> I have noticed the same thing, and it does not look like the API (or
> hammer) supports using compute_profiles yet.
>

its true that there is no API for compute_profiles yet, but if you already
created one in the UI, you can pass the compute_profile_id to the
host/hostgroup.

if the hostgroup already has a compute profile, then you dont need to
change anything when creating the host, as it would use it by default.
Ohad

··· On Wed, Feb 12, 2014 at 2:06 AM, Michael Griffin wrote:

On Tuesday, February 11, 2014 6:40:58 AM UTC-5, ohadlevy wrote:

On Mon, Feb 10, 2014 at 7:45 PM, Andrew Cooper coop...@gmail.com wrote:

This may need to be in the users group, but I will start here. I have
noticed an issue with the host create api in 1.4.0 (POST /api/hosts). We
are using vmware as a compute resource and use scripts to deploy
application nodes via foreman. In 1.3.x I was able to pass the vmware
network name as defined in vmware (ex cloud-app-dev). In the 1.4.0 api,
this appears to have changed to a network ID. I have not been able to find
where this association is stored. Is there a recommended way to set
compute resource parameters in 1.4? I also attempted to use compute
profiles, but it appears the api does not support using those yet in a host
create workflow.

Here is the POST parameters and the error received back from foreman

POSTBODY: {‘host’: {‘comment’: ‘’, ‘is_owned_by’: ‘’, ‘managed’: ‘true’,
‘name’: ‘foremant-1.cloud.dev’, ‘model_id’: ‘’, ‘provision_method’:
‘build’, ‘enabled’: ‘1’, ‘hostgroup_id’: 4, ‘compute_attributes’:
{‘volumes_attributes’: {‘0’: {‘size_gb’: ‘10’, ‘datastore’: ‘n1dev1’,
‘_delete’: ‘’, ‘name’: ‘Hard disk’, ‘thin’: ‘true’}, ‘new_volumes’:
{‘size_gb’: ‘10’, ‘datastore’: ‘n1dev1’, ‘_delete’: ‘’, ‘name’: ‘Hard
disk’, ‘thin’: ‘true’}}, ‘interfaces_attributes’: {‘0’: {‘_delete’: ‘’,
‘type’: ‘VirtualVmxnet3’,* ‘network’: ‘cloud-app-dev’*},
‘new_interfaces’: {‘_delete’: ‘’, ‘network’: ‘VM Network’}}, ‘cpus’: ‘1’,
‘memory_mb’: ‘2048’, ‘cluster’: ‘CloudCluster’, ‘path’:
‘/Datacenters/Mandan/vm/app-dev’, ‘start’: ‘1’},
‘interfaces_attributes’: {‘new_interfaces’: {‘mac’: ‘’, ‘name’: ‘’,
‘_destroy’: ‘false’, ‘subnet_id’: ‘’, ‘ip’: ‘’, ‘provider’: ‘IPMI’, ‘type’:
‘Nic::Managed’, ‘domain_id’: ‘’}}, ‘mac’: ‘’, ‘build’: ‘1’,
‘puppetclass_ids’: [‘’, ‘121’], ‘disk’: ‘’, ‘type’: ‘Host::Managed’,
‘overwrite’: ‘false’, ‘compute_resource_id’: ‘2’}, ‘capabilities’: ‘build’}\

ERROROUTPUT: {

“error”: {“id”:null,“errors”:{“base”:["Failed to create a compute
VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
cloud-app-dev\n "]},“full_messages”:["Failed to create a compute
VMware_mndcldvc (VMWare) instance foremant-1.cloud.dev: Unknown Network ID:
cloud-app-dev\n "]}

}

When using the UI and checking the logs, I see the following in the post
data for the interface attributes: “0”=>{“type”=>“VirtualVmxnet3”,
“network”=>“network-73”, “_delete”=>“”}

if you use compute_profiles instead of passing the compute_attributes,
does it work?

Ohad

Thanks for any assistance!

-Andrew


You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


You received this message because you are subscribed to the Google Groups
“foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.