On 01/15/15 at 07:27pm, Minfei Huang wrote:
Add a new function to parse the parameter, if the parameter is
domain/hostname, not the ip address.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
kdump-lib.sh | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index b886c5d..6ca2b3a 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -170,21 +170,28 @@ get_remote_host()
echo $_config_val
}
+get_ip_address()
+{
+ local _ip_address
+
+ _ip_address=`getent ahosts $1 | head -n 1 | cut -d' ' -f1`
+ _ip_address=${_ip_address:-$1}
+ echo $_ip_address
+}
Function description is necessary. Can this patch be merged into patch 3/4
they are similar for introducing more ip address functions.
+
# check the remote server ip address tpye
is_ipv6_target()
{
- local _server _server_tmp
+ local _target
if is_ssh_dump_target; then
- _server=`get_option_value ssh`
+ _target=`get_option_value ssh`
elif is_nfs_dump_target; then
- _server=`get_option_value nfs`
+ _target=`get_option_value nfs`
fi
- [ -z "$_server" ] && return 1
- _server=`get_remote_host $_server`
- _server_tmp=$_server
- _server=`getent ahosts $_server | head -n 1 | cut -d' ' -f1`
- _server=${_server:-$_server_tmp}
- echo $_server | grep -q ":"
+ [ -z "$_target" ] && return 1
+ _target=`get_remote_host $_target`
+
+ echo $(get_ip_address $_target) | grep -q ":"
}
--
1.9.3
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec