Porting the block-iscsi hotplug script
Roger Pau Monné
roger.pau at citrix.com
Fri Mar 4 15:54:15 UTC 2016
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.
More information about the freebsd-xen
mailing list