From owner-freebsd-xen@freebsd.org Fri Mar 4 15:54:14 2016 Return-Path: Delivered-To: freebsd-xen@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBE869DA329 for ; Fri, 4 Mar 2016 15:54:14 +0000 (UTC) (envelope-from prvs=864cd69c8=roger.pau@citrix.com) Received: from SMTP02.CITRIX.COM (smtp02.citrix.com [66.165.176.63]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mail.citrix.com", Issuer "Verizon Public SureServer CA G14-SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FF6FDD6 for ; Fri, 4 Mar 2016 15:54:14 +0000 (UTC) (envelope-from prvs=864cd69c8=roger.pau@citrix.com) X-IronPort-AV: E=Sophos;i="5.22,536,1449532800"; d="scan'208";a="343237847" Date: Fri, 4 Mar 2016 16:54:10 +0100 From: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= X-X-Sender: royger@mac To: =?UTF-8?Q?Gustau_P=C3=A9rez?= CC: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , FreeBSD XEN Subject: Re: Porting the block-iscsi hotplug script In-Reply-To: <56D97762.7000908@gmail.com> Message-ID: References: <553DEB97.5000300@entel.upc.edu> <555EF542.3090002@citrix.com> <555F9B3F.1000600@entel.upc.edu> <55602512.1090702@citrix.com> <56C6FA2F.8040900@gmail.com> <56CAC8CB.8030107@gmail.com> <56CADEDA.4050007@citrix.com> <56CB0057.1060509@gmail.com> <56CB041E.1020009@citrix.com> <56CB2D90.5080809@gmail.com> <56CB34BA.6060809@citrix.com> <56CC24BD.6050609@gmail.com> <56CC32E5.5010101@citrix.com> <56CC7637.3080408@gmail.com> <56CF5668.6090605@citrix.com> <56D0091F.80408@gmail.com> <56D02863.7040100@citrix.com> <56D03D95.9090509@gmail.com> <56D04E5F.8070901@citrix.com> <56D42A28.8050701@gmail.com> <56D434FC.8030905@citrix.com> <56D57110.2060406@gmail.com> <56D587D8.6030702@citrix.com> <56D590EA.609@gmail.com> <56D591BA.4020303@gmail.com> <56D5929F.7040001@citrix.com> <56D5C722.3080205@gmail.com> <56D6B68D.8080809@citrix.com> <56D7FEFE.9050000@gmail.com> <56D97762.7000908@gmail.com> User-Agent: Alpine 2.20 (OSX 67 2015-01-07) MIME-Version: 1.0 X-DLP: MIA1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 15:54:15 -0000 On Fri, 4 Mar 2016, Gustau Pérez wrote: > El 4/03/16 a les 11:00, Roger Pau Monné ha escrit: > > > > What other parameters do you want to pass to your script that cannot be > > fetched from xenstore? IMHO I was planning to only pass the xenstore > > backend node and the action. > > The action (if I understand it correctly) is already there. Yes, the xenstore backend path is $1 and the action $2. > > OTOH, I'd like to check if the disks are already in use, and so I'd > need to walk the /local/domain/0/backend/vbd/$domin/$devid/ looking if > the disks are already there. This arises two questions: > > * can I assume the domain0 store would always be /local/domain/0/? Hm, I wouldn't be on it. This is true in the most common scenario, where Dom0 (domain with id 0) runs all the backends. But if you are using a driver domain or a radically disagregated system (where control domain != hardware domain) this is no longer true. So in general you shouldn't make this assumption. > * would I need to walk for each $domid checking for each $devid and > getting the physical device? Linux already has some code to do this checking, but this also involves taking a lock in order to make sure there's only one hotplug script performing this check at the same time. The Linux function that performs this checking is in: http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/hotplug/Linux/block;h=2691b56951c9b82094471a141b9e0bed04abb929;hb=HEAD#l40 And the caller is: http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/hotplug/Linux/block;h=2691b56951c9b82094471a141b9e0bed04abb929;hb=HEAD#l275 If you take a look, the call to check_device_sharing is protected with the "block" lock. Roger.