[openstack-dev] [tripleo][tripleo-heat-template] how to get interface name from network name in service profile

Zenghui Shi zshi at redhat.com
Tue Aug 1 23:51:52 UTC 2017


On Wed, 2 Aug 2017 at 02:34 Ben Nemec <openstack at nemebean.com> wrote:

>
>
> On 07/25/2017 09:53 PM, Zenghui Shi wrote:
> > Hi,
> >
> > Could anyone shed some light on how to get the physical interface name
> > (e.g eth0) from network name (e.g PublicNetwork, ExternalNetwork) in
> > tripleo-heat-template service profile ?
> >
> > for example:
> >
> > I want to add a service profile under puppet/services/time/ptp.pp where
> > it uses 'PtpInterface' as a parameter to get physical interface name
> > (please refer to below piece of code), but I'd like to expose a more
> > user friendly parameter like NetworkName(e.g. provision network,
> > external network etc) instead of 'PtpInterface' and retrieve the actual
> > physical interface name from the NetworkName where the physical
> > interface is connected to, is there any possible way to do this ?
>
> I don't think there is.  In many cases the templates don't even know the
> name of the physical device on which the network will be running.  A
> simple example would be when a user uses the nicX abstraction to specify
> interfaces in their net-iso templates.  That doesn't get mapped to an
> actual interface name until os-net-config runs, and the results of that
> run are not available to the templates.
>

Thanks Ben!

I'm also thinking if it makes sense to have a way in template or target
nodes to re-use the results of os-net-config for services which are bonded
to certain interfaces, or re-implement the os-net-config logic in template
to get the physical interface name. The latter one will be a repetitive
work of os-net-config.

Cheers!
Zenghui

>
> >
> > ####
> > parameters:
> > [...]
> >    PtpInterface:      #  ---> change this parameter to PtpNetwork
> >      default: eth0
> >      description: PTP interfaces name.
> >      type: string
> >
> > resources:
> >    RoleParametersValue
> >      type: OS::Heat::Value
> >      properties:
> >        type: json
> >        value:             # ---> add logic to get real interface name
> > from PtpNetwork
> >          map_replace:
> >            - map_replace:
> >              - tripleo::profile::base::time::ptp::ptp4l_interface:
> > PtpInterface
> >              - values: {get_param: [RoleParameters]}
> >            - values:
> >                PtpInterface: {get_param: PtpInterface}
> >
> > outputs:
> >    role_data:
> >      description: Role ptp using commposable services.
> >      value:
> >        service_name: ptp
> >        config_settings:
> >          map_merge:
> >            - get_attr: [RoleParametersValue, value]
> > [...]
> > ####
> >
> > Thanks!
> > zenghui
> >
> >
> >
> __________________________________________________________________________
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe:
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170801/292b2391/attachment.html>


More information about the OpenStack-dev mailing list