cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damoder Reddy <Damoder.Re...@citrix.com>
Subject RE: [PROPOSAL] Add getPathSeparator() to DataStoreTO.java
Date Mon, 19 May 2014 05:28:45 GMT
Any thoughts on below proposal??

Thanks & Regards
Damodar/

-----Original Message-----
From: Damoder Reddy [mailto:Damoder.Reddy@citrix.com] 
Sent: Tuesday, May 13, 2014 10:54 PM
To: dev@cloudstack.apache.org
Cc: Min Chen; Edison Su
Subject: [PROPOSAL] Add getPathSeparator() to DataStoreTO.java

Hi,

While working on windowsfication of management server, I found the issues when creating a
template from a ROOT disk snapshot. 
It is not able to create template out of that snapshot due to the snapshot path we are constructing
before creating template is using "File.Separator" and on windows it would be "\" instead
of "/". Due to this the template creation is failing from snapshot when management server
is running on windows.

Code snippet example is

String snapshotInstallPath = snapshot.getPath();
            int index = snapshotInstallPath.lastIndexOf(File.separator);
            String snapshotName = snapshotInstallPath.substring(index + 1);

            if (!snapshotName.startsWith("VHD-") && !snapshotName.endsWith(".vhd"))
{
                snapshotInstallPath = snapshotInstallPath + ".vhd";
            }
            URI snapshotURI = new URI(secondaryStorageUrl + File.separator + snapshotInstallPath);
            String snapshotPath = snapshotURI.getHost() + ":" + snapshotURI.getPath();

To fix this problem I am proposing the following solution.

The path separator is specific to the file system(NFS, samba etc..) we are using as a secondary
storage on SSVM. Instead of using File.separator in the path, we can add a method say "getPathSeparator()"
to "DataStoreTO.java" which is implemented by several file systems. And we will replace "File.separator"
with the above method call at all respective places.

Anybody see any problems or any other better approach can think of here?

Is this the only place we need to do changes or any other places also changes are required
to achieve this?

Thanks & Regards
Damodar/


Mime
View raw message