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

Re: [Xen-users] Programatically checking if we're in a domU or dom0


  • To: xen-users@xxxxxxxxxxxxxxxxxxx
  • From: Lutrin Jean <jeanlutrin@xxxxxxxx>
  • Date: Thu, 5 Oct 2006 02:15:39 +0200 (CEST)
  • Delivery-date: Wed, 04 Oct 2006 17:16:52 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=lDZuFAzAUEd5DX/hTiGyTANNorUk7wPpNyQ/SkntZZDskXoLCp4HSblZ0Tetn8SVt7MPfW/l00VzttmRnktwn74rFIklywTfAuwtOe1atnwILVFXrxyWOlgJZkOhCv9+StRpH07yKQJZ6Yut/GaWkMwWpztugEb5qL4z8RLfHyE= ;
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Thanks for your answers...

But IMHO it's hacky and error-prone to rely
on the name of the host to determine 
if it's a domU or a dom0 (or an unmodified
kernel)  :(

I don't like that much neither changing
the name of the kernel  :-/

I need to be able to determine, as a
normal user (that is: non-root), if I'm
running in a domU or not (I can already
tell if I'm running on a modified kernel
or not by checking /proc/xen).

Currently I'm parsing the process in 
memory and looking for xend.  It works
here, on the various system I tried.

But I don't know if it would be somehow
technically possible to launch a "xend"
in a domU (I don't *want* to do that, I'm
simply concerned that it could happen, by
mistake), hence my original post, asking
if it's possible to start xend in a domU
or not.

At the moment, I do this:

if (/proc/xen/ exists) 
   --> modified kernel
else
   --> non-modified kernel
fi

if (modified kernel)
   if (ps output contains xend) 
        --> dom0
   else
        --> domU
   fi
fi

Is parsing the output of ps, looking
for xend, *once I know I've got a
modified kernel*, an acceptable way
to differentiate, *as a normal user*,
between a dom0 and a domU?

Oh well, anyway I think I'll follow
Andrew Ross's advice of checking for
control_d in /proc/xen/capabilities.
I'll just wrap the call to my shell
script in an SUID executable (seen
that "chmod +s" on a shell script
has no effect) so that a non-root
user can acces that info.

thanks all and tell me if you have
a cleaner way to do it,

  Jean








        

        
                
___________________________________________________________________________ 
Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet 
! 
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos 
expériences. 
http://fr.answers.yahoo.com 


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.