Changes since V1: - Derive the remotePath from self.mountpoint instead of using the metadata
The current method for gathering a LOCALFS Storage Domain's remotePath property does not work because these domains are connected with a symlink, not a mount. Fix up the current code so that it handles links and mountpoints.
In the code I have noticed some sentiments that path information should be removed from the storage domain metadata. I strongly disagree with this idea. The path is a critical piece of information. End users will care a lot about the path because it is where their images are located. This informaton is also useful for calling connectStorageServer() and disconnectStorageServer().
Signed-off-by: Adam Litke agl@us.ibm.com
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index 35f7ab3..e904bfe 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -38,7 +38,9 @@ import time REMOTE_PATH = "REMOTE_PATH"
FILE_SD_MD_FIELDS = sd.SD_MD_FIELDS.copy() -# TBD: Do we really need this key? +# Do we really need this key? +# Answer: Yes. The path is an important part of the SD metadata and is useful +# information for end-users. It can also be used to manage storage connections. FILE_SD_MD_FIELDS[REMOTE_PATH] = (str, str)
def getDomUuidFromMetafilePath(metafile): @@ -224,6 +226,19 @@ class FileStorageDomain(sd.StorageDomain): def getRemotePath(self): return self.remotePath
+ def mountToRemotePath(self): + """ + Get the remote path based on the storage mountpoint. + Handle symlinks and mounts. + """ + if os.path.islink(self.mountpoint): + return os.readlink(self.mountpoint) + elif os.path.isdir(self.mountpoint): + for mount in fileUtils.getMounts(): + if self.mountpoint == mount[1]: + return mount[0] + return '' + def getInfo(self): """ Get storage domain info @@ -232,13 +247,7 @@ class FileStorageDomain(sd.StorageDomain): # First call parent getInfo() - it fills in all the common details info = sd.StorageDomain.getInfo(self) # Now add fileSD specific data - info['remotePath'] = '' - mounts = fileUtils.getMounts() - for mount in mounts: - if self.mountpoint == mount[1]: - info['remotePath'] = mount[0] - break - + info['remotePath'] = self.mountToRemotePath() return info
def getStats(self):
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 19:25 PM To: vdsm-devel@lists.fedorahosted.org Subject: fileSD: Fix remotePath in SD metadata (V2)
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the
metadata
Any reason the patches are being sent here, rather than to vdsm-patches?
The current method for gathering a LOCALFS Storage Domain's remotePath
property
does not work because these domains are connected with a symlink, not a
mount.
Fix up the current code so that it handles links and mountpoints.
In the code I have noticed some sentiments that path information should
be
removed from the storage domain metadata. I strongly disagree with this
idea.
The path is a critical piece of information. End users will care a lot
about
the path because it is where their images are located. This informaton
is also
useful for calling connectStorageServer() and disconnectStorageServer().
Signed-off-by: Adam Litke agl@us.ibm.com
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index 35f7ab3..e904bfe 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -38,7 +38,9 @@ import time REMOTE_PATH = "REMOTE_PATH"
FILE_SD_MD_FIELDS = sd.SD_MD_FIELDS.copy() -# TBD: Do we really need this key? +# Do we really need this key? +# Answer: Yes. The path is an important part of the SD metadata and is
useful
+# information for end-users. It can also be used to manage storage
connections.
FILE_SD_MD_FIELDS[REMOTE_PATH] = (str, str)
def getDomUuidFromMetafilePath(metafile): @@ -224,6 +226,19 @@ class FileStorageDomain(sd.StorageDomain): def getRemotePath(self): return self.remotePath
- def mountToRemotePath(self):
"""
Get the remote path based on the storage mountpoint.
Handle symlinks and mounts.
"""
if os.path.islink(self.mountpoint):
return os.readlink(self.mountpoint)
elif os.path.isdir(self.mountpoint):
for mount in fileUtils.getMounts():
if self.mountpoint == mount[1]:
return mount[0]
return ''
- def getInfo(self): """ Get storage domain info
@@ -232,13 +247,7 @@ class FileStorageDomain(sd.StorageDomain): # First call parent getInfo() - it fills in all the common
details
info = sd.StorageDomain.getInfo(self) # Now add fileSD specific data
info['remotePath'] = ''
mounts = fileUtils.getMounts()
for mount in mounts:
if self.mountpoint == mount[1]:
info['remotePath'] = mount[0]
break
info['remotePath'] = self.mountToRemotePath() return info
def getStats(self):
-- Adam Litke agl@us.ibm.com IBM Linux Technology Center _______________________________________________ vdsm-devel mailing list vdsm-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/vdsm-devel
On Tue, Sep 27, 2011 at 12:37:19PM -0400, Itamar Heim wrote:
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 19:25 PM To: vdsm-devel@lists.fedorahosted.org Subject: fileSD: Fix remotePath in SD metadata (V2)
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the
metadata
Any reason the patches are being sent here, rather than to vdsm-patches?
vdsm-patches appears to be the output of a program. Is this gerrit? I guess I just assumed that my patch would appear there once someone entered it into that system. I believe I am making the first non-Red Hat contribution. What is the correct public patch submission process?
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 21:02 PM To: VDSM Project Development Subject: Re: fileSD: Fix remotePath in SD metadata (V2)
On Tue, Sep 27, 2011 at 12:37:19PM -0400, Itamar Heim wrote:
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 19:25 PM To: vdsm-devel@lists.fedorahosted.org Subject: fileSD: Fix remotePath in SD metadata (V2)
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the
metadata
Any reason the patches are being sent here, rather than to
vdsm-patches?
vdsm-patches appears to be the output of a program. Is this gerrit? I
guess I
just assumed that my patch would appear there once someone entered it
into that
system. I believe I am making the first non-Red Hat contribution. What
is the
correct public patch submission process?
Well, pushing via gerrit, once we get the public one going. Idea is patches are discussed on vdsm-patches, and non patch issues here (a discussion on a patch may go here if foundational I guess)
-- Adam Litke agl@us.ibm.com IBM Linux Technology Center _______________________________________________ vdsm-devel mailing list vdsm-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/vdsm-devel
On Tue, Sep 27, 2011 at 03:04:18PM -0400, Itamar Heim wrote:
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 21:02 PM To: VDSM Project Development Subject: Re: fileSD: Fix remotePath in SD metadata (V2)
On Tue, Sep 27, 2011 at 12:37:19PM -0400, Itamar Heim wrote:
-----Original Message----- From: vdsm-devel-bounces@lists.fedorahosted.org
[mailto:vdsm-devel-bounces@lists.fedorahosted.org] On
Behalf Of Adam Litke Sent: Tuesday, September 27, 2011 19:25 PM To: vdsm-devel@lists.fedorahosted.org Subject: fileSD: Fix remotePath in SD metadata (V2)
Changes since V1:
- Derive the remotePath from self.mountpoint instead of using the
metadata
Any reason the patches are being sent here, rather than to
vdsm-patches?
vdsm-patches appears to be the output of a program. Is this gerrit? I
guess I
just assumed that my patch would appear there once someone entered it
into that
system. I believe I am making the first non-Red Hat contribution. What
is the
correct public patch submission process?
Well, pushing via gerrit, once we get the public one going. Idea is patches are discussed on vdsm-patches, and non patch issues here (a discussion on a patch may go here if foundational I guess)
Ok. I will resend it to vdsm-patches for the time being.
vdsm-devel@lists.fedorahosted.org