[Libvir] [PATCH]Guard for Dom0 by virsh domain stop commands

Kazuki Mizushima mizushima.kazuk at jp.fujitsu.com
Thu Feb 22 10:08:01 UTC 2007


Hi, Dan

Thank you for your reply, I understand you.
I remake the patch.

Signed-off-by: Kazuki Mizushima <mizushima.kazuk at jp.fujitsu.com>

Thanks
Kazuki Mizushima

Index: xs_internal.c (libvirt-0.2.0)
------------------------------------
--- xs_internal.c       2007-02-22 18:35:19.000000000 +0900
+++ xs_internal.c_guard2        2007-02-22 18:35:51.000000000 +0900
@@ -631,7 +631,7 @@ xenStoreDomainShutdown(virDomainPtr doma
                         __FUNCTION__);
         return(-1);
     }
-    if (domain->id == -1)
+    if (domain->id == -1 || domain->id == 0)
         return(-1);
     /*
      * this is very hackish, the domU kernel probes for a special
@@ -659,7 +659,7 @@ xenStoreDomainReboot(virDomainPtr domain
                         __FUNCTION__);
         return(-1);
     }
-    if (domain->id == -1)
+    if (domain->id == -1 || domain->id == 0)
         return(-1);
     /*
      * this is very hackish, the domU kernel probes for a special

---------------------------------------------------------

----- Original Message ----- 
From: "Daniel Veillard" <veillard at redhat.com>
To: "Kazuki Mizushima" <mizushima.kazuk at jp.fujitsu.com>
Cc: <libvir-list at redhat.com>
Sent: Thursday, February 22, 2007 3:53 PM
Subject: Re: [Libvir] [PATCH]Guard for Dom0 by virsh domain stop commands


On Thu, Feb 22, 2007 at 10:55:45AM +0900, Kazuki Mizushima wrote:
> Hi,
>
> I think Domain0 should NOT stop by virsh domain stop commands.
> (like shutdown, reboot, destroy).
> But virsh shudown and reboot commands are still available for Dom0.
> This patch intends to disable these two commands for Dom0.
>
> Internal processing of these two commands is following
> 1)Send shutdown or reboot to Xend (Guard of xend)
> 2)If 1) is failed, shutdown/reboot is executed by xenstore. (Not Guard)
>
> This patch removes 2) ,that is as same as destroy processing.

[...]

> @@ -54,8 +54,8 @@ static virDriver xenStoreDriver = {
>     xenStoreDomainLookupByName, /* domainLookupByName */
>     NULL, /* domainSuspend */
>     NULL, /* domainResume */
> -    xenStoreDomainShutdown, /* domainShutdown */
> -    xenStoreDomainReboot, /* domainReboot */
> +    NULL, /* domainShutdown */
> +    NULL, /* domainReboot */
>     NULL, /* domainDestroy */

  The problem with that patch it that is also remove the possibility of
falling back to the XenStore methode for other domains than Dommain0 .
So IMHO that's too radical, could you rather make a patch which add the check
in xenStoreDomainShutdown and xenStoreDomainReboot for domain 0 instead ?

  thanks,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/





More information about the libvir-list mailing list