Skip to contentSkip to conversation

xenstore -- read UUID

DISCUSSION dinesh chandrasekaran 4 participants 4 messages Sep 10, 2008

lore
Share & tools
lore
#0 lore raw

Hi Derek,

they were 2 seperate questions... sorry for the typos...
How to access xenstore from Dom-0? -- which you said 'YES'...
And How to access xenstore from hypervosor?
Yes.. as you said 'make xen' doesnt include /usr/include libraries and I did check that...

If the hypervisor has no knowledge about XenStore, Dom-0 must have the full control over the xenstore. I need to build a table with some fields one of which should never change during a VMs lifetime.
For example, if I chose the domain_id whose value is transient, If the VM reboots, its domain_id changes. That is the reason why I opted for the UUID of a domain that persists over time even after migration to another machine. The only way I could get a domain's UUID is through the xenstore and want to take away domain-0 from the picture, which according to you is almost impossible.

anyway out?

regards,
Dinesh C

Quoted 20 lines

Date: Tue, 9 Sep 2008 21:37:57 +0100
From: [email protected]
To: [email protected]
Subject: Re: [Xen-devel] xenstore -- read UUID
CC: [email protected]; [email protected]

Hi Dinesh,

In what context are you trying to run this code? You say that you want to read the UUID from Dom0, but xen/common/memory.c is part of the hypervisor (and not Dom0). If you try to compile that code into xen/common/memory.c, it will fail, because building the hypervisor does not include the user-space headers (i.e. the contents of /usr/include/).

The hypervisor has (almost) no knowledge about XenStore, and so it would be very difficult to access XenStore from there. However, if you want to access this information in Dom0, your code should work in a user-space application.

Quoted 55 lines

Could you provide more details about what you are trying to do?

Regards,

Derek Murray.

Quoted 47 lines · dinesh chandrasekaran

Hi All,

Im trying to read the UUID of a domain-U from domain-0 using the
following code from inside say xen/common/memory.c.

The include file <xs.h> is present both in /usr/include and tools/xenstore/xs.h

#include <xs.h>

static int get_domain_uuid(unsigned int domain_id) {
        struct xs_handle *xs;
        xs_transaction_t t;
        char *path;
        unsigned int *len;
        void *uuid;
        xs = xs_daemon_open();
        if (xs == NULL)
                return 1;
        path = xs_get_domain_path(xs, domain_id);
        if (path == NULL)
                return 1;
        strcat (path, '/uuid');
        len = strlen(path) + 1;
        uuid = xs_read(xs, t, path, len);
        printf('%lx \n', (char) (*uuid));
        xs_daemon_close(xs);
        free(path);
        return 0;
}

when compiled throws an error ( xs.h - no such file or directory).

How to access xenstore and read the doamin UUID from dom-0 specifically from inside xen/common/memory.c?

regards,
Dinesh C

________________________________
Voice your opinion on the burning issues of the day. Discuss, debate with the world. Logon to message boards on MSN. Try it!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_________________________________________________________________
Searching for the best deals on travel? Visit MSN Travel.
http://in.msn.com/coxandkings

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

#1 lore raw
Quoted 7 lines · dinesh chandrasekaran

Hi Derek,

they were 2 seperate questions... sorry for the typos... How to access xenstore from Dom-0? -- which you said 'YES'... And How to access xenstore from hypervosor?

Hypervisor does not control the xenstore.
& I am not sure if xen bus interface is available to Hypervisor also.

Quoted 14 lines

Yes.. as you said 'make xen' doesnt include /usr/include libraries and I did check that...

If the hypervisor has no knowledge about XenStore, Dom-0 must have the full control over the xenstore.
I need to build a table with some fields one of which should never change during a VMs lifetime.
For example, if I chose the domain_id whose value is transient, If the VM reboots, its domain_id changes.
That is the reason why I opted for the UUID of a domain that persists over time even after migration to another machine.
The only way I could get a domain's UUID is through the xenstore and want to take away domain-0 from the picture, which
according to you is almost impossible.

As far as source code compilation is cocerned try this
gcc <source file> -F /path/to/xensourcecode/tools/xenstore -lxenstore actually xen source code will have a xen store shared object, you definately need to use that (libxenstore.so.3.0.0)

HTH

thanks
-TEJ

Quoted 87 lines

anyway out?

regards,
Dinesh C

Quoted 20 lines

Date: Tue, 9 Sep 2008 21:37:57 +0100
From: [email protected]
To: [email protected]
Subject: Re: [Xen-devel] xenstore -- read UUID
CC: [email protected]; [email protected]

Hi Dinesh,

In what context are you trying to run this code? You say that you want to read the UUID from Dom0, but xen/common/memory.c is part of the hypervisor (and not Dom0). If you try to compile that code into xen/common/memory.c, it will fail, because building the hypervisor does not include the user-space headers (i.e. the contents of /usr/include/).

