Create a host without mac

I am trying this,
{
"host": {
"name": "testhost11",
"ip": "10.1.0.239",
"compute_resource_id": "5",
"hostgroup_id": "52"
}
}
but i got something wrong.
{
"host": {
"id": null,
"errors": {
"mac": [
"is invalid",
"can't be blank"
]
},
"full_messages": [
"MAC address is invalid",
"MAC address can't be blank"
]
}
}

If you want a host without MAC, you need to provide it in unmanaged
mode. Try to send "managed" as "false".

LZ

··· On Mon, Apr 14, 2014 at 01:54:45AM -0700, wentian@unitedstack.com wrote: > I am trying this, > { > "host": { > "name": "testhost11", > "ip": "10.1.0.239", > "compute_resource_id": "5", > "hostgroup_id": "52" > } > } > but i got something wrong. > { > "host": { > "id": null, > "errors": { > "mac": [ > "is invalid", > "can't be blank" > ] > }, > "full_messages": [ > "MAC address is invalid", > "MAC address can't be blank" > ] > } > } > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Thank you for your answer, it actually works, but
If i want to create a vm with predefine compute resource and auto the
create process, what should i do?

··· On Monday, April 14, 2014 5:56:06 PM UTC+8, Lukas Zapletal wrote: > > If you want a host without MAC, you need to provide it in unmanaged > mode. Try to send "managed" as "false". > > LZ > > On Mon, Apr 14, 2014 at 01:54:45AM -0700, wen...@unitedstack.comwrote: > > I am trying this, > > { > > "host": { > > "name": "testhost11", > > "ip": "10.1.0.239", > > "compute_resource_id": "5", > > "hostgroup_id": "52" > > } > > } > > but i got something wrong. > > { > > "host": { > > "id": null, > > "errors": { > > "mac": [ > > "is invalid", > > "can't be blank" > > ] > > }, > > "full_messages": [ > > "MAC address is invalid", > > "MAC address can't be blank" > > ] > > } > > } > > > > -- > > You received this message because you are subscribed to the Google > Groups "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to foreman-user...@googlegroups.com . > > To post to this group, send email to forema...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > > -- > Later, > > Lukas "lzap" Zapletal > irc: lzap #theforeman >

You need to distinguish between bare metal hosts that needs MAC
address and foreman managed hosts that does not need any MAC address.

If you set a compute resource (libvirt, oVirt, vmware, cloud…) than
MAC address should not be required. If you try this via UI the MAC field
will disappear after you set a compute resource.

LZ

··· On Tue, Apr 15, 2014 at 01:52:13AM -0700, wentian@unitedstack.com wrote: > Thank you for your answer, it actually works, but > If i want to create a vm with predefine compute resource and auto the > create process, what should i do? > > On Monday, April 14, 2014 5:56:06 PM UTC+8, Lukas Zapletal wrote: > > > > If you want a host without MAC, you need to provide it in unmanaged > > mode. Try to send "managed" as "false". > > > > LZ > > > > On Mon, Apr 14, 2014 at 01:54:45AM -0700, wen...@unitedstack.comwrote: > > > I am trying this, > > > { > > > "host": { > > > "name": "testhost11", > > > "ip": "10.1.0.239", > > > "compute_resource_id": "5", > > > "hostgroup_id": "52" > > > } > > > } > > > but i got something wrong. > > > { > > > "host": { > > > "id": null, > > > "errors": { > > > "mac": [ > > > "is invalid", > > > "can't be blank" > > > ] > > > }, > > > "full_messages": [ > > > "MAC address is invalid", > > > "MAC address can't be blank" > > > ] > > > } > > > } > > > > > > -- > > > You received this message because you are subscribed to the Google > > Groups "Foreman users" group. > > > To unsubscribe from this group and stop receiving emails from it, send > > an email to foreman-user...@googlegroups.com . > > > To post to this group, send email to forema...@googlegroups.com. > > > > > Visit this group at http://groups.google.com/group/foreman-users. > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > > Later, > > > > Lukas "lzap" Zapletal > > irc: lzap #theforeman > >


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

> Thank you for your answer, it actually works, but
> If i want to create a vm with predefine compute resource and auto the
> create process, what should i do?
I met this behavior recently and it was caused by missing
compute_attributes in the params (even empty "compute_attributes": {}
worked for me to bypass the missing MAC error). It is not easy to figure
out the right combination of parameters.
To me the easiest option would be to use hammer with -d option and check
what prams the CLI sends to the server.
Here is description of specific options for various providers


and here is howto for Hammer https://github.com/theforeman/hammer-cli

HTH,
Martin

··· On 04/15/2014 10:52 AM, wentian@unitedstack.com wrote:

On Monday, April 14, 2014 5:56:06 PM UTC+8, Lukas Zapletal wrote:

If you want a host without MAC, you need to provide it in unmanaged
mode. Try to send "managed" as "false".

LZ

On Mon, Apr 14, 2014 at 01:54:45AM -0700, wen...@unitedstack.com >     <javascript:> wrote:
> I am trying this,
> {
>   "host": {
>     "name": "testhost11",
>     "ip": "10.1.0.239",
>     "compute_resource_id": "5",
>     "hostgroup_id": "52"
>   }
> }
> but i got something wrong.
> {
>     "host": {
>         "id": null,
>         "errors": {
>             "mac": [
>                 "is invalid",
>                 "can't be blank"
>             ]
>         },
>         "full_messages": [
>             "MAC address is invalid",
>             "MAC address can't be blank"
>         ]
>     }
> }
>
> --
> You received this message because you are subscribed to the
Google Groups "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from
it, send an email to foreman-user...@googlegroups.com <javascript:>.
> To post to this group, send email to forema...@googlegroups.com
<javascript:>.
> Visit this group at http://groups.google.com/group/foreman-users
<http://groups.google.com/group/foreman-users>.
> For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.

-- 
Later,

 Lukas "lzap" Zapletal
 irc: lzap #theforeman


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.