On Tue, May 06, 2008 at 03:37:04PM +0200, Stefan de Konink wrote:
On Tue, 6 May 2008, Daniel P. Berrange wrote:
> > /* Now figure out the stable path
> > *
> > * XXX this method is O(N) because it scans the pool target
> > * dir every time its run. Should figure out a more efficient
> > * way of doing this...
> > */
> > if ((vol->target.path = virStorageBackendStablePath(conn,
> > pool,
> > devpath)) == NULL)
> > goto cleanup;
> >
> > if (devpath != vol->target.path)
> > free(devpath);
> > devpath = NULL;
> >
> > What are you trying to 'check' here?
>
> It is checking whether the input path (eg '/dev/sdf') is the same as the
> returned path. If not, then it free's the original inpujt path since it
> is now unused.
But is this input path the target path that is in the examples online (as
last xmlnode)?
The 'devpath' parameter to virStorageBackendStablePath() is the path of the
LUN in question, typically eg, /dev/sdg. The 'pool' object has an internal
attribute which is the 'target' element from the pool XML, eg
'/dev/disk/by-path'.
The virStorageBackendStablePath(), then iterates over all the entries in
'/dev/disk/by-path' to find the one matching (symlinking to) '/dev/sdg'
and returns it, eg
/dev/disk/by-path/ip-172.16.103.200:3260-iscsi-iqn.1992-08.com.netapp:sn.118046347:vf.88fa4694-0ba6-11dd-b8a9-00a09807592f-lun-1034
but if it doesn't find a matching symlink then it just returns the original
string '/dev/sdg'.
The latter scenario is depressingly common because soo many distros (including
RHEL-5) have broken udev rules for iSCSI. Its only since Fedora 8 that they
work properly for me
Dan
--
|: Red Hat, Engineering, Boston -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|