The hypervisor has (almost) no knowledge about XenStore, and so it would be very difficult to access XenStore from there. However, if you want to access this information in Dom0, your code should work in a user-space application.

Quoted 57 lines

Could you provide more details about what you are trying to do?

Regards,

Derek Murray.

Quoted 49 lines · dinesh chandrasekaran

Hi All,

Im trying to read the UUID of a domain-U from domain-0 using the
following code from inside say xen/common/memory.c.

The include file <xs.h> is present both in /usr/include and tools/xenstore/xs.h

#include <xs.h>

static int get_domain_uuid(unsigned int domain_id) {
        struct xs_handle *xs;
        xs_transaction_t t;
        char *path;
        unsigned int *len;
        void *uuid;
        xs = xs_daemon_open();
        if (xs == NULL)
                return 1;
        path = xs_get_domain_path(xs, domain_id);
        if (path == NULL)
                return 1;
        strcat (path, '/uuid');
        len = strlen(path) + 1;
        uuid = xs_read(xs, t, path, len);
        printf('%lx \n', (char) (*uuid));
        xs_daemon_close(xs);
        free(path);
        return 0;
}

when compiled throws an error ( xs.h - no such file or directory).

How to access xenstore and read the doamin UUID from dom-0 specifically from
inside xen/common/memory.c?

regards,
Dinesh C

________________________________
Voice your opinion on the burning issues of the day. Discuss, debate with
the world. Logon to message boards on MSN. Try it!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_________________________________________________________________
Searching for the best deals on travel? Visit MSN Travel.
http://in.msn.com/coxandkings

#2 lore raw
In reply to dinesh chandrasekaran

Hi Dinesh,

Quoted 2 lines · dinesh chandrasekaran

they were 2 seperate questions... sorry for the typos... How to access xenstore from Dom-0? -- which you said 'YES'...

Yes, this is certainly possible: your code should work (I haven't tested it) in Dom0 user-space. For another example, see tools/xenstore/xsls.c, which implements ls functionality for xenstore using the same interface.

Quoted 1 line

And How to access xenstore from hypervosor?

There is no code to do this in Xen at the moment.

Quoted 2 lines

If the hypervisor has no knowledge about XenStore, Dom-0 must have the full control over the xenstore.

Correct. XenStore is simply implemented as a user-space daemon (xenstored), running as root in Dom0.

Quoted 9 lines

I need to build a table with some fields one of which should never change during a VMs lifetime.
For example, if I chose the domain_id whose value is transient, If the VM reboots, its domain_id changes.
That is the reason why I opted for the UUID of a domain that persists over time even after migration to another machine.
The only way I could get a domain's UUID is through the xenstore and want to take away domain-0 from the picture, which
according to you is almost impossible.

Instead of Dom0, you could possibly do this in a stubdomain. It is possible to access XenStore from a MiniOS-based domain.

Regards,

Derek Murray.

#3 lore raw

Hi everyone,

Sorry for the late joining to this thread.

If you really want to gather a domain's uuid from within the hypervisor, it's actually possible to do without xenstore. A domain's uuid gets stored as a xen_domain_handle_t in the domain handle field (see xen/include/xen/sched.h and xen/commom/domctl.c). The uuid of a domain gets passed to xen on domain creation. The uuid can also be read from a privileged domain by issuing the XEN_DOMCTL_getdomaininfo hypercall.

But as Derek mentioned earlier, you can read the domain uuid from a guest via xenstore which is probably a better idea.

cheers,

geoffrey

Quoted 44 lines · Derek Murray

Hi Dinesh,

Quoted 2 lines · dinesh chandrasekaran

they were 2 seperate questions... sorry for the typos... How to access xenstore from Dom-0? -- which you said 'YES'...

Yes, this is certainly possible: your code should work (I haven't tested it) in Dom0 user-space. For another example, see tools/xenstore/xsls.c, which implements ls functionality for xenstore using the same interface.

Quoted 1 line

And How to access xenstore from hypervosor?

There is no code to do this in Xen at the moment.

Quoted 2 lines

If the hypervisor has no knowledge about XenStore, Dom-0 must have the full control over the xenstore.

Correct. XenStore is simply implemented as a user-space daemon (xenstored), running as root in Dom0.

Quoted 9 lines

I need to build a table with some fields one of which should never change during a VMs lifetime.
For example, if I chose the domain_id whose value is transient, If the VM reboots, its domain_id changes.
That is the reason why I opted for the UUID of a domain that persists over time even after migration to another machine.
The only way I could get a domain's UUID is through the xenstore and want to take away domain-0 from the picture, which
according to you is almost impossible.

Instead of Dom0, you could possibly do this in a stubdomain. It is possible to access XenStore from a MiniOS-based domain.

Regards,

Derek Murray.

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