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:10:51 -0700 (PDT) Message-ID: <498959.58966.qm@web56106.mail.re3.yahoo.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0349426837==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson , eXeC001er Cc: "xen-devel@lists.xensource.com" , Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============0349426837== Content-Type: multipart/alternative; boundary="0-1400023371-1278958251=:58966" --0-1400023371-1278958251=:58966 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']),=20 +=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. =0A[PATCH] blktap/blktap2: Fix for incorrect parse disk configuration = =0A(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=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 =0A'mounted-blktap2' (VHD for example) and 'py= grub' as bootloader:=0A=0A=0A=0A=0A 1. Connect boot-device to Dom0 as '/dev/xpvd'2.=0A Pygrub get info for load= DomU3. Disconnect boot-device from =0ADom04. Boot DomU During step 3 =0Acreated device disconnecting from Dom0, but xenstore=A0doe= s=0A not=A0scrape=0A away after device disconnected from Dom0 =3D> result:= =A0=0A=0A=0A=0A=0A=A0=A0 =A0"Error: Device /dev/xvdp (51952, =0Atap2) is al= ready connected."=0A=0A=0A=0A=0A During step 3 created device disconnecting from =0ADom0, but 'destroyDevice= ' method is passed=A0'tap'=A0always =3D> result:=A0=A0=0A =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, eXeC001er wrote: From: eXeC001er Subject: Re: [Xen-devel] CS 21556 (blktap2: Fix tapdisk disktype issues) is= no longer working for "vhd" [and 1 more messages] To: "Ian Jackson" Cc: "xen-devel@lists.xensource.com" , "Boris= Derzhavets" , "Keir Fraser" Date: Monday, July 12, 2010, 1:08 PM 2010/7/12 Ian Jackson =0ABoris Derzhavets writes ("[Xen-devel] CS 21556 (blktap2: Fix tapdisk dis= ktype issues) is no longer working for "vhd""): =0A> In about the most recent 4-5 days an error : =0A =0AThis is related to 21541:7ff0e885b5c3 and 21728:51160a8ecf7d. =0A =0A> root@ServerLSX:~/NexentaStor-Community-3.0.2# xm create -c nexentastor= -community-3.0.2-xen.cfg =0A> Using config file "./nexentastor-community-3.0.2-xen.cfg". =0A> Error: [Errno 2] No such file or directory: 'vhd:/root/NexentaStor-Com= munity-3.0.2/syspool.img' =0A> =0A> has been brought back under xen-unstable. =0A =0ADoes this work in 4.0-testing ? No.=A0=0A =0AeXeC001er writes ("[Xen-devel] Re: CS 21556 (blktap2: Fix tapdisk diskty= pe issues) is no longer working for "vhd""): =0A> My patch was not quite correct. I waited until the return change back = to =0A> make a new one. =0A> The new patch will be ready today or tomorrow. Let's see how will the =0A> situation was. =0A =0AThanks. =A0As I wrote earlier: =0A =0A =A0Can I ask you to try to (a) separate out these patches, and (b) =0A =A0explain the reasoning behind them in more detail ? =A0If you can =0A =A0provide a separate message with a separate patch for each change, =0A =A0with an explanation at greater length, it will be much easier for us =0A =A0to evaluate them. =A0Thanks. I sent two patches:=A0 1. [PATCH] blktap2: blktap2 and pygrub (xen-unstable)2. [PATCH] blktap/blkt= ap2: Fix for incorrect parse disk configuration (xen-unstable)=0A=A0=0A =0AThanks, =0AIan. Thanks.=A0 =0A=0A=0A=0A --0-1400023371-1278958251=:58966 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
1. [PATCH] blktap2: blktap2= and pygrub (xen-unstable)

diff -r a672af698bc3 tools/python/xen/xen= d/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py &= nbsp;  Fri Jul 09 12:35:58 2010 +0100
+++ b/tools/python/xen/xend/X= endDomainInfo.py    Sun Jul 11 17:16:39 2010 +0400
@@ -32= 61,6 +3261,7 @@
 
     taptype =3D blkdev_un= ame_to_taptype(disk)
     mounted =3D devtype in ['t= ap', 'tap2'] and taptype !=3D 'aio' and taptype !=3D 'sync' and not os.stat= (fn).st_rdev
+         &nbs= p;  mounted_vbd_uuid =3D 0
      &nbs= p;      if mounted:
    &nb= sp;            # Thi= s 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;            &= nbsp; 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']),
