Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Getting Xen to go along with LVM



Manuel Bouyer wrote:
On Mon, Nov 09, 2009 at 06:48:21PM +0000, Hugo Silva wrote:
[...]
dmesg:
xbdback backend/vbd/1/1: can't DIOCGPART device 0xa901: 12 // <------- ?

OK, that's the problem. Maybe xbdback should try DIOCGDISKINFO
in this case. Sorry, I can't look at a patch right now ...

proplib(3) things are obscure to me. IIUC, the VOP_IOCTL() for the devmapper associated to DIOCGDISKINFO returns an externalized form of the disk-info prop_dictionary_t, namely, a struct plistref.

I can't manage to find how I can get the "block-count" key out of it. I would need some kind of prop_dictionary_internalize, to turn this externalized form into a proplib object.

Attached is an ugly patch, untested. Caution, applying it will render all disklabel-based partitions unsuitable for xbd backend as is, it replaces the DIOCGPART ioctl() with the DIOCGDISKINFO one. It is likely that it will panic() the dom0 as well upon domU create.

--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: arch/xen/xen/xbdback_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xbdback_xenbus.c,v
retrieving revision 1.24.2.1
diff -u -u -r1.24.2.1 xbdback_xenbus.c
--- arch/xen/xen/xbdback_xenbus.c       1 Nov 2009 13:58:47 -0000       1.24.2.1
+++ arch/xen/xen/xbdback_xenbus.c       9 Nov 2009 22:19:16 -0000
@@ -741,23 +741,35 @@
                    xbdi->xbdi_domid);
        } else {
                /* disk device, get partition data */
-               struct partinfo dpart;
-               err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGPART, &dpart, FREAD, 0);
+               struct plistref pref;
+               err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGDISKINFO, &pref, FREAD,
+                               NOCRED);
                if (err) {
-                       printf("xbdback %s: can't DIOCGPART device 0x%"PRIx64": 
%d\n",
+                       printf("xbdback %s: can't DIOCGDISKINFO device "
+                           "0x%"PRIx64": %d\n",
                            xbusd->xbusd_path, xbdi->xbdi_dev, err);
                        xbdi->xbdi_size = xbdi->xbdi_dev = 0;
                        vn_close(xbdi->xbdi_vp, FREAD, NOCRED);
                        xbdi->xbdi_vp = NULL;
                        return;
                }
-               xbdi->xbdi_size = dpart.part->p_size;
+               prop_dictionary_t dict;
+               dict = prop_dictionary_internalize(pref.pref_plist);
+               prop_dictionary_get_uint64(dict, "block-count",
+                   &xbdi->xbdi_size);
+               /*
                printf("xbd backend: attach device %s%"PRId32
                    "%c (size %" PRIu64 ") for domain %d\n",
                    devname, DISKUNIT(xbdi->xbdi_dev),
                    (char)DISKPART(xbdi->xbdi_dev) + 'a', xbdi->xbdi_size,
                    xbdi->xbdi_domid);
-       }
+                   */
+       
+               printf("xbd backend: attach device %s"
+                   "(size %" PRIu64 ") for domain %d\n",
+                   devname, xbdi->xbdi_size,
+                   xbdi->xbdi_domid);
+               }
 again:
        xbt = xenbus_transaction_start();
        if (xbt == NULL) {


Home | Main Index | Thread Index | Old Index