Skip to contentSkip to conversation

xenstore and "my domid" on hvm guest

DISCUSSION Dan Magenheimer 4 participants 6 messages May 21, 2008 – May 22, 2008

lore
Share & tools
lore
#0 lore raw

It appears that if an hvm guest has /proc/xen/xenbus, the xenstore-* tools can be made to work inside this guest. For example, inside an hvm guest which (according to "xm list" in domain0) has a domid of 2, I can do:

# xenstore-ls /local/domain/2

and it works fine, whereas:

# xenstore-ls /local/domain/0

fails properly with "Permission denied".

So I can use xenstore-read and xenstore-write inside the guest but I need to know "my" domid to do so.

Is there any way from inside the guest to determine its domid? Alternately, is there any syntax for the xenstore tools that allows me to refer to "self"?

By using xenstore-exists repeatedly marching through the numerals, I can figure it out, but is there a better way?

Thanks,
Dan

===================================
Thanks... for the memory
I really could use more / My throughput's on the floor The balloon is flat / My swap disk's fat / I've OOM's in store Overcommitted so much
(with apologies to the late great Bob Hope)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

I think xenstore accesses in a domU have a 'current working directory' of /local/domain/<domid>/. What happens if you try accesses without an initial / in the path?

-- Keir

Quoted 37 lines · Dan Magenheimer

It appears that if an hvm guest has /proc/xen/xenbus, the xenstore-* tools can be made to work inside this guest. For example, inside an hvm guest which (according to "xm list" in domain0) has a domid of 2, I can do:

# xenstore-ls /local/domain/2

and it works fine, whereas:

# xenstore-ls /local/domain/0

fails properly with "Permission denied".

So I can use xenstore-read and xenstore-write inside the guest but I need to know "my" domid to do so.

Is there any way from inside the guest to determine its domid? Alternately, is there any syntax for the xenstore tools that allows me to refer to "self"?

By using xenstore-exists repeatedly marching through the numerals, I can figure it out, but is there a better way?

Thanks,
Dan

===================================
Thanks... for the memory
I really could use more / My throughput's on the floor The balloon is flat / My swap disk's fat / I've OOM's in store Overcommitted so much
(with apologies to the late great Bob Hope)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Keir Fraser writes ("Re: [Xen-devel] xenstore and "my domid" on hvm guest"):

Quoted 3 lines

I think xenstore accesses in a domU have a 'current working directory' of /local/domain/<domid>/. What happens if you try accesses without an initial / in the path?

Yes, exactly. This is covered in docs/misc/xenstore.txt:

Values commonly included in payloads include:

<path>
Specifies a path in the hierarchical key structure. If <path> starts with a / it simply represents that path.

<path> is allowed not to start with /, in which case the caller must be a domain (rather than connected via a socket) and the path is taken to be relative to /local/domain/<domid> (eg, x/y' sent by domain 3 would mean /local/domain/3/x/y').

Ian.

#3 lore raw
Quoted 6 lines · Ian Jackson

Keir Fraser writes ("Re: [Xen-devel] xenstore and "my domid" on hvm guest"):

Quoted 3 lines

I think xenstore accesses in a domU have a 'current working directory' of /local/domain/<domid>/. What happens if you try accesses without an initial / in the path?

Yes, exactly. This is covered in docs/misc/xenstore.txt:

Which would work great if the tools understood:

xenstore-ls .

but unfortunately they don't, so you have to guess the names of the top-level directories

regards
john

#4 lore raw
Quoted 4 lines · John Levon
Quoted 4 lines
Quoted 3 lines

I think xenstore accesses in a domU have a 'current working directory' of /local/domain/<domid>/. What happens if you try accesses without an initial / in the path?

Quoted 8 lines
Quoted 1 line

Yes, exactly. This is covered in docs/misc/xenstore.txt:

Which would work great if the tools understood:

xenstore-ls .

but unfortunately they don't, so you have to guess the names of the top-level directories

That's quite a separate issue and could be quite easily fixed. E.g., by supporting the special single-character directory path '.', if anyone cared sufficiently about this limitation.

-- Keir

#5 lore raw
In reply to Ian Jackson

Thanks much. Exactly what I was looking for!

Dan

Quoted 31 lines

-----Original Message-----
From: Ian Jackson [mailto:[email protected]]
Sent: Thursday, May 22, 2008 3:37 AM
To: Keir Fraser
Cc: [email protected]; Xen-Devel (E-mail)
Subject: Re: [Xen-devel] xenstore and "my domid" on hvm guest

Keir Fraser writes ("Re: [Xen-devel] xenstore and "my domid" on hvm guest"):

Quoted 1 line

I think xenstore accesses in a domU have a 'current working

directory' of

Quoted 1 line

/local/domain/<domid>/. What happens if you try accesses

without an initial

Quoted 1 line

/ in the path?

Yes, exactly. This is covered in docs/misc/xenstore.txt:

Values commonly included in payloads include:

<path>
Specifies a path in the hierarchical key structure. If <path> starts with a / it simply represents that path.

<path> is allowed not to start with /, in which case the caller must be a domain (rather than connected via a socket) and the path is taken to be relative to /local/domain/<domid> (eg, x/y' sent by domain 3 would mean /local/domain/3/x/y').

Ian.