Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
resource-agents.25668
0001-aws-vpc-move-ip-Allow-to-set-the-interface...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-aws-vpc-move-ip-Allow-to-set-the-interface-label.patch of Package resource-agents.25668
From a357c1754e1d752781e75346856d3898dc6f558d Mon Sep 17 00:00:00 2001 From: Petr Pavlu <petr.pavlu@suse.com> Date: Mon, 23 May 2022 14:00:33 +0200 Subject: [PATCH] aws-vpc-move-ip: Allow to set the interface label Allow to specify an interface label to distinguish the IP address managed by aws-vpc-move-ip, similarly as can be done with IPaddr2. --- heartbeat/aws-vpc-move-ip | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip index 5d520408..a2b2359c 100755 --- a/heartbeat/aws-vpc-move-ip +++ b/heartbeat/aws-vpc-move-ip @@ -43,6 +43,7 @@ OCF_RESKEY_address_default="" OCF_RESKEY_routing_table_default="" OCF_RESKEY_routing_table_role_default="" OCF_RESKEY_interface_default="eth0" +OCF_RESKEY_iflabel_default="" OCF_RESKEY_monapi_default="false" OCF_RESKEY_lookup_type_default="InstanceId" @@ -54,6 +55,7 @@ OCF_RESKEY_lookup_type_default="InstanceId" : ${OCF_RESKEY_routing_table=${OCF_RESKEY_routing_table_default}} : ${OCF_RESKEY_routing_table_role=${OCF_RESKEY_routing_table_role_default}} : ${OCF_RESKEY_interface=${OCF_RESKEY_interface_default}} +: ${OCF_RESKEY_iflabel=${OCF_RESKEY_iflabel_default}} : ${OCF_RESKEY_monapi=${OCF_RESKEY_monapi_default}} : ${OCF_RESKEY_lookup_type=${OCF_RESKEY_lookup_type_default}} @@ -149,6 +151,18 @@ Name of the network interface, i.e. eth0 <content type="string" default="${OCF_RESKEY_interface_default}" /> </parameter> +<parameter name="iflabel"> +<longdesc lang="en"> +You can specify an additional label for your IP address here. +This label is appended to your interface name. + +The kernel allows alphanumeric labels up to a maximum length of 15 +characters including the interface name and colon (e.g. eth0:foobar1234) +</longdesc> +<shortdesc lang="en">Interface label</shortdesc> +<content type="string" default="${OCF_RESKEY_iflabel_default}"/> +</parameter> + <parameter name="monapi"> <longdesc lang="en"> Enable enhanced monitoring using AWS API calls to check route table entry @@ -215,6 +229,14 @@ ec2ip_validate() { return $OCF_ERR_CONFIGURED fi + if [ -n "$OCF_RESKEY_iflabel" ]; then + label=${OCF_RESKEY_interface}:${OFC_RESKEY_iflabel} + if [ ${#label} -gt 15 ]; then + ocf_exit_reason "Interface label [$label] exceeds maximum character limit of 15" + exit $OCF_ERR_CONFIGURED + fi + fi + TOKEN=$(curl -sX PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") EC2_INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id -H "X-aws-ec2-metadata-token: $TOKEN") @@ -363,7 +385,13 @@ ec2ip_get_and_configure() { # Reconfigure the local ip address ec2ip_drop - cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface" + + extra_opts="" + if [ -n "$OCF_RESKEY_iflabel" ]; then + extra_opts="$extra_opts label $OCF_RESKEY_interface:$OCF_RESKEY_iflabel" + fi + + cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface$extra_opts" ocf_log debug "executing command: $cmd" $cmd rc=$? -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor