drivers: hv: kvp
Subsystems (4)
cover drivers: hv: kvp
This patchset expands the KVP (Key Value Pair) functionality to implement the mechanism to get/set IP addresses in the guest. This functionality is used in Windows Server 2012 to implement VM replication functionality. The way IP configuration information is managed is distro specific. The current implementation supports RedHat way of doing things. We will expand support to other distros incrementally.
K. Y. Srinivasan (13):
Drivers: hv: Add KVP definitions for IP address injection
Drivers: hv: kvp: Cleanup error handling in KVP
Drivers: hv: kvp: Support the new IP injection messages
Tools: hv: Prepare to expand kvp_get_ip_address() functionality
Tools: hv: Further refactor kvp_get_ip_address()
Tools: hv: Gather address family information
Tools: hv: Gather subnet information
Tools: hv: Represent the ipv6 mask using CIDR notation
Tools: hv: Gather DNS information
Tools: hv: Gather ipv[4,6] gateway information
Tools: hv: Gather dhcp information
Tools: hv: Implement the KVP verb - KVP_OP_GET_IP_INFO
Tools: hv: Implement the KVP verb - KVP_OP_SET_IP_INFO
drivers/hv/hv_kvp.c | 103 ++++++-- include/linux/hyperv.h | 39 +++- tools/hv/hv_kvp_daemon.c | 650 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 686 insertions(+), 106 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/13 Drivers: hv: Add KVP definitions for IP address injection
Add the necessary definitions for supporting the IP injection functionality.
--- include/linux/hyperv.h | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
include/linux/hyperv.h +24 -0
@@ -127,6 +127,8 @@ enum hv_kvp_exchg_op {KVP_OP_SET ,KVP_OP_DELETE ,KVP_OP_ENUMERATE , +KVP_OP_GET_IP_INFO , +KVP_OP_SET_IP_INFO ,KVP_OP_REGISTER , KVP_OP_COUNT /* Number of operations, must be last. */ };
@@ -140,6 +142,26 @@ enum hv_kvp_exchg_pool {KVP_POOL_COUNT /* Number of pools, must be last. */ }; +#define ADDR_FAMILY_NONE 0x00 +#define ADDR_FAMILY_IPV4 0x01 +#define ADDR_FAMILY_IPV6 0x02 + +#define MAX_ADAPTER_ID_SIZE 128 +#define MAX_IP_ADDR_SIZE 1024 +#define MAX_GATEWAY_SIZE 512 + + +struct hv_kvp_ipaddr_value { +__u16 adapter_id[MAX_ADAPTER_ID_SIZE ]; +__u8 addr_family; +__u8 dhcp_enabled; +__u16 ip_addr[MAX_IP_ADDR_SIZE ]; +__u16 sub_net[MAX_IP_ADDR_SIZE ]; +__u16 gate_way[MAX_GATEWAY_SIZE ]; +__u16 dns_addr[MAX_IP_ADDR_SIZE ]; +} __attribute__((packed)); + +struct hv_kvp_hdr {__u8 operation;__u8 pool;
@@ -187,6 +209,7 @@ struct hv_kvp_msg {struct hv_kvp_msg_set kvp_set;struct hv_kvp_msg_delete kvp_delete;struct hv_kvp_msg_enumerate kvp_enum_data; +struct hv_kvp_ipaddr_value kvp_ip_val;struct hv_kvp_register kvp_register; } body; } __attribute__((packed));
@@ -982,6 +1005,7 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);#define HV_S_CONT 0x80070103#define HV_ERROR_NOT_SUPPORTED 0x80070032#define HV_ERROR_MACHINE_LOCKED 0x800704F7 +#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F/* * While we want to handle util services as regular devices,
Signature · 1 line
1.7.4.1
PATCH 2/13 Drivers: hv: kvp: Cleanup error handling in KVP
In preparation to implementing IP injection, cleanup the way we propagate and handle errors both in the driver as well as in the user level daemon.
--- drivers/hv/hv_kvp.c | 43 +++++++++++++++++++------------------ include/linux/hyperv.h | 17 +++++++++----- tools/hv/hv_kvp_daemon.c | 53 +++++++++++++++++++++++---------------------- 3 files changed, 60 insertions(+), 53 deletions(-)
drivers/hv/hv_kvp.c +22 -21
@@ -50,7 +50,6 @@ static struct {static void kvp_send_key (struct work_struct *dummy); -#define TIMEOUT_FIRED 1static void kvp_respond_to_host (char *key,char *value,int error);static void kvp_work_func (struct work_struct *dummy);
@@ -97,7 +96,7 @@ kvp_work_func(struct work_struct *dummy)* If the timer fires, the user-mode component has not responded; * process the pending transaction. */ -kvp_respond_to_host ("Unknown key" ,"Guest timed out" ,TIMEOUT_FIRED ); +kvp_respond_to_host ("Unknown key" ,"Guest timed out" ,HV_E_FAIL ); }/*
@@ -109,27 +108,31 @@ kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) {struct hv_kvp_msg *message;struct hv_kvp_msg_enumerate *data; +int error; message = (struct hv_kvp_msg *)msg->data; -switch (message->kvp_hdr.operation) { -case KVP_OP_REGISTER : + +if (message->kvp_hdr.operation ==KVP_OP_REGISTER ) {pr_info ("KVP: user-mode registering done.\n" );kvp_register (); kvp_transaction.active = false; -hv_kvp_onchannelcallback (kvp_transaction.kvp_context); -break ; - -default : - data = &message->body.kvp_enum_data; -/* -* Complete the transaction by forwarding the key value -* to the host. But first, cancel the timeout. -*/ -if (cancel_delayed_work_sync (&kvp_work)) -kvp_respond_to_host (data->data.key, - data->data.value, - !strlen (data->data.key)); +if (kvp_transaction.kvp_context) +hv_kvp_onchannelcallback (kvp_transaction.kvp_context); +return ; } + +/* +* We use the message header information from +* the user level daemon to transmit errors. +*/ + error = *((int *)(&message->kvp_hdr.operation)); + data = &message->body.kvp_enum_data; +/* +* Complete the transaction by forwarding the key value +* to the host. But first, cancel the timeout. +*/ +if (cancel_delayed_work_sync (&kvp_work)) +kvp_respond_to_host (data->data.key, data->data.value, error); } static void
@@ -287,6 +290,7 @@ kvp_respond_to_host(char *key, char *value, int error)*/ return ; + icmsghdrp->status = error;/* * If the error parameter is set, terminate the host's enumeration
@@ -294,15 +298,12 @@ kvp_respond_to_host(char *key, char *value, int error)*/ if (error) {/* -* Something failed or the we have timedout; +* Something failed or we have timedout; * terminate the current host-side iteration. */ - icmsghdrp->status =HV_S_CONT ; goto response_done; } - icmsghdrp->status =HV_S_OK ; - kvp_msg = (struct hv_kvp_msg *) &recv_buffer[sizeof (struct vmbuspipe_hdr ) +sizeof (struct icmsg_hdr )];
include/linux/hyperv.h +11 -6
@@ -142,6 +142,17 @@ enum hv_kvp_exchg_pool { KVP_POOL_COUNT /* Number of pools, must be last. */ }; +/* +* Some Hyper-V status codes. +*/ + +#define HV_S_OK 0x00000000 +#define HV_E_FAIL 0x80004005 +#define HV_S_CONT 0x80070103 +#define HV_ERROR_NOT_SUPPORTED 0x80070032 +#define HV_ERROR_MACHINE_LOCKED 0x800704F7 +#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F +#define ADDR_FAMILY_NONE 0x00#define ADDR_FAMILY_IPV4 0x01#define ADDR_FAMILY_IPV6 0x02
@@ -1000,12 +1011,6 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);#define ICMSGHDRFLAG_REQUEST 2#define ICMSGHDRFLAG_RESPONSE 4 -#define HV_S_OK 0x00000000 -#define HV_E_FAIL 0x80004005 -#define HV_S_CONT 0x80070103 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 -#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F/* * While we want to handle util services as regular devices,
tools/hv/hv_kvp_daemon.c +27 -26
121 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 3/13 Drivers: hv: kvp: Support the new IP injection messages
In reply to K. Y. SrinivasanImplement support for the new IP injection messages in the driver code.
--- drivers/hv/hv_kvp.c | 70 +++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 63 insertions(+), 7 deletions(-)
drivers/hv/hv_kvp.c +63 -7
@@ -51,7 +51,7 @@ static struct {static void kvp_send_key (struct work_struct *dummy); -static void kvp_respond_to_host (char *key,char *value,int error); +static void kvp_respond_to_host (struct hv_kvp_msg *msg,int error);static void kvp_work_func (struct work_struct *dummy);static void kvp_register (void );
@@ -96,7 +96,7 @@ kvp_work_func(struct work_struct *dummy)* If the timer fires, the user-mode component has not responded; * process the pending transaction. */ -kvp_respond_to_host ("Unknown key" ,"Guest timed out" ,HV_E_FAIL ); +kvp_respond_to_host (NULL ,HV_E_FAIL ); }/*
@@ -107,7 +107,6 @@ static void kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) { struct hv_kvp_msg *message; -struct hv_kvp_msg_enumerate *data;int error; message = (struct hv_kvp_msg *)msg->data;
@@ -126,13 +125,59 @@ kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)* the user level daemon to transmit errors. */ error = *((int *)(&message->kvp_hdr.operation)); - data = &message->body.kvp_enum_data;/* * Complete the transaction by forwarding the key value * to the host. But first, cancel the timeout. */ if (cancel_delayed_work_sync (&kvp_work)) -kvp_respond_to_host (data->data.key, data->data.value, error); +kvp_respond_to_host (message, error); +} + +static void process_ipinfo (struct hv_kvp_msg *in_msg, +struct hv_kvp_msg *out_msg,int op) +{ +switch (op) { +case KVP_OP_SET_IP_INFO : +/* +* Transform all parameters into utf8 encoding. +*/ +utf16s_to_utf8s ((wchar_t *)in_msg->body.kvp_ip_val.ip_addr, +MAX_IP_ADDR_SIZE , +UTF16_LITTLE_ENDIAN , + (__u8 *)out_msg->body.kvp_ip_val.ip_addr, +MAX_IP_ADDR_SIZE ); + +utf16s_to_utf8s ((wchar_t *)in_msg->body.kvp_ip_val.sub_net, +MAX_IP_ADDR_SIZE , +UTF16_LITTLE_ENDIAN , + (__u8 *)out_msg->body.kvp_ip_val.sub_net, +MAX_IP_ADDR_SIZE ); + +utf16s_to_utf8s ((wchar_t *)in_msg->body.kvp_ip_val.gate_way, +MAX_GATEWAY_SIZE , +UTF16_LITTLE_ENDIAN , + (__u8 *)out_msg->body.kvp_ip_val.gate_way, +MAX_GATEWAY_SIZE ); + +utf16s_to_utf8s ((wchar_t *)in_msg->body.kvp_ip_val.dns_addr, +MAX_IP_ADDR_SIZE , +UTF16_LITTLE_ENDIAN , + (__u8 *)out_msg->body.kvp_ip_val.dns_addr, +MAX_IP_ADDR_SIZE ); + + out_msg->body.kvp_ip_val.dhcp_enabled = + in_msg->body.kvp_ip_val.dhcp_enabled; + +default : +utf16s_to_utf8s ((wchar_t *)in_msg->body.kvp_ip_val.adapter_id, +MAX_ADAPTER_ID_SIZE , +UTF16_LITTLE_ENDIAN , + (__u8 *)out_msg->body.kvp_ip_val.adapter_id, +MAX_ADAPTER_ID_SIZE ); + + out_msg->body.kvp_ip_val.addr_family = + in_msg->body.kvp_ip_val.addr_family; + } } static void
@@ -170,6 +215,12 @@ kvp_send_key(struct work_struct *dummy)*/ switch (message->kvp_hdr.operation) { +case KVP_OP_SET_IP_INFO : +process_ipinfo (in_msg, message,KVP_OP_SET_IP_INFO ); +break ; +case KVP_OP_GET_IP_INFO : +process_ipinfo (in_msg, message,KVP_OP_GET_IP_INFO ); +break ;case KVP_OP_SET :switch (in_msg->body.kvp_set.data.value_type) {case REG_SZ :
@@ -246,11 +297,12 @@ kvp_send_key(struct work_struct *dummy)*/ static void -kvp_respond_to_host (char *key,char *value,int error) +kvp_respond_to_host (struct hv_kvp_msg *msg_to_host,int error) {struct hv_kvp_msg *kvp_msg;struct hv_kvp_exchg_msg_value *kvp_data;char *key_name; +char *value;struct icmsg_hdr *icmsghdrp;int keylen =0 ;int valuelen =0 ;
@@ -309,6 +361,9 @@ kvp_respond_to_host(char *key, char *value, int error) sizeof(struct icmsg_hdr)];switch (kvp_transaction.kvp_msg->kvp_hdr.operation) { +case KVP_OP_GET_IP_INFO : +process_ipinfo (msg_to_host, kvp_msg,KVP_OP_SET_IP_INFO ); + goto response_done;case KVP_OP_GET : kvp_data = &kvp_msg->body.kvp_get.data; goto copy_value;
@@ -322,7 +377,7 @@ kvp_respond_to_host(char *key, char *value, int error) } kvp_data = &kvp_msg->body.kvp_enum_data.data; - key_name = key; + key_name = msg_to_host->body.kvp_enum_data.data.key;/* * The windows host expects the key/value pair to be encoded
@@ -336,6 +391,7 @@ kvp_respond_to_host(char *key, char *value, int error) kvp_data->key_size =2 *(keylen +1 );/* utf16 encoding */ copy_value: + value = msg_to_host->body.kvp_enum_data.data.value; valuelen =utf8s_to_utf16s (value,strlen (value),UTF16_HOST_ENDIAN , (wchar_t *) kvp_data->value, (HV_KVP_EXCHANGE_MAX_VALUE_SIZE /2 ) -2 );
Signature · 1 line
1.7.4.1
PATCH 4/13 Tools: hv: Prepare to expand kvp_get_ip_address() functionality
In reply to K. Y. Srinivasankvp_get_ip_address() implemented the functionality to retrieve IP address info. Make this function more generic so that we could retrieve additional per-interface information.
--- tools/hv/hv_kvp_daemon.c | 129 ++++++++++++++++++++++++++++++---------------- 1 files changed, 84 insertions(+), 45 deletions(-)
tools/hv/hv_kvp_daemon.c +84 -45
@@ -491,7 +491,8 @@ done: }static int -kvp_get_ip_address (int family,char *buffer,int length) +kvp_get_ip_address (int family,char *if_name,int op, +void *out_buffer,int length) {struct ifaddrs *ifap;struct ifaddrs *curp;
@@ -501,10 +502,19 @@ kvp_get_ip_address(int family, char *buffer, int length)const char *str;char tmp[50 ];int error =0 ; - +char *buffer; +struct hv_kvp_ipaddr_value *ip_buffer; + +if (op ==KVP_OP_ENUMERATE ) { + buffer = out_buffer; + }else { + ip_buffer = out_buffer; + buffer = (char *)ip_buffer->ip_addr; + ip_buffer->addr_family =0 ; + }/* * On entry into this function, the buffer is capable of holding the -* maximum key value (2048 bytes). +* maximum key value. */ if (getifaddrs (&ifap)) {
@@ -514,58 +524,87 @@ kvp_get_ip_address(int family, char *buffer, int length) curp = ifap;while (curp !=NULL ) { -if ((curp->ifa_addr !=NULL ) && - (curp->ifa_addr->sa_family == family)) { -if (family ==AF_INET ) { -struct sockaddr_in *addr = - (struct sockaddr_in *) curp->ifa_addr; - - str =inet_ntop (family, &addr->sin_addr, - tmp,50 ); -if (str ==NULL ) { -strcpy (buffer,"inet_ntop failed\n" ); - error =1 ; - goto getaddr_done; - } -if (offset ==0 ) -strcpy (buffer, tmp); -else -strcat (buffer, tmp); -strcat (buffer,";" ); +if (curp->ifa_addr ==NULL ) { + curp = curp->ifa_next; +continue ; + } - offset +=strlen (str) +1 ; -if ((length - offset) < (ipv4_len +1 )) - goto getaddr_done; +if ((if_name !=NULL ) && + (strncmp (curp->ifa_name, if_name,strlen (if_name)))) { +/* +* We want info about a specific interface; +* just continue. +*/ + curp = curp->ifa_next; +continue ; + } - }else { +/* +* We only support two address families: AF_INET and AF_INET6. +* If a family value of 0 is specified, we collect both +* supported address families; if not we gather info on +* the specified address family. +*/ +if ((family !=0 ) && (curp->ifa_addr->sa_family != family)) { + curp = curp->ifa_next; +continue ; + } +if ((curp->ifa_addr->sa_family !=AF_INET ) && + (curp->ifa_addr->sa_family !=AF_INET6 )) { + curp = curp->ifa_next; +continue ; + } + +if ((curp->ifa_addr->sa_family ==AF_INET ) && + ((family ==AF_INET ) || (family ==0 ))) { +struct sockaddr_in *addr = + (struct sockaddr_in *) curp->ifa_addr; + + str =inet_ntop (AF_INET , &addr->sin_addr, tmp,50 ); +if (str ==NULL ) { +strcpy (buffer,"inet_ntop failed\n" ); + error =1 ; + goto getaddr_done; + } +if (offset ==0 ) +strcpy (buffer, tmp); +else +strcat (buffer, tmp); +strcat (buffer,";" ); + + offset +=strlen (str) +1 ; +if ((length - offset) < (ipv4_len +1 )) + goto getaddr_done; + + }else if ((family ==AF_INET6 ) || (family ==0 )) {/* * We only support AF_INET and AF_INET6 * and the list of addresses is separated by a ";". */ -struct sockaddr_in6 *addr = +struct sockaddr_in6 *addr = (struct sockaddr_in6 *) curp->ifa_addr; - str =inet_ntop (family, + str =inet_ntop (AF_INET6 , &addr->sin6_addr.s6_addr, tmp,50 ); -if (str ==NULL ) { -strcpy (buffer,"inet_ntop failed\n" ); - error =1 ; - goto getaddr_done; - } -if (offset ==0 ) -strcpy (buffer, tmp); -else -strcat (buffer, tmp); -strcat (buffer,";" ); - offset +=strlen (str) +1 ; -if ((length - offset) < (ipv6_len +1 )) - goto getaddr_done; - +if (str ==NULL ) { +strcpy (buffer,"inet_ntop failed\n" ); + error =1 ; + goto getaddr_done; } +if (offset ==0 ) +strcpy (buffer, tmp); +else +strcat (buffer, tmp); +strcat (buffer,";" ); + offset +=strlen (str) +1 ; +if ((length - offset) < (ipv6_len +1 )) + goto getaddr_done; } + + curp = curp->ifa_next; }
@@ -812,13 +851,13 @@ int main(void)strcpy (key_value, lic_version);break ;case NetworkAddressIPv4: -kvp_get_ip_address (AF_INET , key_value, -HV_KVP_EXCHANGE_MAX_VALUE_SIZE ); +kvp_get_ip_address (AF_INET ,NULL ,KVP_OP_ENUMERATE , + key_value,HV_KVP_EXCHANGE_MAX_VALUE_SIZE );strcpy (key_name,"NetworkAddressIPv4" );break ;case NetworkAddressIPv6: -kvp_get_ip_address (AF_INET6 , key_value, -HV_KVP_EXCHANGE_MAX_VALUE_SIZE ); +kvp_get_ip_address (AF_INET6 ,NULL ,KVP_OP_ENUMERATE , + key_value,HV_KVP_EXCHANGE_MAX_VALUE_SIZE );strcpy (key_name,"NetworkAddressIPv6" );break ;case OSBuildNumber:
Signature · 1 line
1.7.4.1
PATCH 5/13 Tools: hv: Further refactor kvp_get_ip_address()
In reply to K. Y. SrinivasanIn preparation for making kvp_get_ip_address() more generic, factor out the code for handling IP addresses.
--- tools/hv/hv_kvp_daemon.c | 94 ++++++++++++++++++++------------------------- 1 files changed, 42 insertions(+), 52 deletions(-)
tools/hv/hv_kvp_daemon.c +42 -52
@@ -490,17 +490,50 @@ done:return ; } +static int kvp_process_ip_address (void *addrp, +int family,char *buffer, +int length,int *offset) +{ +struct sockaddr_in *addr; +struct sockaddr_in6 *addr6; +int addr_length; +char tmp[50 ]; +const char *str; + +if (family ==AF_INET ) { + addr = (struct sockaddr_in *)addrp; + str =inet_ntop (family, &addr->sin_addr, tmp,50 ); + addr_length =INET_ADDRSTRLEN ; + }else { + addr6 = (struct sockaddr_in6 *)addrp; + str =inet_ntop (family, &addr6->sin6_addr.s6_addr, tmp,50 ); + addr_length =INET6_ADDRSTRLEN ; + } + +if ((length - *offset) < addr_length +1 ) +return 1 ; +if (str ==NULL ) { +strcpy (buffer,"inet_ntop failed\n" ); +return 1 ; + } +if (*offset ==0 ) +strcpy (buffer, tmp); +else +strcat (buffer, tmp); +strcat (buffer,";" ); + + *offset +=strlen (str) +1 ; +return 0 ; +} +static int kvp_get_ip_address (int family,char *if_name,int op,void *out_buffer,int length) {struct ifaddrs *ifap;struct ifaddrs *curp; -int ipv4_len =strlen ("255.255.255.255" ) +1 ; -int ipv6_len =strlen ("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" )+1 ;int offset =0 ;const char *str; -char tmp[50 ];int error =0 ;char *buffer;struct hv_kvp_ipaddr_value *ip_buffer;
@@ -555,55 +588,12 @@ kvp_get_ip_address(int family, char *if_name, int op,continue ; } -if ((curp->ifa_addr->sa_family ==AF_INET ) && - ((family ==AF_INET ) || (family ==0 ))) { -struct sockaddr_in *addr = - (struct sockaddr_in *) curp->ifa_addr; - - str =inet_ntop (AF_INET , &addr->sin_addr, tmp,50 ); -if (str ==NULL ) { -strcpy (buffer,"inet_ntop failed\n" ); - error =1 ; - goto getaddr_done; - } -if (offset ==0 ) -strcpy (buffer, tmp); -else -strcat (buffer, tmp); -strcat (buffer,";" ); - - offset +=strlen (str) +1 ; -if ((length - offset) < (ipv4_len +1 )) - goto getaddr_done; - - }else if ((family ==AF_INET6 ) || (family ==0 )) { - -/* -* We only support AF_INET and AF_INET6 -* and the list of addresses is separated by a ";". -*/ -struct sockaddr_in6 *addr = - (struct sockaddr_in6 *) curp->ifa_addr; - - str =inet_ntop (AF_INET6 , - &addr->sin6_addr.s6_addr, - tmp,50 ); -if (str ==NULL ) { -strcpy (buffer,"inet_ntop failed\n" ); - error =1 ; - goto getaddr_done; - } -if (offset ==0 ) -strcpy (buffer, tmp); -else -strcat (buffer, tmp); -strcat (buffer,";" ); - offset +=strlen (str) +1 ; -if ((length - offset) < (ipv6_len +1 )) - goto getaddr_done; - - } - + error =kvp_process_ip_address (curp->ifa_addr, + curp->ifa_addr->sa_family, + buffer, + length, &offset); +if (error) + goto getaddr_done; curp = curp->ifa_next; }
Signature · 1 line
1.7.4.1
PATCH 6/13 Tools: hv: Gather address family information
In reply to K. Y. SrinivasanNow, gather address family information for the specified interface.
--- tools/hv/hv_kvp_daemon.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
tools/hv/hv_kvp_daemon.c +11 -0
@@ -588,6 +588,17 @@ kvp_get_ip_address(int family, char *if_name, int op,continue ; } +if (op ==KVP_OP_GET_IP_INFO ) { +/* +* Gather info other than the IP address. +* IP address info will be gathered later. +*/ +if (curp->ifa_addr->sa_family ==AF_INET ) + ip_buffer->addr_family |=ADDR_FAMILY_IPV4 ; +else + ip_buffer->addr_family |=ADDR_FAMILY_IPV6 ; + } + error = kvp_process_ip_address(curp->ifa_addr, curp->ifa_addr->sa_family, buffer,
Signature · 1 line
1.7.4.1
PATCH 7/13 Tools: hv: Gather subnet information
In reply to K. Y. SrinivasanNow gather sub-net information for the specified interface.
--- tools/hv/hv_kvp_daemon.c | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 deletions(-)
tools/hv/hv_kvp_daemon.c +29 -2
@@ -533,6 +533,7 @@ kvp_get_ip_address(int family, char *if_name, int op,struct ifaddrs *ifap;struct ifaddrs *curp;int offset =0 ; +int sn_offset =0 ;const char *str;int error =0 ;char *buffer;
@@ -593,12 +594,38 @@ kvp_get_ip_address(int family, char *if_name, int op,* Gather info other than the IP address. * IP address info will be gathered later. */ -if (curp->ifa_addr->sa_family ==AF_INET ) +if (curp->ifa_addr->sa_family ==AF_INET ) { ip_buffer->addr_family |=ADDR_FAMILY_IPV4 ; -else +/* +* Get subnet info. +*/ + error =kvp_process_ip_address ( + curp->ifa_netmask, +AF_INET , + (char *) + ip_buffer->sub_net, + length, + &sn_offset); +if (error) + goto gather_ipaddr; + }else { ip_buffer->addr_family |=ADDR_FAMILY_IPV6 ; +/* +* Get subnet info. +*/ + error =kvp_process_ip_address ( + curp->ifa_netmask, +AF_INET6 , + (char *) + ip_buffer->sub_net, + length, + &sn_offset); +if (error) + goto gather_ipaddr; + } } +gather_ipaddr: error = kvp_process_ip_address(curp->ifa_addr, curp->ifa_addr->sa_family, buffer,
Signature · 1 line
1.7.4.1
PATCH 8/13 Tools: hv: Represent the ipv6 mask using CIDR notation
In reply to K. Y. SrinivasanTransfor ipv6 subnet information to CIDR notation.
--- tools/hv/hv_kvp_daemon.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-)
tools/hv/hv_kvp_daemon.c +35 -9
@@ -490,6 +490,15 @@ done:return ; } +static unsigned int hweight32 (unsigned int *w) +{ +unsigned int res = *w - ((*w >>1 ) &0x55555555 ); + res = (res &0x33333333 ) + ((res >>2 ) &0x33333333 ); + res = (res + (res >>4 )) &0x0F0F0F0F ; + res = res + (res >>8 ); +return (res + (res >>16 )) &0x000000FF ; +} +static int kvp_process_ip_address (void *addrp,int family,char *buffer,int length,int *offset)
@@ -538,6 +547,12 @@ kvp_get_ip_address(int family, char *if_name, int op,int error =0 ;char *buffer;struct hv_kvp_ipaddr_value *ip_buffer; +char cidr_mask[5 ];/* /xyz */ +int weight; +int i; +int *w; +char *sn_str; +struct sockaddr_in6 *addr6;if (op ==KVP_OP_ENUMERATE ) { buffer = out_buffer;
@@ -611,17 +626,28 @@ kvp_get_ip_address(int family, char *if_name, int op, }else { ip_buffer->addr_family |=ADDR_FAMILY_IPV6 ;/* -* Get subnet info. +* Get subnet info in CIDR format. */ - error =kvp_process_ip_address ( - curp->ifa_netmask, -AF_INET6 , - (char *) - ip_buffer->sub_net, - length, - &sn_offset); -if (error) + weight =0 ; + sn_str = (char *)ip_buffer->sub_net; + addr6 = (struct sockaddr_in6 *) + curp->ifa_netmask; + w = addr6->sin6_addr.s6_addr32; + +for (i =0 ; i <4 ; i++) + weight +=hweight32 (&w[i]); + +sprintf (cidr_mask,"/%d" , weight); +if ((length - sn_offset) < + (strlen (cidr_mask) +1 )) goto gather_ipaddr; + +if (sn_offset ==0 ) +strcpy (sn_str, cidr_mask); +else +strcat (sn_str, cidr_mask); +strcat ((char *)ip_buffer->sub_net,";" ); + sn_offset +=strlen (sn_str) +1 ; } }
Signature · 1 line
1.7.4.1
PATCH 9/13 Tools: hv: Gather DNS information
In reply to K. Y. SrinivasanNow gather DNS information.
--- tools/hv/hv_kvp_daemon.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)
tools/hv/hv_kvp_daemon.c +50 -0
@@ -490,6 +490,50 @@ done:return ; } +static void kvp_get_ipconfig_info (char *if_name, +struct hv_kvp_ipaddr_value *buffer) +{ +char cmd[512 ]; +char *dns_config ="/var/opt/hyperv/.kvp_dns_cfg" ; +FILE *file; +char buf[256 ]; +char *dns_buf; +char *p; +char *x; + +memset (cmd,0 ,512 ); +strcat (cmd,"cat /etc/resolv.conf 2>/tmp/null | " ); +strcat (cmd," awk '/nameserver/ {print $2 }' > " ); +strcat (cmd,"/var/opt/hyperv/.kvp_dns_cfg" ); + +/* +* Execute the command to gather dns info. +*/ +system (cmd); + file =fopen (dns_config,"r" ); +if (file ==NULL ) +return ; + + dns_buf = (char *)(buffer->dns_addr); +/* +* The buffer is an array of __u16 elements. +*/ +memset (dns_buf,0 , (MAX_IP_ADDR_SIZE *2 )); +while ((p =fgets (buf,sizeof (buf), file)) !=NULL ) { +if (((MAX_IP_ADDR_SIZE *2 ) -strlen (dns_buf)) < + (INET6_ADDRSTRLEN +1 )) +break ; + + x =strchr (p,'\n' ); + *x ='\0' ; +strcat (dns_buf, p); +strcat (dns_buf,";" ); + } +fclose (file); + +} + +static unsigned int hweight32 (unsigned int *w) {unsigned int res = *w - ((*w >>1 ) &0x55555555 );
@@ -649,6 +693,12 @@ kvp_get_ip_address(int family, char *if_name, int op,strcat ((char *)ip_buffer->sub_net,";" ); sn_offset +=strlen (sn_str) +1 ; } + +/* +* Collect other ip related configuration info. +*/ + +kvp_get_ipconfig_info (if_name, ip_buffer); } gather_ipaddr:
Signature · 1 line
1.7.4.1
PATCH 10/13 Tools: hv: Gather ipv[4,6] gateway information
In reply to K. Y. SrinivasanCollect ipv4 and ipv6 gateway information.
--- tools/hv/hv_kvp_daemon.c | 80 ++++++++++++++++++++++++++++++++++------------ 1 files changed, 59 insertions(+), 21 deletions(-)
tools/hv/hv_kvp_daemon.c +59 -21
@@ -490,16 +490,40 @@ done:return ; } +static void kvp_process_ipconfig_file (char *config_file, +char *config_buf,int len, +int element_size,int offset) +{ +char buf[256 ]; +char *p; +char *x; +FILE *file; + + file =fopen (config_file,"r" ); +if (file ==NULL ) +return ; + +if (offset ==0 ) +memset (config_buf,0 , len); +while ((p =fgets (buf,sizeof (buf), file)) !=NULL ) { +if ((len -strlen (config_buf)) < (element_size +1 )) +break ; + + x =strchr (p,'\n' ); + *x ='\0' ; +strcat (config_buf, p); +strcat (config_buf,";" ); + } +fclose (file); + +} +static void kvp_get_ipconfig_info (char *if_name,struct hv_kvp_ipaddr_value *buffer) {char cmd[512 ];char *dns_config ="/var/opt/hyperv/.kvp_dns_cfg" ; -FILE *file; -char buf[256 ]; -char *dns_buf; -char *p; -char *x; +char *gw_config ="/var/opt/hyperv/.kvp_gw_cfg" ;memset (cmd,0 ,512 );strcat (cmd,"cat /etc/resolv.conf 2>/tmp/null | " );
@@ -508,29 +532,43 @@ static void kvp_get_ipconfig_info(char *if_name,/* * Execute the command to gather dns info. +* Note that all buffers are arrays of __u16. */ system (cmd); - file =fopen (dns_config,"r" ); -if (file ==NULL ) -return ; +kvp_process_ipconfig_file (dns_config, (char *)buffer->dns_addr, + (MAX_IP_ADDR_SIZE *2 ),INET6_ADDRSTRLEN ,0 ); - dns_buf = (char *)(buffer->dns_addr);/* -* The buffer is an array of __u16 elements. +* Get the address of default gateway (ipv4). */ -memset (dns_buf,0 , (MAX_IP_ADDR_SIZE *2 )); -while ((p =fgets (buf,sizeof (buf), file)) !=NULL ) { -if (((MAX_IP_ADDR_SIZE *2 ) -strlen (dns_buf)) < - (INET6_ADDRSTRLEN +1 )) -break ; +memset (cmd,0 ,512 ); +strcat (cmd,"/sbin/ip -f inet route | grep -w " ); +strcat (cmd, if_name); +strcat (cmd," | awk '/default/ {print $3 }' > " ); +strcat (cmd,"/var/opt/hyperv/.kvp_gw_cfg" ); - x =strchr (p,'\n' ); - *x ='\0' ; -strcat (dns_buf, p); -strcat (dns_buf,";" ); - } -fclose (file); +/* +* Execute the command to gather gateway info. +*/ +system (cmd); +kvp_process_ipconfig_file (gw_config, (char *)buffer->gate_way, + (MAX_GATEWAY_SIZE *2 ),INET_ADDRSTRLEN ,0 ); +/* +* Get the address of default gateway (ipv6). +*/ +memset (cmd,0 ,512 ); +strcat (cmd,"/sbin/ip -f inet6 route | grep -w " ); +strcat (cmd, if_name); +strcat (cmd," | awk '/default/ {print $3 }' > " ); +strcat (cmd,"/var/opt/hyperv/.kvp_gw_cfg" ); +/* +* Execute the command to gather gateway info (ipv6). +*/ +system (cmd); +kvp_process_ipconfig_file (gw_config, (char *)buffer->gate_way, + (MAX_GATEWAY_SIZE *2 ),INET6_ADDRSTRLEN , +strlen (gw_config)); }
Signature · 1 line
1.7.4.1
PATCH 11/13 Tools: hv: Gather dhcp information
In reply to K. Y. SrinivasanCollect information on dhcp setting for the specified interface.
--- tools/hv/hv_kvp_daemon.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
tools/hv/hv_kvp_daemon.c +33 -0
@@ -524,6 +524,10 @@ static void kvp_get_ipconfig_info(char *if_name,char cmd[512 ];char *dns_config ="/var/opt/hyperv/.kvp_dns_cfg" ;char *gw_config ="/var/opt/hyperv/.kvp_gw_cfg" ; +char if_cfg_file[256 ]; +FILE *file; +char *p; +char buf[256 ];memset (cmd,0 ,512 );strcat (cmd,"cat /etc/resolv.conf 2>/tmp/null | " );
@@ -569,6 +573,35 @@ static void kvp_get_ipconfig_info(char *if_name,kvp_process_ipconfig_file (gw_config, (char *)buffer->gate_way, (MAX_GATEWAY_SIZE *2 ),INET6_ADDRSTRLEN ,strlen (gw_config)); + +/* +* Get the boot protocol for the interface. +* We will get the info from: +* /etc/sysconfig/network-scripts/ifcfg-ethx +* If need to parse other files to get +* this info, we need to add code to parse +* other files. +*/ +memset (if_cfg_file,0 ,sizeof (if_cfg_file)); +strcat (if_cfg_file,"/etc/sysconfig/network-scripts/ifcfg-" ); +strcat (if_cfg_file, if_name); + + file =fopen (if_cfg_file,"r" ); +if (file ==NULL ) +/* +* Add code to parse other files. +*/ +return ; + +while ((p =fgets (buf,sizeof (buf), file)) !=NULL ) { +if (strncmp (p,"BOOTPROTO" ,9 )) +continue ; +if (strncmp (p,"BOOTPROTO=none" ,14 )) + buffer->dhcp_enabled =0 ; +else + buffer->dhcp_enabled =1 ; + } + }
Signature · 1 line
1.7.4.1
PATCH 12/13 Tools: hv: Implement the KVP verb - KVP_OP_GET_IP_INFO
In reply to K. Y. SrinivasanNow implement the KVP verb - KVP_OP_GET_IP_INFO. This operation retrieves IP information for the specified interface.
--- tools/hv/hv_kvp_daemon.c | 95 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 92 insertions(+), 3 deletions(-)
tools/hv/hv_kvp_daemon.c +92 -3
@@ -41,6 +41,7 @@#include <syslog.h> #include <sys/stat.h> #include <fcntl.h> +#include <dirent.h> /* * KVP protocol: The user mode component first registers with the
@@ -490,6 +491,64 @@ done:return ; } +/* +* Retrieve an interface name corresponding to the specified guid. +* If there is a match, the function returns a pointer +* to the interface name and if not, a NULL is returned. +* If a match is found, the caller is responsible for +* freeing the memory. +*/ + +static char *kvp_get_if_name (char *guid,int guid_len) +{ +DIR *dir; +struct dirent *entry; +FILE *file; +char *p, *q; +char *if_name =NULL ; +char buf[256 ]; +char *kvp_net_dir ="/sys/class/net/" ; +char dev_id[100 ]; + + dir =opendir (kvp_net_dir); +if (dir ==NULL ) +return NULL ; + +memset (dev_id,0 ,sizeof (dev_id)); +strcat (dev_id, kvp_net_dir); + q = dev_id +strlen (kvp_net_dir); + +while ((entry =readdir (dir)) !=NULL ) { +/* +* Set the state for the next pass. +*/ + *q ='\0' ; +strcat (dev_id, entry->d_name); +strcat (dev_id,"/device/device_id" ); + + file =fopen (dev_id,"r" ); +if (file ==NULL ) +continue ; + + p =fgets (buf,sizeof (buf), file); +if (p) { +if (!strncmp (p, guid, guid_len)) { +/* +* Found the guid match; return the interface +* name. The caller will free the memory. +*/ + if_name =strdup (entry->d_name); +break ; + } + } +fclose (file); + } + +closedir (dir); +return if_name; +} + +static void kvp_process_ipconfig_file (char *config_file,char *config_buf,int len,int element_size,int offset)
@@ -651,7 +710,7 @@ static int kvp_process_ip_address(void *addrp, }static int -kvp_get_ip_address (int family,char *if_name,int op, +kvp_get_ip_info (int family,char *if_name,int op,void *out_buffer,int length) {struct ifaddrs *ifap;
@@ -858,6 +917,10 @@ int main(void)char *key_name;int op;int pool; +char *if_name; +struct hv_kvp_ipaddr_value *kvp_ip_val; + +daemon (1 ,0 );openlog ("KVP" ,0 ,LOG_USER );
@@ -959,6 +1022,32 @@ int main(void) }continue ; +case KVP_OP_GET_IP_INFO : + kvp_ip_val = &hv_msg->body.kvp_ip_val; + if_name =kvp_get_if_name ( + (char *)kvp_ip_val->adapter_id, +MAX_ADAPTER_ID_SIZE ); +if (if_name ==NULL ) { +/* +* We could not map the guid to an +* interface name; return error. +*/ + *((int *)(&hv_msg->kvp_hdr.operation)) = +HV_ERROR_DEVICE_NOT_CONNECTED ; +break ; + } + error =kvp_get_ip_info ( +0 , if_name,KVP_OP_GET_IP_INFO , + kvp_ip_val, + (MAX_IP_ADDR_SIZE *2 )); + +if (error) + *((int *)(&hv_msg->kvp_hdr.operation)) = +HV_ERROR_DEVICE_NOT_CONNECTED ; + +free (if_name); +break ; +case KVP_OP_SET : if (kvp_key_add_or_modify(hv_msg->kvp_hdr.pool, hv_msg->body.kvp_set.data.key,
@@ -1026,12 +1115,12 @@ int main(void)strcpy (key_value, lic_version);break ;case NetworkAddressIPv4: -kvp_get_ip_address (AF_INET ,NULL ,KVP_OP_ENUMERATE , +kvp_get_ip_info (AF_INET ,NULL ,KVP_OP_ENUMERATE , key_value,HV_KVP_EXCHANGE_MAX_VALUE_SIZE );strcpy (key_name,"NetworkAddressIPv4" );break ;case NetworkAddressIPv6: -kvp_get_ip_address (AF_INET6 ,NULL ,KVP_OP_ENUMERATE , +kvp_get_ip_info (AF_INET6 ,NULL ,KVP_OP_ENUMERATE , key_value,HV_KVP_EXCHANGE_MAX_VALUE_SIZE );strcpy (key_name,"NetworkAddressIPv6" );break ;
Signature · 1 line
1.7.4.1
PATCH 13/13 Tools: hv: Implement the KVP verb - KVP_OP_SET_IP_INFO
In reply to K. Y. SrinivasanImplement the KVP_OP_SET_IP_INFO verb. This operation sets the IP information on the specified interface.
--- tools/hv/hv_kvp_daemon.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 198 insertions(+), 0 deletions(-)
tools/hv/hv_kvp_daemon.c +198 -0
@@ -847,6 +847,183 @@ getaddr_done:return error; } +int parse_ip_val_buffer (char *in_buf,int *offset,char *out_buf,int out_len) +{ +int end; +char *x; +char *start; + +/* +* in_buf has sequence of characters that are seperated by +* the character ';'. The last sequence is terminated by ';'. +*/ + start = in_buf + *offset; + + x =strchr (start,';' ); +if (x) { + *x =0 ; +if ((x - start) <= out_len) { +strcpy (out_buf, start); +strcat (out_buf,"\n" ); + *offset = (x - start) +1 ; +return 1 ; + } + } +return 0 ; +} + +static int kvp_set_ip_info (char *if_name,struct hv_kvp_ipaddr_value *new_val) +{ +int error =0 ; +char if_path[256 ]; +char if_tmp_path[256 ]; +FILE *file; +char addr[INET6_ADDRSTRLEN ]; +int i; +char cmd[256 ]; +char str[256 ]; +int offset; + +/* +* Set the specified info in the appropriate config file +* for the specified interface and flush the settings. +* Currently we support distributions that maintain +* network configuration information in file: +* /etc/sysconfig/network-scripts/icfg-ifname +*/ +memset (if_path,0 ,sizeof (if_path)); +strcat (if_path,"/etc/sysconfig/network-scripts/ifcfg-" ); +strcat (if_path, if_name); + +memset (if_tmp_path,0 ,sizeof (if_tmp_path)); +strcat (if_tmp_path,"/var/opt/hyperv/.kvp_ifcfg-" ); +strcat (if_tmp_path, if_name); + + file =fopen (if_path,"r" ); +if (file ==NULL ) { +/* +* This system maintains the interface configuration +* information in a different location. Need to add +* code to deal with that. For now fail the operation. +*/ +return 1 ; + } + +fclose (file); +/* +* The host gives us complete configuration information for the +* interface; just overwrite the current info. +* To deal with intermediate failues, first write a temp file. +*/ + + file =fopen (if_tmp_path,"w" ); + +if (file ==NULL ) +return 1 ; + +if (new_val->dhcp_enabled) { + error =fputs ("BOOTPROTO=dhcp\n" , file); +if (error ==EOF ) + goto setval_error; + +/* +* We are done!. +*/ + goto setval_done; + } + +/* +* Write the configuration for ipaddress, netmask, gateway and +* name servers. +*/ + i =0 ; + offset =0 ; +memset (addr,0 ,sizeof (addr)); +memset (str,0 ,sizeof (str)); + +while (parse_ip_val_buffer ((char *)new_val->ip_addr, &offset, addr, + (MAX_IP_ADDR_SIZE *2 ))) { +sprintf (str,"IPADDR_%d=" , i++); +strcat (str, addr); + error =fputs (str, file); +if (error ==EOF ) + goto setval_error; + } + + i =0 ; + offset =0 ; +memset (addr,0 ,sizeof (addr)); +memset (str,0 ,sizeof (str)); + +while (parse_ip_val_buffer ((char *)new_val->sub_net, &offset, addr, + (MAX_IP_ADDR_SIZE *2 ))) { +sprintf (str,"NETMAK_%d=" , i++); +strcat (str, addr); + error =fputs (str, file); +if (error ==EOF ) + goto setval_error; + } + + i =0 ; + offset =0 ; +memset (addr,0 ,sizeof (addr)); +memset (str,0 ,sizeof (str)); + +while (parse_ip_val_buffer ((char *)new_val->gate_way, &offset, addr, + (MAX_IP_ADDR_SIZE *2 ))) { +sprintf (str,"GATEWAY_%d=" , i++); +strcat (str, addr); + error =fputs (str, file); +if (error ==EOF ) + goto setval_error; + } + + i =0 ; + offset =0 ; +memset (addr,0 ,sizeof (addr)); +memset (str,0 ,sizeof (str)); + +while (parse_ip_val_buffer ((char *)new_val->dns_addr, &offset, addr, + (MAX_IP_ADDR_SIZE *2 ))) { +sprintf (str,"DNS%d=" , i++); +strcat (str, addr); + error =fputs (str, file); +if (error ==EOF ) + goto setval_error; + } + + error =fputs ("ONBOOT=yes\n" , file); +if (error ==EOF ) + goto setval_error; + + error =fputs ("PEERDNS=yes\n" , file); +if (error ==EOF ) + goto setval_error; + +setval_done: +/* +* Now move the config file to the final location. +*/ +fclose (file); +memset (cmd,0 ,sizeof (cmd)); +strcat (cmd,"mv " ); +strcat (cmd, if_tmp_path); +strcat (cmd," " ); +strcat (cmd, if_path); +system (cmd); + +/* +* Now restart the network to flush the parameters. +*/ +memset (cmd,0 ,sizeof (cmd)); +strcat (cmd,"service network restart" ); +system (cmd); +return 0 ; + +setval_error: +fclose (file); +return error; +}static int kvp_get_domain_name (char *buffer,int length)
@@ -1048,6 +1225,27 @@ int main(void)free (if_name);break ; +case KVP_OP_SET_IP_INFO : + kvp_ip_val = &hv_msg->body.kvp_ip_val; + if_name =kvp_get_if_name ( + (char *)kvp_ip_val->adapter_id, +MAX_ADAPTER_ID_SIZE ); +if (if_name ==NULL ) { +/* +* We could not map the guid to an +* interface name; return error. +*/ + *((int *)(&hv_msg->kvp_hdr.operation)) = +HV_ERROR_DEVICE_NOT_CONNECTED ; +break ; + } + error =kvp_set_ip_info (if_name, kvp_ip_val); +if (error) + *((int *)(&hv_msg->kvp_hdr.operation)) = +HV_ERROR_DEVICE_NOT_CONNECTED ; + +free (if_name); +break ;case KVP_OP_SET : if (kvp_key_add_or_modify(hv_msg->kvp_hdr.pool, hv_msg->body.kvp_set.data.key,
Signature · 1 line
1.7.4.1
Quoted 7 lines · K. Y. Srinivasan
This patchset expands the KVP (Key Value Pair) functionality to implement the mechanism to get/set IP addresses in the guest. This functionality is used in Windows Server 2012 to implement VM replication functionality. The way IP configuration information is managed is distro specific. The current implementation supports RedHat way of doing things. We will expand support to other distros incrementally.
I'm missing 09/13, did it get stuck somewhere?
Are you still missing it; do you want me to resend the whole set?
K. Y
Quoted 20 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, June 21, 2012 6:48 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 7 lines · K. Y. Srinivasan
This patchset expands the KVP (Key Value Pair) functionality to implement the mechanism to get/set IP addresses in the guest. This functionality is used in Windows Server 2012 to implement VM replication functionality. The way IP configuration information is managed is distro specific. The current implementation supports RedHat way of doing things. We will expand support to other distros incrementally.
I'm missing 09/13, did it get stuck somewhere?
Quoted 1 line · KY Srinivasan
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
greg k-h
Quoted 10 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 22, 2012 9:26 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvp
Quoted 5 lines
Quoted 1 line · KY Srinivasan
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
Greg, some additional testing with VM replication on Windows Server 2012 has revealed some issues with this patch-set. Please drop the patch set, I will fix the problem and resend it.
Thank you,
K. Y
Quoted 11 lines · KY Srinivasan
Quoted 11 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 22, 2012 9:26 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpOn Fri, Jun 22, 2012 at 01:06:53PM +0000, KY Srinivasan wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
Greg, some additional testing with VM replication on Windows Server 2012 has revealed some issues with this patch-set. Please drop the patch set, I will fix the problem and resend it.
Thanks for letting me know, now dropped.
But, for the next round, I suggest you run this patchset by the netdev developers, as I think you are doing things in an "odd" way for some of the ip determination.
thanks,
greg k-h
Quoted 31 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 26, 2012 5:40 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 11 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 22, 2012 9:26 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpOn Fri, Jun 22, 2012 at 01:06:53PM +0000, KY Srinivasan wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
Greg, some additional testing with VM replication on Windows Server 2012 has revealed some issues with this patch-set. Please drop the patch set, I will fix the problem and resend it.
Quoted 5 lines
Thanks for letting me know, now dropped.
But, for the next round, I suggest you run this patchset by the netdev developers, as I think you are doing things in an "odd" way for some of the ip determination.
Will do. Just curious; can you be more explicit on what part appeared "odd" to you.
Regards,
K. Y
Quoted 31 lines · KY Srinivasan
Quoted 31 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 26, 2012 5:40 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 19 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 22, 2012 9:26 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 5 lines
Quoted 1 line · KY Srinivasan
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
Greg, some additional testing with VM replication on Windows Server 2012 has revealed some issues with this patch-set. Please drop the patch set, I will fix the problem and resend it.
Quoted 8 lines
Quoted 5 lines
Thanks for letting me know, now dropped.
But, for the next round, I suggest you run this patchset by the netdev developers, as I think you are doing things in an "odd" way for some of the ip determination.
Will do. Just curious; can you be more explicit on what part appeared "odd" to you.
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?
greg k-h
Quoted 50 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 26, 2012 6:22 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, June 26, 2012 5:40 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-Quoted 10 lines
Quoted 10 lines
Subject: Re: [PATCH 00/13] drivers: hv: kvp
Quoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 22, 2012 9:26 AM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 19 lines
Quoted 18 lines
Quoted 4 lines
Quoted 4 lines
[email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpOn Fri, Jun 22, 2012 at 01:06:53PM +0000, KY Srinivasan wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Are you still missing it; do you want me to resend the whole set?
Nope, it showed up a few hours later, thanks. You really should get that fixed...
Greg, some additional testing with VM replication on Windows Server 2012 has revealed some issues with this patch-set. Please drop the patch set, I will fix the problem and resend it.
Thanks for letting me know, now dropped.
But, for the next round, I suggest you run this patchset by the netdev developers, as I think you are doing things in an "odd" way for some of the ip determination.
Quoted 5 lines
Quoted 2 lines
Will do. Just curious; can you be more explicit on what part appeared "odd" to you.
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?
The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
Regards,
K. Y
Quoted 4 lines
greg k-h
Quoted 10 lines · KY Srinivasan
Quoted 2 lines
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?
The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
You shouldn't be looking at any files, but rather calling programs to get the information. Think about systems with NetworkManager, and not just the older Red Hat static scripts? What about Gentoo and Ubuntu and Arch and LFS and Slackware and SLES and Fedora? You are quickly going to go crazy if you are going to be mucking around looking in files for things.
What exactly are you trying to do here? That might be the better place to start with instead of the implementation you have created.
thanks,
greg k-h
Quoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
KY,
instead of using system() in kvp_get_ipconfig_info and kvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.
If the work is done in a script it will be much easier for an admin to debug and adjust it.
I think there is no standard way to configure all relevant distros in the same way. Maybe one day NetworkManager can finally handle all possible ways to configure network related things. But until that happens the config files need to be adjusted manually.
Some of the functions have deep indention levels due to 'while() { switch() }' usage. Perhaps such code could be moved into its own function so that lines dont need to be wrapped that much due to the odd 80 column limit.
Olaf
Quoted 25 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, June 28, 2012 10:24 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
Quoted 7 lines
KY,
instead of using
system()inkvp_get_ipconfig_infoandkvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.
On the "Get" side I mostly use standard commands/APIs to get all the information:
1) IP address information and subnet mask: getifaddrs()
2) DNS information: Parsing /etc/resolv.conf
3) /sbin/ip command for all the routing information
4) Parse /etc/sysconfig/network-scripts/ifcfg-ethx for boot protocol
As you can see, all but the boot protocol is gathered using the "standard distro independent mechanisms. I was looking at NetworkManager cli and it looks like I could gather all the information except the boot protocol information. I am not sure how to gather the boot protocol information in a distro independent fashion.
On the SET side, I need to persistently store the settings in an appropriate configuration file and flush these settings down so that the interface is appropriately configured. It is here that I am struggling to find a distro independent way of doing things. It would be great if I can use NetworkManager cli (nmcli) to accomplish this. Any help here would be greatly appreciated.
While I toyed with your proposal, I feel it just pushes the problem out of the daemon code - we would still need to write distro specific scripts. If this approach is something that everybody is comfortable with, I can take a stab at implementing that.
Quoted 11 lines
If the work is done in a script it will be much easier for an admin to debug and adjust it.
I think there is no standard way to configure all relevant distros in the same way. Maybe one day NetworkManager can finally handle all possible ways to configure network related things. But until that happens the config files need to be adjusted manually.
Quoted 4 lines
Some of the functions have deep indention levels due to '
while(){switch()}' usage. Perhaps such code could be moved into its own function so that lines dont need to be wrapped that much due to the odd 80 column limit.
I will take care of this. As suggested by Greg, I am adding netdev developers here to seek their input.
Regards,
K. Y
Quoted 33 lines · KY Srinivasan
Quoted 25 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, June 28, 2012 10:24 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
Quoted 7 lines
KY,
instead of using
system()inkvp_get_ipconfig_infoandkvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.
Quoted 5 lines
On the "Get" side I mostly use standard commands/APIs to get all the information:
1) IP address information and subnet mask:
getifaddrs()
2) DNS information: Parsing/etc/resolv.conf
3)/sbin/ipcommand for all the routing information
If you're interested in the *current* configuration then (1) and (3) are OK but you should really use the rtnetlink API.
However, I suspect that Hyper-V assumes that current and persistent configuration are the same thing, which is obviously not true in general on Linux. But if NetworkManager is running then you can assume they are.
Quoted 11 lines
4) Parse
/etc/sysconfig/network-scripts/ifcfg-ethxfor boot protocolAs you can see, all but the boot protocol is gathered using the "standard distro independent mechanisms. I was looking at NetworkManager cli and it looks like I could gather all the information except the boot protocol information. I am not sure how to gather the boot protocol information in a distro independent fashion.
On the SET side, I need to persistently store the settings in an appropriate configuration file and flush these settings down so that the interface is appropriately configured. It is here that I am struggling to find a distro independent way of doing things. It would be great if I can use NetworkManager cli (nmcli) to accomplish this. Any help here would be greatly appreciated.
[...]
What was wrong with the NetworkManager D-Bus API I pointed you at? I don't see how it makes sense to use nmcli as an API.
Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusQuoted 52 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Monday, July 02, 2012 3:57 PM
To: KY Srinivasan
Cc: Olaf Hering; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 27 lines · KY Srinivasan
Quoted 27 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, June 28, 2012 10:24 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
KY,
Quoted 7 lines
Quoted 5 lines
instead of using
system()inkvp_get_ipconfig_infoandkvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.On the "Get" side I mostly use standard commands/APIs to get all the
information:
Quoted 4 lines
1) IP address information and subnet mask:
getifaddrs()
2) DNS information: Parsing/etc/resolv.conf
3)/sbin/ipcommand for all the routing information
Quoted 7 lines
If you're interested in the *current* configuration then (1) and (3) are OK but you should really use the rtnetlink API.
However, I suspect that Hyper-V assumes that current and persistent configuration are the same thing, which is obviously not true in general on Linux. But if NetworkManager is running then you can assume they are.
I am only interested in the currently active information. Why do you recommend the use of rtnetlink API over the "ip" command. If I am not mistaken, the ip command uses netlink to get the information.
Quoted 2 lines
Quoted 2 lines
4) Parse
/etc/sysconfig/network-scripts/ifcfg-ethxfor boot protocol
This is the only information that requires parsing a distro specific configuration file. Do you have any suggestion on how I may get this information in a distro independent way.
Quoted 11 lines
Quoted 5 lines
As you can see, all but the boot protocol is gathered using the "standard distro independent mechanisms. I was looking at NetworkManager cli and it looks like I could gather all the information except the boot protocol information. I am not sure how to gather the boot protocol information in a distro independent
fashion.
Quoted 2 lines
On the SET side, I need to persistently store the settings in an appropriate
configuration
Quoted 1 line
file and flush these settings down so that the interface is appropriately
configured. It is here
Quoted 8 lines
Quoted 1 line
that I am struggling to find a distro independent way of doing things. It would
be great if I can
Quoted 1 line
use NetworkManager cli (nmcli) to accomplish this. Any help here would be
greatly appreciated.
[...]What was wrong with the NetworkManager D-Bus API I pointed you at? I don't see how it makes sense to use nmcli as an API.
I saw some documentation that claimed that nmcli could be used to accomplish all that can be done with the GUI interface. I am looking for a portable way to accomplish configuring an interface. If nmcli can do that, I would use it. With regards to D-BUS API, I took a cursory look at the APIs. I am still evaluating my options.
Regards,
K. Y
Quoted 54 lines · KY Srinivasan
Quoted 54 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Monday, July 02, 2012 3:57 PM
To: KY Srinivasan
Cc: Olaf Hering; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 27 lines · KY Srinivasan
Quoted 27 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, June 28, 2012 10:24 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
KY,
Quoted 7 lines
Quoted 5 lines
instead of using
system()inkvp_get_ipconfig_infoandkvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.On the "Get" side I mostly use standard commands/APIs to get all the
information:
Quoted 4 lines
1) IP address information and subnet mask:
getifaddrs()
2) DNS information: Parsing/etc/resolv.conf
3)/sbin/ipcommand for all the routing informationIf you're interested in the *current* configuration then (1) and (3) are OK but you should really use the rtnetlink API.
Quoted 8 lines
Quoted 4 lines
However, I suspect that Hyper-V assumes that current and persistent configuration are the same thing, which is obviously not true in general on Linux. But if NetworkManager is running then you can assume they are.
I am only interested in the currently active information. Why do you recommend the use of rtnetlink API over the "ip" command. If I am not mistaken, the ip command uses netlink to get the information.
[...]
'Screen-scraping' the output of administrative tools is not good practice. It may be the best you can do when writing a shell script, but for a C program it's generaly less reliable and often more difficult than using the underlying C API.
Ben.
Signature · 2 lines
Ben Hutchings 73.46% of all statistics are made up.
Quoted 74 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Saturday, July 21, 2012 10:51 PM
To: KY Srinivasan
Cc: Olaf Hering; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 54 lines · KY Srinivasan
Quoted 54 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Monday, July 02, 2012 3:57 PM
To: KY Srinivasan
Cc: Olaf Hering; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 27 lines · KY Srinivasan
Quoted 27 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, June 28, 2012 10:24 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 11 lines · KY Srinivasan
Quoted 3 lines
From: Greg KH [mailto:[email protected]]
The fact that it was Red Hat specific was the main part, this should be done in a standard way, with standard tools, right?The reason I asked this question was to make sure I address these issues in addition to whatever I am debugging now. I use the standard tools and calls to retrieve all the IP configuration. As I look at each distribution the files they keep persistent IP configuration Information is different and that is the reason I chose to start with RedHat. If there is a standard way to store the configuration, I will do that.
KY,
Quoted 7 lines
Quoted 5 lines
instead of using
system()inkvp_get_ipconfig_infoandkvp_set_ip_info, wouldnt it be easier to call an external helper script which does all the distribution specific work? Just define some API to pass values to the script, and something to read values collected by the script back into the daemon.On the "Get" side I mostly use standard commands/APIs to get all the
information:
Quoted 4 lines
1) IP address information and subnet mask:
getifaddrs()
2) DNS information: Parsing/etc/resolv.conf
3)/sbin/ipcommand for all the routing informationIf you're interested in the *current* configuration then (1) and (3) are OK but you should really use the rtnetlink API.
Quoted 8 lines
Quoted 4 lines
However, I suspect that Hyper-V assumes that current and persistent configuration are the same thing, which is obviously not true in general on Linux. But if NetworkManager is running then you can assume they are.
I am only interested in the currently active information. Why do you recommend the use of rtnetlink API over the "ip" command. If I am not mistaken, the ip command uses netlink to get the information.
Quoted 6 lines
[...]
'Screen-scraping' the output of administrative tools is not good practice. It may be the best you can do when writing a shell script, but for a C program it's generaly less reliable and often more difficult than using the underlying C API.
Ben,
Based on the input I have gotten, the consensus appears to be to have external scripts to both GET and SET IP related configuration information. So, the KVP daemon will need to parse information returned from these external distro specific scripts (on the GET side). While I agree with you that it is good to use C APIs, I currently have the implementation using the "ip" command and it appears to be quite simple. Furthermore, given that the information I need to pass back to the host needs to be appropriately formatted (based on host specified format), I suspect using the "ip" command may actually simplify the code.
Regards,
K. Y
Quoted 4 lines · KY Srinivasan
While I toyed with your proposal, I feel it just pushes the problem out of the daemon code - we would still need to write distro specific scripts. If this approach is something that everybody is comfortable with, I can take a stab at implementing that.
Until NetworkManager is feature complete and until every distro is using NetworkManager per default the kvp_daemon needs distro specific code to get and set network related settings.
Doing it with an external script will simplify debugging and changes to the code.
Olaf
Quoted 10 lines · KY Srinivasan
Quoted 7 lines
While I toyed with your proposal, I feel it just pushes the problem out of the daemon code - we would still need to write distro specific
scripts. If this approach is something that everybody is comfortable
with, I can take a stab at implementing that.
Quoted 8 lines
Until NetworkManager is feature complete and until every distro is using
NetworkManager per default thekvp_daemonneeds distro specific code to
get and set network related settings.
Doing it with an external script will simplify debugging and changes to
the code.
Although, Network Manager is a good tool for what it does; it is not appropriate for every distro. It is overkill in embedded systems, and it's GUI dependency makes it unmanageable on servers.
Quoted 29 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, July 03, 2012 11:03 AM
To: Olaf Hering
Cc: Greg KH; [email protected]; [email protected]; linux- [email protected]; [email protected]; KY Srinivasan
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 9 lines · KY Srinivasan
Quoted 7 lines
While I toyed with your proposal, I feel it just pushes the problem out of the daemon code - we would still need to write distro specific
scripts. If this approach is something that everybody is comfortable
with, I can take a stab at implementing that.Quoted 8 lines
Until NetworkManager is feature complete and until every distro is using
NetworkManager per default thekvp_daemonneeds distro specific code to
get and set network related settings.
Doing it with an external script will simplify debugging and changes to
the code.
Quoted 4 lines
Although, Network Manager is a good tool for what it does; it is not appropriate for every distro. It is overkill in embedded systems, and it's GUI dependency makes it unmanageable on servers.
Thanks Stephen. I will retain the code that I currently have for the "GET" side and I will implement a script as Olaf suggested that can be distro specific to implement the SET operation.
Regards,
K. Y
Quoted 17 lines
-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Tuesday, July 03, 2012 9:21 AM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 4 lines · KY Srinivasan
While I toyed with your proposal, I feel it just pushes the problem out of the daemon code - we would still need to write distro specific scripts. If this approach is something that everybody is comfortable with, I can take a stab at implementing that.
Quoted 5 lines
Until NetworkManager is feature complete and until every distro is using NetworkManager per default the
kvp_daemonneeds distro specific code to get and set network related settings.
Doing it with an external script will simplify debugging and changes to the code.
Fair enough. I will keep my current implementation of the GET operation as is since it is distro independent. On the SET side, I will implement a script as you have suggested.
Regards,
K. Y
Quoted 4 lines
Olaf
Quoted 8 lines · K. Y. Srinivasan
This patchset expands the KVP (Key Value Pair) functionality to implement the mechanism to get/set IP addresses in the guest. This functionality is used in Windows Server 2012 to implement VM replication functionality. The way IP configuration information is managed is distro specific. The current implementation supports RedHat way of doing things. We will expand support to other distros incrementally.
So there is going to be a continuous flow of patches to add support for new distros (Arch Linux, Slackware, Linux Mint, SuSE, Debian, etc etc) and if different versions of a distro handles things differently then you are also going to deal with that? Might be fine, but it just sounds a bit scary to me to try to support m different distros, each in n different versions from the kernel... Couldn't this somehow be done once and for all in a distro neutral way?
Just asking :-)
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Quoted 21 lines
-----Original Message-----
From: Jesper Juhl [mailto:[email protected]]
Sent: Thursday, June 21, 2012 7:31 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/13] drivers: hv: kvpQuoted 8 lines · K. Y. Srinivasan
This patchset expands the KVP (Key Value Pair) functionality to implement the mechanism to get/set IP addresses in the guest. This functionality is used in Windows Server 2012 to implement VM replication functionality. The way IP configuration information is managed is distro specific. The current implementation supports RedHat way of doing things. We will expand support to other distros incrementally.
Quoted 8 lines
So there is going to be a continuous flow of patches to add support for new distros (Arch Linux, Slackware, Linux Mint, SuSE, Debian, etc etc) and if different versions of a distro handles things differently then you are also going to deal with that? Might be fine, but it just sounds a bit scary to me to try to support m different distros, each in n different versions from the kernel... Couldn't this somehow be done once and for all in a distro neutral way?
Just asking :-)
Most of the code is not going to be distro specific. Obviously the kernel component Is not distro specific. To the extent that the way the IP configuration state is managed differently across distros, the user level component of the KVP code needs to accommodate that. Even here most of the code is distro independent.
Regards,
K. Y