On Tue, Jul 08, 2014 at 09:50:50AM -0600, Eric Blake wrote:
On 07/08/2014 09:29 AM, Peter Krempa wrote:
> +++ b/src/libvirt.c
> @@ -10178,8 +10178,9 @@ virDomainSetMetadata(virDomainPtr domain,
> virCheckNonNullArgGoto(key, error);
> break;
> default:
> - /* For future expansion */
> - break;
> + virReportInvalidArg(type,
> + _("unsupported metadata type '%d'"),
type);
> + goto error;
> }
...because doing this makes it impossible for an older client to
manually set a newer key of a newer server. That is, we intentionally
don't reject unknown flags in libvirt.c, so that:
func(0x4) -> old libvirt.so that doesn't know flag 4 -> new libvirtd
that does
works, rather than dying client-side. On the same vein,
virTypedParameterValidateSet rejects strings when the server is too old,
but does NOT reject unknown parameter type extensions (which would allow
an extension that does not affect wire protocol to go through an old
client to a new server).
I'd like Dan to chime in on this one.
Yes, this is the same scenario as verifying 'unsigned int flags'. We
explicitly only verify in the driver impl, not libvirt.c, so that
old client library can still talk to new server if desired without
getting a bogus error.
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|