[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 20/20] xenapi: reject unknown flags



On Wed, Jul 06, 2011 at 05:24:03PM -0600, Eric Blake wrote:
> * src/xenapi/xenapi_driver.c (xenapiOpen, xenapiDomainReboot)
> (xenapiDomainGetXMLDesc): Reject unknown flags.
> ---
>  src/xenapi/xenapi_driver.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
> index 1c06f75..16f9f78 100644
> --- a/src/xenapi/xenapi_driver.c
> +++ b/src/xenapi/xenapi_driver.c
> @@ -92,12 +92,14 @@ getCapsObject (void)
>   */
>  static virDrvOpenStatus
>  xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
> -            unsigned int flags ATTRIBUTE_UNUSED)
> +            unsigned int flags)
>  {
>      char *username = NULL;
>      char *password = NULL;
>      struct _xenapiPrivate *privP = NULL;
> 
> +    virCheckFlags(0, VIR_DRV_OPEN_ERROR);
> +
>      if (conn->uri == NULL || conn->uri->scheme == NULL ||
>          STRCASENEQ(conn->uri->scheme, "XenAPI")) {
>          return VIR_DRV_OPEN_DECLINED;
> @@ -802,12 +804,15 @@ xenapiDomainShutdown (virDomainPtr dom)
>   * Returns 0 on success or -1 in case of error
>   */
>  static int
> -xenapiDomainReboot (virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
> +xenapiDomainReboot (virDomainPtr dom, unsigned int flags)
>  {
>      /* vm.clean_reboot */
>      xen_vm vm;
>      struct xen_vm_set *vms;
>      xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
> +
> +    virCheckFlags(0, -1);
> +
>      if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
>          if (vms->size != 1) {
>              xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
> @@ -1295,7 +1300,7 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
>   * Returns XML string of the domain configuration on success or -1 in case of error
>   */
>  static char *
> -xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
> +xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
>  {
>      xen_vm vm=NULL;
>      xen_vm_set *vms;
> @@ -1309,6 +1314,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
>      struct xen_vif_set *vif_set = NULL;
>      char *xml;
> 
> +    virCheckFlags(0, NULL);
> +
>      if (!xen_vm_get_by_name_label(session, &vms, dom->name)) return NULL;
>      if (vms->size != 1) {
>          xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,

ACK

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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]