On Wed, Aug 2, 2017 at 5:21 AM, Zenghui Shi <z...@redhat.com> wrote: > > On Wed, 2 Aug 2017 at 02:34 Ben Nemec <openst...@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.
This patch [1] has been started by Dan Sneddon to provide the nic number to name mapping by providing an extra option "--interfaces" to os-net-config command. May this could be reused to get the mapping. Regards, Saravanan KR [1] https://review.openstack.org/#/c/383516/ > > 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-requ...@lists.openstack.org?subject:unsubscribe >> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> > > > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > __________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev