* [PATCH] vscsi and symlinks
@ 2011-02-07 1:24 James Harper
2011-02-07 8:51 ` Ian Campbell
2011-02-07 16:22 ` [PATCH] vscsi and symlinks Ian Jackson
0 siblings, 2 replies; 8+ messages in thread
From: James Harper @ 2011-02-07 1:24 UTC (permalink / raw)
To: xen-devel
By default, vscsi expects to be passed the final device name (eg
/dev/st3) instead of one of the various udev symlinks (eg
/dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following patch
resolves the path to the real path if the name starts with /dev/
James
--- a/tools/python/xen/util/vscsi_util.py 2010-12-03 23:26:46.391655087
+1100
+++ b/tools/python/xen/util/vscsi_util.py 2011-02-07 12:20:37.599527204
+1100
@@ -158,6 +158,8 @@
def vscsi_get_hctl_and_devname_by(target, scsi_devices = None):
+ if target.startswith('/dev/'):
+ target = os.path.realpath(target)
if scsi_devices is None:
if len(target.split(':')) == 4:
scsi_devices = _vscsi_get_scsidevices_by_lsscsi(target)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vscsi and symlinks
2011-02-07 1:24 [PATCH] vscsi and symlinks James Harper
@ 2011-02-07 8:51 ` Ian Campbell
[not found] ` <864CFF73-782A-443F-86E4-4D8CFB2607C1@bendigoit.com.au>
2011-02-07 16:22 ` [PATCH] vscsi and symlinks Ian Jackson
1 sibling, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2011-02-07 8:51 UTC (permalink / raw)
To: James Harper; +Cc: xen-devel
On Mon, 2011-02-07 at 01:24 +0000, James Harper wrote:
> By default, vscsi expects to be passed the final device name (eg
> /dev/st3) instead of one of the various udev symlinks (eg
> /dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following patch
> resolves the path to the real path if the name starts with /dev/
This needs a signed-off-by.
> James
>
> --- a/tools/python/xen/util/vscsi_util.py 2010-12-03 23:26:46.391655087
> +1100
> +++ b/tools/python/xen/util/vscsi_util.py 2011-02-07 12:20:37.599527204
> +1100
> @@ -158,6 +158,8 @@
>
>
> def vscsi_get_hctl_and_devname_by(target, scsi_devices = None):
> + if target.startswith('/dev/'):
> + target = os.path.realpath(target)
Any reason not to just unconditionally resolve symlinks in every target
to the underlying device?
Thanks,
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vscsi and symlinks
[not found] ` <864CFF73-782A-443F-86E4-4D8CFB2607C1@bendigoit.com.au>
@ 2011-02-07 10:17 ` Ian Campbell
2011-02-07 11:28 ` James Harper
0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2011-02-07 10:17 UTC (permalink / raw)
To: James Harper; +Cc: xen-devel
(Adding xen-devel back since I guess you didn't mean to drop)
On Mon, 2011-02-07 at 09:43 +0000, James Harper wrote:
> I think target isn't always a file. It can be a scsi ID like 0:1:2:3.
> I think it can be other types of specifier too.
OK. So perhaps:
if os.path.islink(target):
target = os.path.realpath(target)
?
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vscsi and symlinks
2011-02-07 10:17 ` Ian Campbell
@ 2011-02-07 11:28 ` James Harper
2011-02-07 11:30 ` Ian Campbell
0 siblings, 1 reply; 8+ messages in thread
From: James Harper @ 2011-02-07 11:28 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
>
> On Mon, 2011-02-07 at 09:43 +0000, James Harper wrote:
> > I think target isn't always a file. It can be a scsi ID like 0:1:2:3.
> > I think it can be other types of specifier too.
>
> OK. So perhaps:
>
> if os.path.islink(target):
> target = os.path.realpath(target)
>
I guess. I know it's a long shot but what if there was a symlink called 0:1:2:3? While that is unlikely, there might be other incantations used by vscsi that could ambiguously be the filename of a symlink or not. I'd be happier if realpath was only used if an absolute path was specified. Who's going to want to specify a relative path anyway... what would it be relative to?
James
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vscsi and symlinks
2011-02-07 11:28 ` James Harper
@ 2011-02-07 11:30 ` Ian Campbell
2011-02-08 16:36 ` [PATCH] vscsi and symlinks [and 1 more messages] Ian Jackson
0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2011-02-07 11:30 UTC (permalink / raw)
To: James Harper; +Cc: xen-devel
On Mon, 2011-02-07 at 11:28 +0000, James Harper wrote:
> >
> > On Mon, 2011-02-07 at 09:43 +0000, James Harper wrote:
> > > I think target isn't always a file. It can be a scsi ID like 0:1:2:3.
> > > I think it can be other types of specifier too.
> >
> > OK. So perhaps:
> >
> > if os.path.islink(target):
> > target = os.path.realpath(target)
> >
>
> I guess. I know it's a long shot but what if there was a symlink
> called 0:1:2:3? While that is unlikely, there might be other
> incantations used by vscsi that could ambiguously be the filename of a
> symlink or not. I'd be happier if realpath was only used if an
> absolute path was specified. Who's going to want to specify a relative
> path anyway... what would it be relative to?
Yes, good points. I guess we could go with target[0] == '/' but I think
you are right to go with the conservative approach of checking for /dev/
unless/until someone shows up with a bug suggesting we do otherwise.
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vscsi and symlinks
2011-02-07 1:24 [PATCH] vscsi and symlinks James Harper
2011-02-07 8:51 ` Ian Campbell
@ 2011-02-07 16:22 ` Ian Jackson
2011-02-08 0:28 ` James Harper
1 sibling, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2011-02-07 16:22 UTC (permalink / raw)
To: James Harper; +Cc: xen-devel
James Harper writes ("[Xen-devel] [PATCH] vscsi and symlinks"):
> By default, vscsi expects to be passed the final device name (eg
> /dev/st3) instead of one of the various udev symlinks (eg
> /dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following patch
> resolves the path to the real path if the name starts with /dev/
Thanks. I would have applied this patch but you didn't provide a
"signed-off-by", to confirm that your contribution is in accordance
with the Developer's Certificate of Origin.
>From Documentation/SubmittingPatches in the Linux kernel tree:
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vscsi and symlinks
2011-02-07 16:22 ` [PATCH] vscsi and symlinks Ian Jackson
@ 2011-02-08 0:28 ` James Harper
0 siblings, 0 replies; 8+ messages in thread
From: James Harper @ 2011-02-08 0:28 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel
With signed-off-by line :)
By default, vscsi expects to be passed the final device name (eg
/dev/st3) instead of one of the various udev symlinks (eg
/dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following patch
resolves the path to the real path if the name starts with /dev/
Signed-off-by: James Harper <james.harper@bendigoit.com.au>
--- a/tools/python/xen/util/vscsi_util.py 2010-12-03 23:26:46.391655087
+1100
+++ b/tools/python/xen/util/vscsi_util.py 2011-02-07 12:20:37.599527204
+1100
@@ -158,6 +158,8 @@
def vscsi_get_hctl_and_devname_by(target, scsi_devices = None):
+ if target.startswith('/dev/'):
+ target = os.path.realpath(target)
if scsi_devices is None:
if len(target.split(':')) == 4:
scsi_devices = _vscsi_get_scsidevices_by_lsscsi(target)
> -----Original Message-----
> From: Ian Jackson [mailto:Ian.Jackson@eu.citrix.com]
> Sent: Tuesday, 8 February 2011 03:23
> To: James Harper
> Cc: xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH] vscsi and symlinks
>
> James Harper writes ("[Xen-devel] [PATCH] vscsi and symlinks"):
> > By default, vscsi expects to be passed the final device name (eg
> > /dev/st3) instead of one of the various udev symlinks (eg
> > /dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following
patch
> > resolves the path to the real path if the name starts with /dev/
>
> Thanks. I would have applied this patch but you didn't provide a
> "signed-off-by", to confirm that your contribution is in accordance
> with the Developer's Certificate of Origin.
>
> From Documentation/SubmittingPatches in the Linux kernel tree:
>
> Developer's Certificate of Origin 1.1
>
> By making a contribution to this project, I certify that:
>
> (a) The contribution was created in whole or in part by me and
I
> have the right to submit it under the open source license
> indicated in the file; or
>
> (b) The contribution is based upon previous work that, to the
best
> of my knowledge, is covered under an appropriate open
source
> license and I have the right under that license to submit
that
> work with modifications, whether created in whole or in
part
> by me, under the same open source license (unless I am
> permitted to submit under a different license), as
indicated
> in the file; or
>
> (c) The contribution was provided directly to me by some other
> person who certified (a), (b) or (c) and I have not
modified
> it.
>
> (d) I understand and agree that this project and the
contribution
> are public and that a record of the contribution
(including all
> personal information I submit with it, including my
sign-off) is
> maintained indefinitely and may be redistributed
consistent with
> this project or the open source license(s) involved.
>
> Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vscsi and symlinks [and 1 more messages]
2011-02-07 11:30 ` Ian Campbell
@ 2011-02-08 16:36 ` Ian Jackson
0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2011-02-08 16:36 UTC (permalink / raw)
To: James Harper, Ian Campbell; +Cc: xen-devel
James Harper writes ("RE: [Xen-devel] [PATCH] vscsi and symlinks"):
> With signed-off-by line :)
>
> By default, vscsi expects to be passed the final device name (eg
> /dev/st3) instead of one of the various udev symlinks (eg
> /dev/tape/by-path/pci-0000:01:08.0-scsi-0:0:2:0-st). The following patch
> resolves the path to the real path if the name starts with /dev/
Thanks, applied.
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-02-08 16:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 1:24 [PATCH] vscsi and symlinks James Harper
2011-02-07 8:51 ` Ian Campbell
[not found] ` <864CFF73-782A-443F-86E4-4D8CFB2607C1@bendigoit.com.au>
2011-02-07 10:17 ` Ian Campbell
2011-02-07 11:28 ` James Harper
2011-02-07 11:30 ` Ian Campbell
2011-02-08 16:36 ` [PATCH] vscsi and symlinks [and 1 more messages] Ian Jackson
2011-02-07 16:22 ` [PATCH] vscsi and symlinks Ian Jackson
2011-02-08 0:28 ` James Harper
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.