From: Boris Derzhavets Subject: Re: CS 21556 (blktap2: Fix tapdisk disktype issues) is no longer working for "vhd" [and 1 more messages] Date: Mon, 12 Jul 2010 11:05:04 -0700 (PDT) Message-ID: <734301.1872.qm@web56105.mail.re3.yahoo.com> References: <19515.19028.173876.918737@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0447038071==" Return-path: In-Reply-To: <19515.19028.173876.918737@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: eXeC001er , Ian Jackson Cc: "xen-devel@lists.xensource.com" , Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============0447038071== Content-Type: multipart/alternative; boundary="0-1697057399-1278957904=:1872" --0-1697057399-1278957904=:1872 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 1. [PATCH] blktap2: blktap2 and pygrub (xen-unstable) diff -r a672af698bc3 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py=A0=A0=A0 Fri Jul 09 12:35:58 = 2010 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py=A0=A0=A0 Sun Jul 11 17:16:39 = 2010 +0400 @@ -3261,6 +3261,7 @@ =A0 =A0=A0=A0=A0 taptype =3D blkdev_uname_to_taptype(disk) =A0=A0=A0=A0 mounted =3D devtype in ['tap', 'tap2'] and taptype !=3D 'aio' = and taptype !=3D 'sync' and not os.stat(fn).st_rdev +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 mounted_vbd_uuid =3D 0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if mounted: =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # This is a file, not a de= vice.=A0 pygrub can cope with a =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # file if it's raw, but if= it's QCOW or other such formats @@ -3276,7 +3277,8 @@ =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 from xen.xend import XendD= omain =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dom0 =3D XendDomain.instan= ce().privilegedDomain() -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dom0._waitForDeviceUUID(dom0= .create_vbd(vbd, disk)) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 mounted_vbd_uuid =3D dom0.cr= eate_vbd(vbd, disk); +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dom0._waitForDeviceUUID(moun= ted_vbd_uuid) =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fn =3D BOOTLOADER_LOOPBACK= _DEVICE =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 try: @@ -3286,8 +3288,9 @@ =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if mounted: =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 log.info("Unmo= unting %s from %s." % =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 (fn, BOOTLOADER_LOOPBACK_DEVICE)) - -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dom0.destroyDevi= ce('tap', BOOTLOADER_LOOPBACK_DEVICE) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 _, vbd_info =3D = dom0.info['devices'][mounted_vbd_uuid] +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dom0.destroyDevi= ce(dom0.getBlockDeviceClass(vbd_info['devid']), +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 BOOTLOADER_LOOPBACK_DEVICE, forc= e =3D True) =A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if blcfg is None: =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 msg =3D "Had a bootloader = specified, but can't find disk" 2. [PATCH] blktap/blktap2: Fix for incorrect parse disk configuration (xen-= unstable) diff -r a672af698bc3 tools/python/xen/util/blkif.py --- a/tools/python/xen/util/blkif.py=A0=A0=A0 Fri Jul 09 12:35:58 2010 +010= 0 +++ b/tools/python/xen/util/blkif.py=A0=A0=A0 Sun Jul 11 12:13:34 2010 +040= 0 @@ -87,7 +87,10 @@ =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fn =3D "/dev/%s" %(fn,) =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 =A0=A0=A0=A0=A0=A0=A0=A0 if typ in ("tap", "tap2"): -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (taptype, fn) =3D fn.split(":", 1) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if fn.count(":") =3D=3D 1: +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (taptype, fn) =3D fn.split("= :", 1) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else: +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (taptype, fn) =3D fn.split("= :", 2)[1:3] =A0=A0=A0=A0 return (fn, taptype) =A0 =A0def blkdev_uname_to_file(uname): I've tested this patches. They make things working for NexexentaStor 3.0.2 = xen image with "vhd" files and pygrub as bootloader at Xen 4.1-unstable ( tip CS) & 2= .6.32.16 Dom0 on top of Ubuntu 10.04 Server. Per exeCooler :- process of booting DomU with 'mounted-blktap2' (VHD for example) and 'pygru= b' as bootloader: 1. Connect boot-device to Dom0 as '/dev/xpvd' 2. Pygrub get info for load DomU 3. Disconnect boot-device from Dom0 4. Boot DomU During step 3 created device disconnecting from Dom0, but xenstore does not= scrape away after device disconnected from Dom0 =3D> result:=20 =A0=A0=A0 "Error: Device /dev/xvdp (51952, tap2) is already connected." During step 3 created device disconnecting from Dom0, but 'destroyDevice' m= ethod is passed 'tap' always =3D> result: =A0=A0=A0 "Error: Device 51952 not connected" Boris. P.S. It's just a reminder of content been already posted by exeCooler to xe= n-devel mailing list. --- On Mon, 7/12/10, Ian Jackson wrote: From: Ian Jackson Subject: Re: [Xen-devel] CS 21556 (blktap2: Fix tapdisk disktype issues) is= no longer working for "vhd" [and 1 more messages] To: "eXeC001er" Cc: "xen-devel@lists.xensource.com" , "Boris= Derzhavets" , "Keir Fraser" Date: Monday, July 12, 2010, 1:01 PM Boris Derzhavets writes ("[Xen-devel] CS 21556 (blktap2: Fix tapdisk diskty= pe issues) is no longer working for "vhd""): > In about the most recent 4-5 days an error : This is related to 21541:7ff0e885b5c3 and 21728:51160a8ecf7d. > root@ServerLSX:~/NexentaStor-Community-3.0.2# xm create -c nexentastor-co= mmunity-3.0.2-xen.cfg > Using config file "./nexentastor-community-3.0.2-xen.cfg". > Error: [Errno 2] No such file or directory: 'vhd:/root/NexentaStor-Commun= ity-3.0.2/syspool.img' >=20 > has been brought back under xen-unstable. Does this work in 4.0-testing ? eXeC001er writes ("[Xen-devel] Re: CS 21556 (blktap2: Fix tapdisk disktype = issues) is no longer working for "vhd""): > My patch was not quite correct. I waited until the return change back to > make a new one. > The new patch will be ready today or tomorrow. Let's see how will the > situation was. Thanks.=A0 As I wrote earlier: =A0 Can I ask you to try to (a) separate out these patches, and (b) =A0 explain the reasoning behind them in more detail ?=A0 If you can =A0 provide a separate message with a separate patch for each change, =A0 with an explanation at greater length, it will be much easier for us =A0 to evaluate them.=A0 Thanks. Thanks, Ian. =0A=0A=0A --0-1697057399-1278957904=:1872 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
1. [PATCH] blktap2: blktap2 and pygrub (xen-u= nstable)

