control: tags -1 +patch
Hi,
On Tue, 25 Aug 2015 14:27:46 +0200 Christoph Martin wrote:
> hv_kvp_daemon[941]: sh: 1: hv_get_dns_info: not found
> hv_kvp_daemon[941]: sh: 1: hv_get_dhcp_info: not found
> hv_kvp_daemon[941]: sh: 1: hv_get_dns_info: not found
> hv_kvp_daemon[941]: sh: 1: hv_get_dhcp_info: not found
>
> These scripts are missing from the package.
> Debian should include there own disto specific versions of this scripts.
>
> Examples are in the linux-tools source in the directory tools/hv/
patch taken from ubuntu package
--
Hideki Yamane
diff -urN linux-tools-4.3~rc5/debian/hv_get_dhcp_info linux-tools-4.3~rc5.update/debian/hv_get_dhcp_info
--- linux-tools-4.3~rc5/debian/hv_get_dhcp_info 1970-01-01 09:00:00.0 +0900
+++ linux-tools-4.3~rc5.update/debian/hv_get_dhcp_info 2015-11-21 14:05:21.025229857 +0900
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# This example script retrieves the DHCP state of a given interface.
+# In the interest of keeping the KVP daemon code free of distro specific
+# information; the kvp daemon code invokes this external script to gather
+# DHCP setting for the specific interface.
+#
+# Input: Name of the interface
+#
+# Output: The script prints the string "Enabled" to stdout to indicate
+# that DHCP is enabled on the interface. If DHCP is not enabled,
+# the script prints the string "Disabled" to stdout.
+
+IF_FILE="/etc/network/interfaces"
+NMCMD="nmcli"
+
+function checknetworkmanager {
+# Assumes if $NMCMD exists, inteface exists and interface is not
+# in $IF_FILE then dhcp is being used by NM
+if $NMCMD dev status 2>/dev/null | grep -q $1; then
+echo "Enabled"
+else
+echo "Disabled"
+fi
+}
+
+if [ -z $1 ]; then
+echo "Disabled"; exit
+fi
+
+
+if grep -v -e "^#" $IF_FILE 2>/dev/null | grep -q $1 ; then
+#interface exists so
+if grep -q -e $1\.\*dhcp $IF_FILE; then
+ echo "Enabled"
+else
+ echo "Disabled"
+fi
+else
+checknetworkmanager $1
+fi
diff -urN linux-tools-4.3~rc5/debian/hv_get_dns_info linux-tools-4.3~rc5.update/debian/hv_get_dns_info
--- linux-tools-4.3~rc5/debian/hv_get_dns_info 1970-01-01 09:00:00.0 +0900
+++ linux-tools-4.3~rc5.update/debian/hv_get_dns_info 2015-11-21 14:05:21.025229857 +0900
@@ -0,0 +1,2 @@
+#!/bin/sh
+awk '/^nameserver/ { print $2 }' /etc/resolv.conf 2>/dev/null
diff -urN linux-tools-4.3~rc5/debian/hv_set_ifconfig linux-tools-4.3~rc5.update/debian/hv_set_ifconfig
--- linux-tools-4.3~rc5/debian/hv_set_ifconfig 1970-01-01 09:00:00.0 +0900
+++ linux-tools-4.3~rc5.update/debian/hv_set_ifconfig 2015-11-21 14:05:21.025229857 +0900
@@ -0,0 +1,242 @@
+#! /usr/bin/env python
+
+# set interfaces in hv_kvp_daemon style
+import fileinput
+import sys
+import errno
+import os
+import shutil
+import tempfile
+import subprocess
+
+if_filename="/etc/network/interfaces"
+
+'''Get quiet'''
+sys.stdout = open(os.devnull, 'w')
+sys.stderr = open(os.devnull, 'w')
+
+try:
+ if_file=open(if_filename,"r+")
+except IOError as e:
+ exit(e.errno)
+else:
+ if_file.close()
+
+
+def kvp_dict(file):
+ return dict(line.strip().split("=") for line in file)
+
+
+#setting the hwaddress to something azure is not expecting is fatal networking
+
+if len(sys.argv) != 2 :
+ exit(errno.EINVAL)
+
+kvp=dict(line.strip().split("=") for line in fileinput.input())
+
+if not "HWADDR" in kvp :
+ exit(errno.EPROTO)
+
+if not "DEVICE" in kvp :
+ exit(1)
+
+output=[]
+basename=kvp["DEVICE"]
+
+if "DHCP" in kvp and kvp["DHCP"]=="yes" :
+ output += ["auto " + basename]
+ output += ["iface " + basename + " inet dhcp"]
+ output += [""]
+else:
+ ''' Matchup the interface specific lines '''
+
+ '''DNS entries will go with the first interface
+ and there can be a max of three'''
+ autolist=[]
+ dns=[]
+ if "DNS1" in kvp :
+ dns+=[kvp["DNS1"]]
+ if "DNS2" in kvp :
+ dns+=[kvp["DNS2"]]
+ if "DNS3" in kvp :
+dns+=[kvp["DNS3"]]
+
+
+ '''
+ No real max for the number of interface + aliases ...
+ only required is the address (but mate everything up that comes in. '''
+
+ '''ipv4 first'''
+
+ v4names=[name for name in kvp.keys() if name.startswith("IPADDR")]
+ v4names.sort()
+
+ v6names=[name for name in kvp.keys() if name.startswith("IPV6ADDR")]
+ v6names.sort()
+
+ '''IPV6 requires a netmask'''
+ '''If an ipv6 exists, you'll want to turn off /proc/sys/net/ipv6/conf/all/autoconf with
+ up echo 0 > /proc/sys/net/ipv6/conf/all/autoconf'''
+
+ '''Counter needs to increment as soon as any interface is set.'''
+
+
+ if_count=0
+
+ for v4 in v4names:
+ ifname=basename
+ suffix=""
+ if if_count :
+ ifname+=":" + str(if_count)
+ suffix="_"+str(if_count)
+ if not ifname in autolist:
+ autolist += [ifname]
+ output += [ "iface " + ifname + " inet static"]
+ output += [ "\t" + "address " + kvp[v4]]
+ if "NETMASK"+suffix in kvp.keys():
+ output += ["\tnetmask " + kvp["NETMASK"+suffix]]
+ if "GATEWAY"+suffix in kvp.keys():
+ output +=