Skip to contentSkip to conversation

blktap2: blktap2 and pygrub (xen-unstable)

PATCH Applied Boris Derzhavets 4 participants 5 messages Aug 1, 2010 – Nov 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blktap2: blktap2 and pygrub (xen-unstable)

Forwarding to you original patch requested.
It works for me.

Boris

--- On Sun, 7/11/10, eXeC001er <[email protected]> wrote:

From: eXeC001er <[email protected]>
Subject: [Xen-devel] [PATCH] blktap2: blktap2 and pygrub (xen-unstable)
To: "Xen-devel" <[email protected]>
Date: Sunday, July 11, 2010, 9:18 AM

1. Bug fix for error: "Error: Device /dev/xvdp (51952, tap2) is already connected."2. Bug fix for error: "Error: Device 51952 not connected"

process of booting DomU with 'mounted-blktap2' (VHD for example) and 'pygrub' as bootloader:

1. Connect boot-device to Dom0 as '/dev/xpvd'2. Pygrub get info for load DomU3. Disconnect boot-device from Dom04. Boot DomU During step 3 created device disconnecting from Dom0, but xenstore does not scrape away after device disconnected from Dom0 => result:

    "Error: Device /dev/xvdp (51952, tap2) is already connected."

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

-----Inline Attachment Follows-----

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

tools/python/xen/xend/XendDomainInfo.py +6 -3
diff -r a672af698bc3 tools/python/xen/xend/XendDomainInfo.py
@@ -3261,6 +3261,7 @@
 
             taptype = blkdev_uname_to_taptype(disk)
             mounted = devtype in ['tap', 'tap2'] and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
+            mounted_vbd_uuid = 0
             if mounted:
                 # This is a file, not a device.  pygrub can cope with a
                 # file if it's raw, but if it's QCOW or other such formats
@@ -3276,7 +3277,8 @@
 
                 from xen.xend import XendDomain
                 dom0 = XendDomain.instance().privilegedDomain()
-                dom0._waitForDeviceUUID(dom0.create_vbd(vbd, disk))
+                mounted_vbd_uuid = dom0.create_vbd(vbd, disk);
+                dom0._waitForDeviceUUID(mounted_vbd_uuid)
                 fn = BOOTLOADER_LOOPBACK_DEVICE
 
             try:
@@ -3286,8 +3288,9 @@
                 if mounted:
                     log.info("Unmounting %s from %s." %
                              (fn, BOOTLOADER_LOOPBACK_DEVICE))
-
-                    dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+                    _, vbd_info = dom0.info['devices'][mounted_vbd_uuid]
+                    dom0.destroyDevice(dom0.getBlockDeviceClass(vbd_info['devid']), 
+                                       BOOTLOADER_LOOPBACK_DEVICE, force = True)
 
             if blcfg is None:
                 msg = "Had a bootloader specified, but can't find disk"

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

#1 lore raw
Quoted 23 lines · Boris Derzhavets

Forwarding to you original patch requested. It works for me.

Boris

--- On Sun, 7/11/10, eXeC001er <[email protected]> wrote:

From: eXeC001er <[email protected]>
Subject: [Xen-devel] [PATCH] blktap2: blktap2 and pygrub (xen-unstable)
To: "Xen-devel" <[email protected]>
Date: Sunday, July 11, 2010, 9:18 AM

1. Bug fix for error: "Error: Device /dev/xvdp (51952, tap2) is already connected."
2. Bug fix for error: "Error: Device 51952 not connected"

process of booting DomU with 'mounted-blktap2' (VHD for example) and 'pygrub' 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

Quoted 7 lines

During step 3 created device disconnecting from Dom0, but xenstore does not scrape away after device disconnected from Dom0 => result:
    "Error: Device /dev/xvdp (51952, tap2) is already connected."

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

applied, thanks

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

#2 lore raw
Quoted 30 lines · On Monday 16 August 2010 18:35:10 Stefano Stabellini wrote:
Quoted 29 lines · Boris Derzhavets

Forwarding to you original patch requested.
It works for me.

Boris

--- On Sun, 7/11/10, eXeC001er <[email protected]> wrote:
From: eXeC001er <[email protected]>
Subject: [Xen-devel] [PATCH] blktap2: blktap2 and pygrub (xen-unstable) To: "Xen-devel" <[email protected]>
Date: Sunday, July 11, 2010, 9:18 AM