+          = ;            &n= bsp;            = ;    BOOTLOADER_LOOPBACK_DEVICE, force =3D True)
              = if blcfg is None:
         =         msg =3D "Had a bootloader specif= ied, but can't find disk"


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

diff -r a672af698bc3 tools/python/xen/util/blkif.py
--- a/tools/python= /xen/util/blkif.py    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 @@
       &= nbsp;         fn =3D "/dev/%s" %(fn= ,)
           &nb= sp;   
         = if typ in ("tap", "tap2"):
-       &n= bsp;    (taptype, fn) =3D fn.split(":", 1)
+  &= nbsp;         if fn.count(":") =3D= =3D 1:
+          &nbs= p;     (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 bo= oting DomU with =0A'mounted-blktap2' (VHD for e= xample) and 'pygrub' as bootloader:
=0A=0A=0A=0A=0A

1. Connect boot-device to Dom0 as '/dev/xpvd'
2.=0A Pygrub get i= nfo for load DomU
3. Disconnect boot-device from =0ADom0
4. Boot DomU

During step 3 =0Acreated device dis= connecting from Dom0, but xenstore does=0A not scrape=0A away after= device disconnected from Dom0 =3D> result: 
=0A= =0A=0A=0A=0A
    "Error: Device /dev/= xvdp (51952, =0Atap2) is already connected."
=0A=0A=0A=0A=0A

<= /div>
During step 3 created device disconnecting from =0ADom0, but 'des= troyDevice' method is passed 'tap' always =3D> result:
  =0A  "Error: Device 51952 not connected"


B= oris.
P.S. It's just a reminder of content been already posted by exeCoo= ler to xen-devel mailing list.

--- On Mon, 7/12/10, eXeC001er = <execooler@gmail.com> wrote:

= From: eXeC001er <execooler@gmail.com>
Subject: Re: [Xen-devel] CS = 21556 (blktap2: Fix tapdisk disktype issues) is no longer working for "vhd= " [and 1 more messages]
To: "Ian Jackson" <Ian.Jackson@eu.citrix.com&= gt;
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.co= m>, "Boris Derzhavets" <bderzhavets@yahoo.com>, "Keir Fraser" <= keir.fraser@eu.citrix.com>
Date: Monday, July 12, 2010, 1:08 PM
2010/7/12 Ian Jackson= <Ian.= Jackson@eu.citrix.com>
=0ABoris Derzhavets writes ("[Xen-devel] CS 21556 (b= lktap2: Fix tapdisk disktype issues) is no longer working for "vhd""):
= =0A> In about the most recent 4-5 days an error :
=0A
=0AThis is r= elated to 21541:7ff0e885b5c3 and 21728:51160a8ecf7d.
=0A
=0A> root= @ServerLSX:~/NexentaStor-Community-3.0.2# xm create -c nexentastor-communit= y-3.0.2-xen.cfg
=0A> Using config file "./nexentastor-community-3.0.2= -xen.cfg".
=0A> Error: [Errno 2] No such file or directory: 'vhd:/roo= t/NexentaStor-Community-3.0.2/syspool.img'
=0A>
=0A> has been b= rought back under xen-unstable.
=0A
=0ADoes this work in 4.0-testing = ?

No.
 
=0A
=0AeXeC001er writes (= "[Xen-devel] Re: CS 21556 (blktap2: Fix tapdisk disktype issues) is no long= er working for "vhd""):
=0A> My patch was not quite correct. I waited= until the return change back to
=0A> make a new one.
=0A> The = new patch will be ready today or tomorrow. Let's see how will the
=0A>= ; situation was.
=0A
=0AThanks.  As I wrote earlier:
=0A
= =0A  Can I ask you to try to (a) separate out these patches, and (b)=0A  explain the reasoning behind them in more detail ?  If you= can
=0A  provide a separate message with a separate patch for each= change,
=0A  with an explanation at greater length, it will be muc= h easier for us
=0A  to evaluate them.  Thanks.

I sent two patches: 

1.= [PATCH] blktap2: blktap2 and pygrub (xen-unstable)
2. [PATCH] bl= ktap/blktap2: Fix for incorrect parse disk configuration (xen-unstable)=0A
 
=0A
=0AThanks,
=0AIan.

Thanks. 

=0A

=0A=0A --0-1400023371-1278958251=:58966-- --===============0349426837== 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 --===============0349426837==--