[PATCH]: An implementation of HyperV KVP functionality

Dor Laor dlaor at redhat.com
Sun Nov 14 10:46:15 UTC 2010


On 11/11/2010 10:03 PM, Ky Srinivasan wrote:

> + * An implementation of key value pair (KVP) functionality for Linux.
> + *
> + *
> + * Copyright (C) 2010, Novell, Inc.
> + * Author : K. Y. Srinivasan<ksrinivasan at novell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + * NON INFRINGEMENT.  See the GNU General Public License for more
> + * details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> + *
> + */
> +
> +
> +#include<linux/net.h>
> +#include<linux/nls.h>
> +#include<linux/connector.h>
> +
> +#include "logging.h"
> +#include "osd.h"
> +#include "vmbus.h"
> +#include "vmbus_packet_format.h"
> +#include "vmbus_channel_interface.h"
> +#include "version_info.h"
> +#include "channel.h"
> +#include "vmbus_private.h"
> +#include "vmbus_api.h"
> +#include "utils.h"
> +#include "kvp.h"
> +
> +
> +/*
> + *
> + * The following definitions are shared with the user-mode component; do not
> + * change any of this without making the corresponding changes in
> + * the KVP user-mode component.
> + */
> +
> +#define CN_KVP_VAL             0x1 /* This supports queries from the kernel */
> +#define CN_KVP_USER_VAL       0x2 /* This supports queries from the user */
> +
> +
> +/*
> + * KVP protocol: The user mode component first registers with the

Is there a spec that describes all of the possible messages?
For Linux virtio we use it in parallel to the code to make sure all 
potential guest OS will follow the same standard.

What about live migration semantics like migrate while transaction is 
on? and having the guest aware of the migration so the host data will be 
updated?

..


> main(void)
> {
> 	int fd, len, sock_opt;
> 	int error;
> 	struct cn_msg *message;
> 	struct pollfd pfd;
> 	struct nlmsghdr *incoming_msg;
> 	struct cn_msg	*incoming_cn_msg;
> 	char	*key_value;
> 	kvp_key_name_t key_name;
>
> 	daemon(1, 0);
> 	openlog("KVP", 0, LOG_USER);
> 	syslog(LOG_INFO, "KVP starting; pid is:%d", getpid());
> 	/*
> 	 * Retrieve OS release information.
> 	 */
> 	kvp_get_os_info();
>
> 	fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);

This is nice. One of the first tried for virtio-serial was to use 
netlink. We even wanted unix_domain socket for AF_VIRT that will reach 
the host but davem nacked it.



More information about the devel mailing list