From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHK7b-0000Y6-A9 for qemu-devel@nongnu.org; Fri, 30 Jan 2015 17:33:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHK7Z-00023P-TP for qemu-devel@nongnu.org; Fri, 30 Jan 2015 17:33:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHK7Z-00023H-L8 for qemu-devel@nongnu.org; Fri, 30 Jan 2015 17:33:01 -0500 Message-ID: <54CC069A.2090907@redhat.com> Date: Fri, 30 Jan 2015 15:32:58 -0700 From: Eric Blake MIME-Version: 1.0 References: <1422651986-19312-1-git-send-email-dslutz@verizon.com> <1422651986-19312-5-git-send-email-dslutz@verizon.com> In-Reply-To: <1422651986-19312-5-git-send-email-dslutz@verizon.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="g5Mk2sd46rIddQdBWi29XV73a4TEGh98g" Subject: Re: [Qemu-devel] [PATCH 4/6] vmport_rpc: Add QMP access to vmport_rpc object. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Don Slutz , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Markus Armbruster , Luiz Capitulino , Anthony Liguori , Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Richard Henderson This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --g5Mk2sd46rIddQdBWi29XV73a4TEGh98g Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/30/2015 02:06 PM, Don Slutz wrote: > This adds two new inject commands: >=20 > inject-vmport-reboot > inject-vmport-halt >=20 > And three guest info commands: >=20 > vmport-guestinfo-set > vmport-guestinfo-get > query-vmport-guestinfo >=20 > More details in qmp-commands.hx >=20 > Signed-off-by: Don Slutz > --- > +static int foreach_dynamic_VMPortRpc_device(FindVMPortRpcDeviceFunc *f= unc, > + void *arg) > +{ > + VMPortRpcFind find =3D { > + .func =3D func, > + .arg =3D arg, > + }; > + > + /* Loop through all VMPortRpc devices that were spawened outside s/spawened/spawned/ > #ifdef VMPORT_RPC_DEBUG > /* > * Add helper function for traceing. This routine will convert Pre-existing as of this patch, but while you are here: s/traceing/tracing/ unless it occurred earlier in the series, in which case fix it there. > +static void convert_local_rc(Error **errp, int rc) > +{ > + switch (rc) { > + case 0: > + break; > + case VMPORT_DEVICE_NOT_FOUND: > + error_set(errp, QERR_DEVICE_NOT_FOUND, TYPE_VMPORT_RPC); > + break; > + case SEND_NOT_OPEN: > + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "VMWare rpc not ope= n"); shorter as: error_setg(errp, "VMWare rpc not open"); and similar for all your other uses of ERROR_CLASS_GENERIC_ERROR > +++ b/qapi-schema.json > @@ -1271,6 +1271,101 @@ > { 'command': 'inject-nmi' } > =20 > ## > +# @inject-vmport-reboot: > +# > +# Injects a VMWare Tools reboot to the guest. > +# > +# Returns: If successful, nothing > +# > +# Since: 2.3 > +# > +## > +{ 'command': 'inject-vmport-reboot' } > + > +## > +# @inject-vmport-halt: > +# > +# Injects a VMWare Tools halt to the guest. > +# > +# Returns: If successful, nothing > +# > +# Since: 2.3 > +# > +## > +{ 'command': 'inject-vmport-halt' } Why two commands? Why not just 'inject-vmport-action' with a parameter that says whether the action is 'reboot', 'halt', or something else? > + > +## > +# @vmport-guestinfo-set: > +# > +# Set a VMWare Tools guestinfo key to a value > +# > +# @key: the key to set > +# > +# @value: The data to set the key to > +# > +# @format: #optional value encoding (default 'utf8'). > +# - base64: value must be base64 encoded text. Its binary > +# decoding gets set. > +# Bug: invalid base64 is currently not rejected. We should fix the bug, rather than document it. > +# Whitespace *is* invalid. > +# - utf8: value's UTF-8 encoding is written > +# - value itself is always Unicode regardless of format, like= > +# any other string. This was confusing to read - there are three bullets, so it looks like you meant to document three valid DataFormat enum values; but there are only two. The comment about 'value' being supplied as valid JSON UTF8 and only later decoded according to 'format' might belong better on 'value', if at all. On the other hand, I see you are just blindly copy-and-pasting from 'ringbuf-write'. > +# > +# Returns: Nothing on success > +# > +# Since: 2.3 > +## > +{ 'command': 'vmport-guestinfo-set', > + 'data': {'key': 'str', 'value': 'str', > + '*format': 'DataFormat'} } > + > +## > +# @vmport-guestinfo-get: > +# > +# Get a VMWare Tools guestinfo value for a key > +# > +# @key: the key to get > +# > +# @format: #optional data encoding (default 'utf8'). > +# - base64: the value is returned in base64 encoding. > +# - utf8: the value is interpreted as UTF-8. > +# Bug: can screw up when the buffer contains invalid UTF-8 > +# sequences, NUL characters. > +# - The return value is always Unicode regardless of format, > +# like any other string. Similar comments, but again sourced by copy-and-pasting from an existing interface. > +# > +# Returns: value for the guest info key > +# > +# Since: 2.3 > +## > +{ 'command': 'vmport-guestinfo-get', > + 'data': {'key': 'str', '*format': 'DataFormat'}, > + 'returns': 'str' } > + > +## > +# @VmportGuestInfo: > +# > +# Information about a single VMWare Tools guestinfo > +# > +# @key: The known key > +# > +# Since: 2.3 > +## > +{ 'type': 'VmportGuestInfo', 'data': {'key': 'str'} } > + > +## > +# @query-vmport-guestinfo: > +# > +# Returns information about VMWare Tools guestinfo > +# > +# Returns: a list of @VmportGuestInfo > +# > +# Since: 2.3 > +## > +{ 'command': 'query-vmport-guestinfo', 'returns': ['VmportGuestInfo'] = } > + > +## Interface seems more or less okay, since it copies from existing idioms. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --g5Mk2sd46rIddQdBWi29XV73a4TEGh98g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUzAaaAAoJEKeha0olJ0NqAtgH/jNwVpqBEPWNCMUqjVHyw2JJ aj/AjKbFbDn9aLMLsJ9F5ypuZUm/2BSdiSplHzRu7rNC/TSPP2H8MH3lrSJDQr3w U97tzjEThpfJbLo1IXxW0K0ayToOj7LI2n7A6HXjfIMKcAQF5a1SN1csUobzPZMi +RvT0tKhBTGEa122laTdnFFYMJ3LPYPu2a6chyRycYAShv634CPgvsJ1oY5jIzOj LLuR9r+dHUQAjJ2d4KJY7OfYoFRWS80yX+e4k3VFcI/fVd+wnIDkJ+sG5p7ol8VO PA2uWR7s9Er47W/ZGHVisaJNX6+uZVvtu/y1O7facqNB9+3L8wxUDZI0mpp2nzo= =p/1h -----END PGP SIGNATURE----- --g5Mk2sd46rIddQdBWi29XV73a4TEGh98g--