All of lore.kernel.org
 help / color / mirror / Atom feed
* Easy user-space usage of xenstore
@ 2006-06-29 20:31 Rian Hunter
  2006-06-30 12:21 ` Jacob Gorm Hansen
  2006-06-30 12:29 ` Vincent Hanquez
  0 siblings, 2 replies; 6+ messages in thread
From: Rian Hunter @ 2006-06-29 20:31 UTC (permalink / raw)
  To: xen-devel

Hi,

I want to write a Xen-aware application but I am encountering some
problems. For my applications to be Xen aware, the ones that are running
in non domain 0 need to be able to obtain some bootstrap information
from the program running in domain 0. This is very petty information (as
most IPC will be done using TCP/IP).

Basically my approach was this:

1. Process in domain-0 writes a key to /local/domain/<DomID>.  (<DomID>
refers to the domain id number assigned to a newly created vm)
2. Process in unprivileged domain reads from /local/domain/<DomID>

Of course you can see my problem: The unprivileged domain has no idea
which /local/domain/<DomID> is his! My first question: Is there a way
for an unprivileged domain to find out his <DomID> in user-space?

My second approached when I ran into this problem was:

1. Process in domain-0 writes a key to /local/domain/<DomID>.
2. Kernel-space driver in the unprivileged domain reads this value (or
watches this key) using the xs_* functions (which i believe already
defaults to the unprivileged domain's home name-space) and exposes a
character device (/dev/my_program_info) which prints out this
information.
3. Process in unprivileged domain just reads /dev/my_program_info

This second solution is too messy though! I believe I can still take the
first approach especially since the xs_* calls in the kernel default to
the home name-space. Why can't there be a user-space method to do this?

Any help would be greatly appreciated, Thank You!

Rian Hunter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Easy user-space usage of xenstore
  2006-06-29 20:31 Easy user-space usage of xenstore Rian Hunter
@ 2006-06-30 12:21 ` Jacob Gorm Hansen
  2006-06-30 14:32   ` Rian Hunter
  2006-06-30 12:29 ` Vincent Hanquez
  1 sibling, 1 reply; 6+ messages in thread
From: Jacob Gorm Hansen @ 2006-06-30 12:21 UTC (permalink / raw)
  To: Rian Hunter; +Cc: xen-devel

On 6/29/06, Rian Hunter <rian@mit.edu> wrote:
> Hi,
>
> I want to write a Xen-aware application but I am encountering some
> problems. For my applications to be Xen aware, the ones that are running
> in non domain 0 need to be able to obtain some bootstrap information
> from the program running in domain 0. This is very petty information (as
> most IPC will be done using TCP/IP).

Why not just put this info in the domU kernel cmdline?

Jacob

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Easy user-space usage of xenstore
  2006-06-29 20:31 Easy user-space usage of xenstore Rian Hunter
  2006-06-30 12:21 ` Jacob Gorm Hansen
@ 2006-06-30 12:29 ` Vincent Hanquez
  2006-06-30 14:34   ` Rian Hunter
  1 sibling, 1 reply; 6+ messages in thread
From: Vincent Hanquez @ 2006-06-30 12:29 UTC (permalink / raw)
  To: Rian Hunter; +Cc: xen-devel

On Thu, Jun 29, 2006 at 04:31:55PM -0400, Rian Hunter wrote:
> Basically my approach was this:
> 
> 1. Process in domain-0 writes a key to /local/domain/<DomID>.  (<DomID>
> refers to the domain id number assigned to a newly created vm)
> 2. Process in unprivileged domain reads from /local/domain/<DomID>
> 
> Of course you can see my problem: The unprivileged domain has no idea
> which /local/domain/<DomID> is his! My first question: Is there a way
> for an unprivileged domain to find out his <DomID> in user-space?

you can access /local/domain/<self>/.. by just using relative path instead
of absolute path.

ex: if you want to read /local/domain/5/something/x from domain 5 you can
just do :

value = xs_read("something/x");

Cheers,
-- 
Vincent Hanquez

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Easy user-space usage of xenstore
  2006-06-30 12:21 ` Jacob Gorm Hansen
@ 2006-06-30 14:32   ` Rian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Rian Hunter @ 2006-06-30 14:32 UTC (permalink / raw)
  To: Jacob Gorm Hansen; +Cc: xen-devel


On Jun 30, 2006, at 8:21 AM, Jacob Gorm Hansen wrote:

> On 6/29/06, Rian Hunter <rian@mit.edu> wrote:
>> Hi,
>>
>> I want to write a Xen-aware application but I am encountering some
>> problems. For my applications to be Xen aware, the ones that are  
>> running
>> in non domain 0 need to be able to obtain some bootstrap information
>> from the program running in domain 0. This is very petty  
>> information (as
>> most IPC will be done using TCP/IP).
>
> Why not just put this info in the domU kernel cmdline?

That's a good question. The reason I can't is because my program  
won't always have control over the starting/stopping of VM, nor will  
it have access to the configuration as well.

> Jacob

Rian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Easy user-space usage of xenstore
  2006-06-30 12:29 ` Vincent Hanquez
@ 2006-06-30 14:34   ` Rian Hunter
  2006-06-30 14:50     ` Ewan Mellor
  0 siblings, 1 reply; 6+ messages in thread
From: Rian Hunter @ 2006-06-30 14:34 UTC (permalink / raw)
  To: Vincent Hanquez; +Cc: xen-devel


On Jun 30, 2006, at 8:29 AM, Vincent Hanquez wrote:
> you can access /local/domain/<self>/.. by just using relative path  
> instead
> of absolute path.
>
> ex: if you want to read /local/domain/5/something/x from domain 5  
> you can
> just do :
>
> value = xs_read("something/x");

Oh can I? That's what I thought except when I do:

$ xenstore-read something

it fails. Maybe that's because xenstore-read always does an absolute  
path. I've read the source and it doesn't seem that way, I'll guess  
I'll try writing a program that uses the xs library to be sure.

> Cheers,
> -- 
> Vincent Hanquez


Thanks!

Rian Hunter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Easy user-space usage of xenstore
  2006-06-30 14:34   ` Rian Hunter
@ 2006-06-30 14:50     ` Ewan Mellor
  0 siblings, 0 replies; 6+ messages in thread
From: Ewan Mellor @ 2006-06-30 14:50 UTC (permalink / raw)
  To: Rian Hunter; +Cc: xen-devel, Vincent Hanquez

On Fri, Jun 30, 2006 at 10:34:45AM -0400, Rian Hunter wrote:

> 
> On Jun 30, 2006, at 8:29 AM, Vincent Hanquez wrote:
> >you can access /local/domain/<self>/.. by just using relative path  
> >instead
> >of absolute path.
> >
> >ex: if you want to read /local/domain/5/something/x from domain 5  
> >you can
> >just do :
> >
> >value = xs_read("something/x");
> 
> Oh can I? That's what I thought except when I do:
> 
> $ xenstore-read something
> 
> it fails. Maybe that's because xenstore-read always does an absolute  
> path. I've read the source and it doesn't seem that way, I'll guess  
> I'll try writing a program that uses the xs library to be sure.

It probably fails because of permissions -- you can only read what the tools
in domain 0 have explicitly allowed you to read.

I've just added some notes to the XenBus page on the wiki wrt permissions --
they are worth reading.

Ewan.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-30 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 20:31 Easy user-space usage of xenstore Rian Hunter
2006-06-30 12:21 ` Jacob Gorm Hansen
2006-06-30 14:32   ` Rian Hunter
2006-06-30 12:29 ` Vincent Hanquez
2006-06-30 14:34   ` Rian Hunter
2006-06-30 14:50     ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.