From: "Kasai Takanori" Subject: [PATCH] Allow blktap to be able to be booted as system volume for PV-on-HVM(TAKE 2) Date: Thu, 12 Jul 2007 09:13:58 +0900 Message-ID: <053401c7c419$90263cc0$dab2220a@VF03007L> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0531_01C7C464.FA79ABC0" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. ------=_NextPart_000_0531_01C7C464.FA79ABC0 Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; reply-type=original Content-Transfer-Encoding: 7bit Hi All, I sent the patch to make blktap work with PV-on-HVM. For system volume to boot hda or xvda, I corrected the patch. Signed-off-by: Takanori Kasai This patch made it possible to use either. disk = [ 'tap:aio:/xen/test/rhel5ga_full.img,hda,w' ] or disk = [ 'tap:aio:/xen/test/rhel5ga_full.img,xvda,w' ] It is assumed that hda is a volume of the system if both xvda and hda are specified. disk = [ 'file:/xen/test/rhel5ga_full.img,hda,w', 'tap:aio:/xen/test/drive2.img,xvda,w' ] Best Regards, -- Takanori Kasai ----- Original Message ----- From: "Kasai Takanori" To: "xen-devel" Sent: Friday, July 06, 2007 7:50 PM Subject: [Xen-devel] [PATCH] Allow blktap to be able to be booted as systemvolume for PV-on-HVM > Hi All, > > We were testing the PV driver on the HVM domain. > When blktap was booting system volume, PV-on-HVM domain was not able to be > started. > > The configuration file is specified as follows. > disk = [ 'tap:aio:/xen/test/rhel5ga_full.img,hda,w' ] > > The error occurred by the initialization of system volume in qemu-dm. > > qemu: could not open hard disk image 'aio:/xen/test/rhel5ga_full.img' > > It is because "aio:" is added to the head of params in xenstore. > However, qemu-dm open device by params. > > This patch corrected the problem of params on the qemu-dm. > > Signed-off-by: Takanori Kasai > Signed-off-by: Tomonari Horikoshi > Signed-off-by: Tsunehisa Doi > > The execution result is as follows. > > # xm create -f rhel5ga_vti.conf > Using config file "./rhel5ga_vti.conf". > Started domain RHEL5GA-test2 > # xm block-list RHEL5GA-test2 > Vdev BE handle state evt-ch ring-ref BE-path > 768 0 0 1 -1 -1 /local/domain/0/backend/tap/75/768 > ... <<= /* Waiting for booting process */ > # xm block-list RHEL5GA-test2 > Vdev BE handle state evt-ch ring-ref BE-path > 768 0 0 4 7 8 /local/domain/0/backend/tap/75/768 > > Best Regards, ------=_NextPart_000_0531_01C7C464.FA79ABC0 Content-Type: application/octet-stream; name="allow-blktap-system-volume-2.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="allow-blktap-system-volume-2.patch" # HG changeset patch=0A= # User kasai.takanori@jp.fujitsu.com=0A= # Date 1184197224 -32400=0A= # Node ID 5f7c008e093beb4a5b6d098e19658b442e1298bd=0A= # Parent 1f348e70a5affdea9b44c1e39cd5ef094ad4a0bf=0A= Allow blktap to be able to be booted as system volume for PV-on-HVM.=0A= The system volume can be booted with hda or xvda.=0A= =0A= Signed-off-by: Takanori Kasai =0A= =0A= diff -r 1f348e70a5af -r 5f7c008e093b tools/ioemu/xenstore.c=0A= --- a/tools/ioemu/xenstore.c Tue Jul 10 11:10:38 2007 +0100=0A= +++ b/tools/ioemu/xenstore.c Thu Jul 12 08:40:24 2007 +0900=0A= @@ -83,7 +83,7 @@ void xenstore_parse_domain_config(int do=0A= char *buf =3D NULL, *path;=0A= char *fpath =3D NULL, *bpath =3D NULL,=0A= *dev =3D NULL, *params =3D NULL, *type =3D NULL;=0A= - int i, is_scsi;=0A= + int i, is_scsi, is_hda =3D 0;=0A= unsigned int len, num, hd_index;=0A= =0A= for(i =3D 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++)=0A= @@ -123,6 +123,34 @@ void xenstore_parse_domain_config(int do=0A= dev =3D xs_read(xsh, XBT_NULL, buf, &len);=0A= if (dev =3D=3D NULL)=0A= continue;=0A= + if(!strncmp(dev, "hda", 3)) {=0A= + is_hda =3D 1;=0A= + break;=0A= + }=0A= + }=0A= +=0A= + for (i =3D 0; i < num; i++) {=0A= + /* read the backend path */=0A= + if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) = =3D=3D -1)=0A= + continue;=0A= + free(bpath);=0A= + bpath =3D xs_read(xsh, XBT_NULL, buf, &len);=0A= + if (bpath =3D=3D NULL)=0A= + continue;=0A= + /* read the name of the device */=0A= + if (pasprintf(&buf, "%s/dev", bpath) =3D=3D -1)=0A= + continue;=0A= + free(dev);=0A= + dev =3D xs_read(xsh, XBT_NULL, buf, &len);=0A= + if (dev =3D=3D NULL)=0A= + continue;=0A= + /* Change xvda to look like hda */=0A= + if( !is_hda && !strncmp(dev, "xvda", 4)) {=0A= + memmove(dev, dev+1, strlen(dev));=0A= + dev[0] =3D 'h';=0A= + dev[1] =3D 'd';=0A= + fprintf(stderr, "Change xvda to lock like '%s'\n", dev);=0A= + }=0A= is_scsi =3D !strncmp(dev, "sd", 2);=0A= if ((strncmp(dev, "hd", 2) && !is_scsi) || strlen(dev) !=3D 3 )=0A= continue;=0A= @@ -173,6 +201,15 @@ void xenstore_parse_domain_config(int do=0A= }=0A= /* open device now if media present */=0A= if (params[0]) {=0A= + /* Strip off blktap sub-type prefix aio: etc for hda */=0A= + if (hd_index =3D=3D 0) {=0A= + char *p =3D NULL;=0A= + if((p =3D strchr(params, ':'))) {=0A= + memmove(params, p+1, strlen(p+1)+1); =0A= + fprintf(stderr, "Strip off blktap sub-type prefix = aio: etc ");=0A= + fprintf(stderr, "for hda\n : params=3D'%s'\n", = params);=0A= + }=0A= + }=0A= if (bdrv_open(bs_table[hd_index + (is_scsi ? MAX_DISKS : = 0)],=0A= params, 0 /* snapshot */) < 0)=0A= fprintf(stderr, "qemu: could not open hard disk image = '%s'\n",=0A= ------=_NextPart_000_0531_01C7C464.FA79ABC0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ------=_NextPart_000_0531_01C7C464.FA79ABC0--