From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wido den Hollander Subject: Re: Need some help with the RBD Java bindings Date: Thu, 22 Aug 2013 08:20:41 +0200 Message-ID: <5215ADB9.2010607@42on.com> References: <520CF90B.2070106@42on.com> <5214AE76.7070304@42on.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from websrv.42on.com ([31.25.102.167]:46233 "EHLO websrv.42on.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753162Ab3HVGUn (ORCPT ); Thu, 22 Aug 2013 02:20:43 -0400 In-Reply-To: Sender: ceph-devel-owner@vger.kernel.org List-ID: To: Noah Watkins Cc: ceph-devel On 08/21/2013 09:47 PM, Noah Watkins wrote: > Wido, > > How would you feel about creating two RbdSnapInfo objects. The first > would be something like ceph.rbd.RbdSnapInfo and the second would be > ceph.rbd.jna.RbdSnapInfo. The former is what will be exposed through > the API, and the later is used only internally. That should address > the hacky-ness of my snap listing fix: just create a copy of the > SnapInfo into the public struct. it also means we can avoid exposing > users to JNA structures. > Yes, seems like a good thing to do. I wasn't sure myself when I was writing the bindings on how the packaging should be. One of the things I haven't tested thoroughly enough is if you as a user of the bindings are able to crash the JVM. Since that should never happen. Wido > On Wed, Aug 21, 2013 at 5:11 AM, Wido den Hollander wrote: >> On 08/20/2013 11:26 PM, Noah Watkins wrote: >>> >>> Wido, >>> >>> I pushed up a patch to >>> >>> >>> https://github.com/ceph/rados-java/commit/ca16d82bc5b596620609880e429ec9f4eaa4d5ce >>> >>> That includes a fix for this problem. The fix is a bit hacky, but the >>> tests pass now. I included more details about the hack in the code. >>> >> >> I see. Works like a charm for me now. I'll do some further testing with >> CloudStack. >> >> Wido >> >>> On Thu, Aug 15, 2013 at 9:57 AM, Noah Watkins >>> wrote: >>>> >>>> On Thu, Aug 15, 2013 at 8:51 AM, Wido den Hollander >>>> wrote: >>>>> >>>>> >>>>> public List snapList() throws RbdException { >>>>> IntByReference numSnaps = new IntByReference(16); >>>>> PointerByReference snaps = new PointerByReference(); >>>>> List list = new ArrayList(); >>>>> RbdSnapInfo snapInfo, snapInfos[]; >>>>> >>>>> while (true) { >>>>> int r = rbd.rbd_snap_list(this.getPointer(), snaps, numSnaps); >>>> >>>> >>>> I think you need to allocate the memory for `snaps` yourself. Here is >>>> the RBD wrapper for Python which does that: >>>> >>>> self.snaps = (rbd_snap_info_t * num_snaps.value)() >>>> ret = self.librbd.rbd_snap_list(image.image, byref(self.snaps), >>>> byref(num_snaps)) >>>> >>>> - Noah >>> >>> -- >>> >>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in >>> the body of a message to majordomo@vger.kernel.org >>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>> >> >> >> -- >> Wido den Hollander >> 42on B.V. >> >> Phone: +31 (0)20 700 9902 >> Skype: contact42on > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Wido den Hollander 42on B.V. Phone: +31 (0)20 700 9902 Skype: contact42on