+++ /dev/null
-Index: new/scripts/qapi.py
-===================================================================
---- new.orig/scripts/qapi.py 2015-07-13 10:00:00.000000000 +0100
-+++ new/scripts/qapi.py 2015-07-13 15:50:00.000000000 +0100
-@@ -37,6 +37,8 @@
-
- # Whitelist of commands allowed to return a non-dictionary
- returns_whitelist = [
-+ 'get_link_status',
-+
- # From QMP:
- 'human-monitor-command',
- 'query-migrate-cache-size',
-Index: new/qapi-schema.json
-===================================================================
---- new.orig/qapi-schema.json 2014-12-10 09:15:50.890262765 +0100
-+++ new/qapi-schema.json 2014-12-11 09:20:31.072561486 +0100
-@@ -1366,6 +1366,21 @@
- ##
- { 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
-
-+##
-+# @get_link_status
-+#
-+# Get the current link state of the nics or nic.
-+#
-+# @name: name of the nic you get the state of
-+#
-+# Return: If link is up 1
-+# If link is down 0
-+# If an error occure an empty string.
-+#
-+# Notes: this is an Proxmox VE extension and not offical part of Qemu.
-+##
-+{ 'command': 'get_link_status', 'data': {'name': 'str'}, 'returns': 'int'}
-+
- ##
- # @balloon:
- #
-Index: new/net/net.c
-===================================================================
---- new.orig/net/net.c 2014-12-10 10:24:39.790496356 +0100
-+++ new/net/net.c 2014-12-11 09:37:55.971321170 +0100
-@@ -1141,6 +1141,33 @@
- }
- }
-
-+int64_t qmp_get_link_status(const char *name, Error **errp)
-+{
-+ NetClientState *ncs[MAX_QUEUE_NUM];
-+ NetClientState *nc;
-+ int queues;
-+ bool ret;
-+
-+ queues = qemu_find_net_clients_except(name, ncs,
-+ NET_CLIENT_OPTIONS_KIND_MAX,
-+ MAX_QUEUE_NUM);
-+
-+ if (queues == 0) {
-+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-+ "Device '%s' not found", name);
-+ return (int64_t) -1;
-+ }
-+
-+ nc = ncs[0];
-+ ret = ncs[0]->link_down;
-+
-+ if (nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
-+ ret = ncs[0]->peer->link_down;
-+ }
-+
-+ return (int64_t) ret ? 0 : 1;
-+}
-+
- void qmp_set_link(const char *name, bool up, Error **errp)
- {
- NetClientState *ncs[MAX_QUEUE_NUM];
-Index: new/qmp-commands.hx
-===================================================================
---- new.orig/qmp-commands.hx 2014-12-10 09:15:50.891262737 +0100
-+++ new/qmp-commands.hx 2014-12-11 08:36:26.583532314 +0100
-@@ -1473,6 +1473,29 @@
- EQMP
-
- {
-+ .name = "get_link_status",
-+ .args_type = "name:s",
-+ .mhandler.cmd_new = qmp_marshal_input_get_link_status,
-+ },
-+
-+SQMP
-+get_link_status
-+--------
-+
-+Get the link status of a network adapter.
-+
-+Arguments:
-+
-+- "name": network device name (json-string)
-+
-+Example:
-+
-+-> { "execute": "get_link_status", "arguments": { "name": "e1000.0" } }
-+<- { "return": {1} }
-+
-+EQMP
-+
-+ {
- .name = "getfd",
- .args_type = "fdname:s",
- .params = "getfd name",