Skip to contentSkip to conversation

Xenstore / blkdev trouble, this time with examples in C

DISCUSSION Jacob Gorm Hansen 1 participant 1 message Sep 30, 2005

lore
Share & tools
lore
#0 lore raw

hi,
apparently vm-xs did was not able to write xenstore correctly, here is a new version of my domain creation script, in C.

        char* keys[] = {
            "/domain/0/backend" , "[]",
            "/domain/0/device" , "[]",
            "/domain/0/domid" , "0",
            "/domain/0/vm" , "0",
            "/domain/0/domain" , "0",
            "/domain/1/device/vbd/769/virtual-device" , "769",
            "/domain/1/device/vbd/769/backend-id" , "0",
            "/domain/1/device/vbd/769/backend" , "/domain/0/backend/vbd/1/769",
            "/domain/0/backend/vbd/1/769/domain" , "ExampleDomain",
            "/domain/0/backend/vbd/1/769/params" , "hda1",
            "/domain/0/backend/vbd/1/769/frontend-id" , "1",
            "/domain/0/backend/vbd/1/769/type" , "phy",
            "/domain/0/backend/vbd/1/769/read-only",
            "/domain/0/backend/vbd/1/769/frontend" , "/domain/1/device/vbd/769",
            "",""
        };

       if (xs != NULL) {
            sprintf(prefix, "/domain/%u", domid);
            sprintf(sdomid, "%u", domid);

            xs_mkdir(xs, "/domain");
            xs_mkdir(xs, prefix);

            if (!xs_introduce_domain(xs, domid,
                         store_mfn, local_store,
                         prefix)) {
                printf("xs_introduce_domain failed!\n");
                exit(errno);
            }

            strcat(prefix, "/id");
            if (!xs_write(xs, prefix,
                      sdomid, strlen(sdomid))) {
                printf("xs_write() failed!\n");
                exit(errno);
            }
            int i;
            for(i=0; ; i+=2)
            {
                char* key = keys[i];
                char* val = keys[i+1];
                printf("key %p\n",key);
                if(!*key) break;
                printf("setting %s to %s\n",key,val);
                xs_write(xs, key, val, strlen(val));
            }

I am getting the following out of domU (with some added debug prints to see what is going on).

blkfront_probe
scanf dir device/vbd/769 | node virtual-device | fmt %i read dir device/vbd/769 | node virtual-device .. read ok.
read dir device/vbd/769 | node backend-id
read dir device/vbd/769 | node backend
read dir /domain/0/backend/vbd/1/769 | node sectors read dir /domain/0/backend/vbd/1/769 | node sectors <4>xen_blk: Timeout connecting to device!

Can anyone point out why this is not working. The backend's probe callback seem to never be activated.

thanks,
Jacob