1. Bug fix for error: "Error: Device /dev/xvdp (51952, tap2) is already connected."

2. Bug fix for error: "Error: Device 51952 not connected"

process of booting DomU with 'mounted-blktap2' (VHD for example) and 'pygrub' 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 => result:
"Error: Device /dev/xvdp (51952, tap2) is already connected."

Quoted 5 lines
Quoted 3 lines

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

applied, thanks

Could you merge it also to Xen 4.0? Without this patch I can not use vhd + pygrub. In Xen-unstable it was added in commit cd5b4135fe03.

Regards,

Łukasz Oleś

#3 lore raw

2010/11/1 Łukasz Oleś <[email protected]>:

Quoted 31 lines · On Monday 16 August 2010 18:35:10 Stefano Stabellini wrote:
Quoted 30 lines · Boris Derzhavets
Quoted 29 lines

Forwarding to you original patch requested.
It works for me.

Boris

--- On Sun, 7/11/10, eXeC001er <[email protected]> wrote:
      From: eXeC001er <[email protected]>
      Subject: [Xen-devel] [PATCH] blktap2: blktap2 and pygrub (xen-unstable) To: "Xen-devel" <[email protected]>
      Date: Sunday, July 11, 2010, 9:18 AM

      1. Bug fix for error: "Error: Device /dev/xvdp (51952, tap2) is already connected."

2. Bug fix for error: "Error: Device 51952 not connected"

process of booting DomU with 'mounted-blktap2' (VHD for example) and 'pygrub' 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 => result:
    "Error: Device /dev/xvdp (51952, tap2) is already connected."

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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

applied, thanks

Could you merge it also to Xen 4.0? Without this patch I can not use vhd + pygrub. In  Xen-unstable it was added in commit cd5b4135fe03.

ping

Signature · 1 line
Łukasz Oleś
#4 lore raw

Hello,

Am Montag 08 November 2010 13:40:29 schrieb Łukasz Oleś:

Quoted 5 lines

2010/11/1 Łukasz Oleś <[email protected]>:

Quoted 4 lines · On Monday 16 August 2010 18:35:10 Stefano Stabellini wrote:
Quoted 3 lines · Boris Derzhavets
Quoted 2 lines

Forwarding to you original patch requested.
It works for me.

For me to, but I observed some kind of race condition probably between udev creating the device node and pygrub acessing it: The first start of my domain failed with "Disk isn't accessible", while subsequent starts worked fine. I could reproduce this after doing a reboot: 1st start failed, further starts worked fine.
After adding the following hack it even worked on a freshly rebooted system. (For my case the loop always exited on the second iteration.)

--- a/xen-4.0.1/tools/python/xen/xend/XendBootloader.py 2010-11-01 15:33:59.000000000 +0100
+++ b/xen-4.0.1/tools/python/xen/xend/XendBootloader.py 2010-11-11 13:36:13.000000000 +0100
@@ -15,6 +15,7 @@
import os, select, errno, stat, signal, tty
import random
import shlex
+import time
from xen.xend import sxp

from xen.util import mkdir, oshelp
@@ -35,13 +36,18 @@
@param blargs Arguments to pass to the bootloader."""

if not os.access(blexec, os.X_OK):
- msg = "Bootloader isn't executable"
+ msg = "Bootloader '%s' isn't executable" % blexec
log.error(msg)
raise VmError(msg)
- if not os.access(disk, os.R_OK):
+
+ retries = 10
+ while not os.access(disk, os.R_OK):
- msg = "Disk isn't accessible"
+ msg = "Disk '%s' isn't accessible" % disk
log.error(msg)

-        raise VmError(msg)
+        time.sleep(1)
+        retries -= 1
+        if retries <= 0:

+ raise VmError(msg)

     if os.uname()[0] == "NetBSD" and disk.startswith('/dev/'):
        disk = disk.replace("/dev/", "/dev/r")

BYtE
Philipp

Signature · 4 lines
Philipp Hahn           Open Source Software Engineer      [email protected]   
Univention GmbH        Linux for Your Business        fon: +49 421 22 232- 0
Mary-Somerville-Str.1  28359 Bremen                   fax: +49 421 22 232-99
                                                    http://www.univention.de

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