diff -r a672af698bc3 tools/python/xen/xend/XendDomainInfo.p= y
--- a/tools/python/xen/xend/XendDomainInfo.py    Fri Ju= l 09 12:35:58 2010 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py&n= bsp;   Sun Jul 11 17:16:39 2010 +0400
@@ -3261,6 +3261,7 @@ 
     taptype =3D blkdev_uname_to_taptype(dis= k)
     mounted =3D devtype in ['tap', 'tap2'] and t= aptype !=3D 'aio' and taptype !=3D 'sync' and not os.stat(fn).st_rdev
+&= nbsp;           mounted_v= bd_uuid =3D 0
         &nbs= p;   if mounted:
       &nb= sp;         # This is a file, not a device.  pygrub can cope with a
     &nbs= p;           # file if it= 's raw, but if it's QCOW or other such formats
@@ -3276,7 +3277,8 @@
=  
           = ;      from xen.xend import XendDomain
 &n= bsp;            = ;   dom0 =3D XendDomain.instance().privilegedDomain()
- &= nbsp;           &nbs= p;  dom0._waitForDeviceUUID(dom0.create_vbd(vbd, disk))
+ &nbs= p;            &= nbsp; mounted_vbd_uuid =3D dom0.create_vbd(vbd, disk);
+  &nbs= p;             dom0._waitForDeviceUUID(mounted_vbd_uuid)
     = ;            fn =3D = BOOTLOADER_LOOPBACK_DEVICE
 
      = ;       try:
@@ -3286,8 +3288,9 @@
&nbs= p;            &= nbsp;   if mounted:
       =             &nb= sp; log.info("Unmounting %s from %s." %
     &n= bsp;            = ;            (fn, BO= OTLOADER_LOOPBACK_DEVICE))
