Skip to contentSkip to conversation

Disk configuration problem

DISCUSSION Applied Naoki Takayama 3 participants 4 messages Nov 14, 2006 – Nov 16, 2006

lore
Share & tools
lore
#0 lore raw

Hi All.

My name is Naoki Takayama, work for FUJITSU.

I found following disk configuration problem.
When I specify 'file:yy.img,hde,w' in domain config file as below, the vnc connection demands to input the password.

disk = [ 'file:xx.img,ioemu:hda,w','file:yy.img,hde,w' ]

If I change the 'hde' to 'hdf', this problem does not occur.

This problem is caused by xenstore_parse_domain_config function in tools/ioemu/xenstore.c

in line 102: hd_index variable is assigned value 4.

in line 123: bs_table array is accsessed by the index(4). (the vncpasswd variable is overwritten)

Here, bs_table is defined as "BlockDriverState *bs_table[MAX_DISKS]" in vl.c and MAX_DISKS is defined as value 4 in vl.h

Does anyone have a suggetion how to fix this problem?

tools/ioemu/xenstore.c

55 void xenstore_parse_domain_config(int domid)
56 {

 57     char **e = NULL;
 58     char *buf = NULL, *path;
 59     char *bpath = NULL, *dev = NULL, *params = NULL, *type = NULL;
 60     int i;
 61     unsigned int len, num, hd_index;

[snip]
102 hd_index = dev[2] - 'a'; <== assign value 4.
103 if (hd_index > MAX_DISKS)
104 continue;
105 /* read the type of the device */
106 if (pasprintf(&buf, "%s/device/vbd/%s/device-type", path, e[i]) == -1)
107 continue;

108         free(type);
109         type = xs_read(xsh, XBT_NULL, buf, &len);
110         /* read params to get the patch of the image -- read it last

111 * so that we have its path in buf when setting up the
112 * watch */
113 if (pasprintf(&buf, "%s/params", bpath) == -1)
114 continue;

115         free(params);
116         params = xs_read(xsh, XBT_NULL, buf, &len);
117         if (params == NULL)

118 continue;
119 if (params[0]) {
120 hd_filename[hd_index] = params; /* strdup() */
121 params = NULL; /* don't free params on re-use */
122 }
123 bs_table[hd_index] = bdrv_new(dev); <== overwrite occur
[snip]

--
Naoki Takayama

#1 lore raw

Hi,

I sent the patch that corrected this problem.
Please refer to following URL.

http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00383.html

---
Begi.net (http://Begi.net)
Director of Engineering Department
Hiromichi Ito ([email protected])

Quoted 69 lines · Naoki Takayama

Hi All.

My name is Naoki Takayama, work for FUJITSU.

I found following disk configuration problem.
When I specify 'file:yy.img,hde,w' in domain config file as below, the vnc connection demands to input the password.

disk = [ 'file:xx.img,ioemu:hda,w','file:yy.img,hde,w' ]

If I change the 'hde' to 'hdf', this problem does not occur.

This problem is caused by xenstore_parse_domain_config function in tools/ioemu/xenstore.c

in line 102: hd_index variable is assigned value 4.

in line 123: bs_table array is accsessed by the index(4). (the vncpasswd variable is overwritten)

Here, bs_table is defined as "BlockDriverState *bs_table[MAX_DISKS]" in vl.c and MAX_DISKS is defined as value 4 in vl.h

Does anyone have a suggetion how to fix this problem?

tools/ioemu/xenstore.c

55 void xenstore_parse_domain_config(int domid)
56 {

 57     char **e = NULL;
 58     char *buf = NULL, *path;
 59     char *bpath = NULL, *dev = NULL, *params = NULL, *type = NULL;
 60     int i;
 61     unsigned int len, num, hd_index;

[snip]
102 hd_index = dev[2] - 'a'; <== assign value 4.
103 if (hd_index > MAX_DISKS)
104 continue;
105 /* read the type of the device */
106 if (pasprintf(&buf, "%s/device/vbd/%s/device-type", path, e[i]) == -1)
107 continue;

108         free(type);
109         type = xs_read(xsh, XBT_NULL, buf, &len);
110         /* read params to get the patch of the image -- read it last

111 * so that we have its path in buf when setting up the
112 * watch */
113 if (pasprintf(&buf, "%s/params", bpath) == -1)
114 continue;

115         free(params);
116         params = xs_read(xsh, XBT_NULL, buf, &len);
117         if (params == NULL)

118 continue;
119 if (params[0]) {
120 hd_filename[hd_index] = params; /* strdup() */
121 params = NULL; /* don't free params on re-use */
122 }
123 bs_table[hd_index] = bdrv_new(dev); <== overwrite occur
[snip]

--
Naoki Takayama

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