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

Re: [libvirt] [PATCH 28/40] Simplify the Xen domain autostart driver method



Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
>
> Unconditionally call into the XenD or XM drivers for autostart
> handling, since they are guaranteed to be open
> ---
>  src/xen/xen_driver.c    | 18 ++++--------------
>  src/xen/xend_internal.c | 14 --------------
>  2 files changed, 4 insertions(+), 28 deletions(-)
>
> diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> index ac61677..1941dbe 100644
> --- a/src/xen/xen_driver.c
> +++ b/src/xen/xen_driver.c
> @@ -1465,15 +1465,10 @@ xenUnifiedDomainGetAutostart(virDomainPtr dom, int *autostart)
>      xenUnifiedPrivatePtr priv = dom->conn->privateData;
>  
>      if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> -        if (priv->opened[XEN_UNIFIED_XM_OFFSET])
> -            return xenXMDomainGetAutostart(dom, autostart);
> +        return xenXMDomainGetAutostart(dom, autostart);
>      } else {
> -        if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -            return xenDaemonDomainGetAutostart(dom, autostart);
> +        return xenDaemonDomainGetAutostart(dom, autostart);
>      }
>   

Braces no longer needed with the single statement in the 'if' and 'else'.

> -
> -    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> -    return -1;
>  }
>  
>  static int
> @@ -1482,15 +1477,10 @@ xenUnifiedDomainSetAutostart(virDomainPtr dom, int autostart)
>      xenUnifiedPrivatePtr priv = dom->conn->privateData;
>  
>      if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> -        if (priv->opened[XEN_UNIFIED_XM_OFFSET])
> -            return xenXMDomainSetAutostart(dom, autostart);
> +        return xenXMDomainSetAutostart(dom, autostart);
>      } else {
> -        if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
> -            return xenDaemonDomainSetAutostart(dom, autostart);
> +        return xenDaemonDomainSetAutostart(dom, autostart);
>      }
>   

Same here.

> -
> -    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> -    return -1;
>  }
>  
>  static char *
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index 87b8875..ad69b47 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -2541,13 +2541,6 @@ xenDaemonDomainGetAutostart(virDomainPtr domain, int *autostart)
>  {
>      struct sexpr *root;
>      const char *tmp;
> -    xenUnifiedPrivatePtr priv = domain->conn->privateData;
> -
> -    /* xm_internal.c (the support for defined domains from /etc/xen
> -     * config files used by old Xen) will handle this.
> -     */
> -    if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
> -        return -1;
>  
>      root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
>      if (root == NULL) {
> @@ -2574,13 +2567,6 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, int autostart)
>      virBuffer buffer = VIR_BUFFER_INITIALIZER;
>      char *content = NULL;
>      int ret = -1;
> -    xenUnifiedPrivatePtr priv = domain->conn->privateData;
> -
> -    /* xm_internal.c (the support for defined domains from /etc/xen
> -     * config files used by old Xen) will handle this.
> -     */
> -    if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
> -        return -1;
>  
>      root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
>      if (root == NULL) {
>   

ACK.

Regards,
Jim


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