-
-      &nb= sp;            = dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+       =              _,= vbd_info =3D dom0.info['devices'][mounted_vbd_uuid]
+   =             &nb= sp;    dom0.destroyDevice(dom0.getBlockDeviceClass(vbd_info[= 'devid']),
+          =             &nb= sp;            =     BOOTLOADER_LOOPBACK_DEVICE, force =3D True)
              i= f blcfg is None:
         &= nbsp;       msg =3D "Had a bootloader specifi= ed, but can't find disk"


2. [PATCH] blktap/blktap2: Fix for incorrect parse disk configuration (xen-unstable)

diff -r a672af698= bc3 tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py&= nbsp;   Fri Jul 09 12:35:58 2010 +0100
+++ b/tools/python/xen/= util/blkif.py    Sun Jul 11 12:13:34 2010 +0400
@@ -87,7 = +87,10 @@
          &n= bsp;      fn =3D "/dev/%s" %(fn,)
  &= nbsp;                     if typ in ("tap", "tap2")= :
-            (t= aptype, fn) =3D fn.split(":", 1)
+      &n= bsp;     if fn.count(":") =3D=3D 1:
+  &nb= sp;            = (taptype, fn) =3D fn.split(":", 1)
+            = else:
+           = ;     (taptype, fn) =3D fn.split(":", 2)[1:3]
 =     return (fn, taptype)
 
 def blkdev_uname= _to_file(uname):


I've tested this patches. They make things work= ing for NexexentaStor 3.0.2 xen image
with "vhd" files and pygrub as boo= tloader at Xen 4.1-unstable ( tip CS) & 2.6.32.16 Dom0
on top of Ubu= ntu 10.04 Server.


Per exeCooler :-


process of booting= DomU with 'mounted-blktap2' (VHD for example) and 'pygrub' as bootloader:<= br>
1. Connect boot-device to Dom0 as '/dev/xpvd'
2. Pygrub get info = for load DomU
3. Disconnect boot-device from Dom0
4. Boot DomU
During step 3 created device disconnecting from Dom0, but xenstore does no= t scrape away after device disconnected from Dom0 =3D> result:
    "Error: Device /dev/xvdp (51952, tap2) is already c= onnected."

During step 3 created device disconnecting from Dom0, but= 'destroyDevice' method is passed 'tap' always =3D> result:
 &nb= sp;  "Error: Device 51952 not connected"


Boris.
P.S. It'= s just a reminder of content been already posted by exeCooler to xen-devel = mailing list.


--- On Mon, 7/12/10, Ian Jackson <Ian.Jac= kson@eu.citrix.com> wrote:

From:= Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [Xen-devel] = CS 21556 (blktap2: Fix tapdisk disktype issues) is no longer working for "v= hd" [and 1 more messages]
To: "eXeC001er" <execooler@gmail.com>Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,= "Boris Derzhavets" <bderzhavets@yahoo.com>, "Keir Fraser" <keir.fraser@eu.citrix.com>
Date: Monday, July 12, 2010, 1:01 PM<= br>
Boris Derzhavets writes ("[Xen-devel] CS 21= 556 (blktap2: Fix tapdisk disktype issues) is no longer working for "vhd"")= :
> In about the most recent 4-5 days an error :

This is relat= ed to 21541:7ff0e885b5c3 and 21728:51160a8ecf7d.

> root@ServerLSX= :~/NexentaStor-Community-3.0.2# xm create -c nexentastor-community-3.0.2-xe= n.cfg
> Using config file "./nexentastor-community-3.0.2-xen.cfg".> Error: [Errno 2] No such file or directory: 'vhd:/root/NexentaStor-Co= mmunity-3.0.2/syspool.img'
>
> has been brought back under xen= -unstable.

Does this work in 4.0-testing ?

eXeC001er writes (= "[Xen-devel] Re: CS 21556 (blktap2: Fix tapdisk disktype issues) is no long= er working for "vhd""):
> My patch was not quite correct. I waited un= til the return change back to
> make a new one.
> The new patch will be ready today or tomorrow. Let's see how will the
> situ= ation was.

Thanks.  As I wrote earlier:

  Can I ask= you to try to (a) separate out these patches, and (b)
  explain th= e reasoning behind them in more detail ?  If you can
  provide= a separate message with a separate patch for each change,
  with a= n explanation at greater length, it will be much easier for us
  to= evaluate them.  Thanks.

Thanks,
Ian.
=

=0A=0A --0-1697057399-1278957904=:1872-- --===============0447038071== 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 --===============0447038071==--