Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Neil Soman
committed
Jan 4, 2010
1 parent
a24a416
commit cf0a267
Showing
4 changed files
with
377 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.6.2 | ||
main-equallogic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/EquallogicVolumeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2008, Regents of the University of California | ||
* All rights reserved. | ||
* | ||
* Redistribution and use of this software in source and binary forms, with or | ||
* without modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the | ||
* following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the | ||
* following disclaimer in the documentation and/or other | ||
* materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* Author: Sunil Soman sunils@cs.ucsb.edu | ||
*/ | ||
|
||
package edu.ucsb.eucalyptus.cloud.entities; | ||
|
||
import org.hibernate.annotations.Cache; | ||
import org.hibernate.annotations.CacheConcurrencyStrategy; | ||
|
||
import javax.persistence.*; | ||
|
||
@PersistenceContext(name="eucalyptus_storage") | ||
@Table( name = "EquallogicVolumeInfo" ) | ||
@Entity | ||
@Cache( usage = CacheConcurrencyStrategy.READ_WRITE ) | ||
public class EquallogicVolumeInfo extends LVMVolumeInfo { | ||
private String storeName; | ||
private Integer tid; | ||
private Integer lun; | ||
private String storeUser; | ||
private String encryptedPassword; | ||
|
||
public EquallogicVolumeInfo() {} | ||
|
||
public EquallogicVolumeInfo(String volumeId) { | ||
this.volumeId = volumeId; | ||
} | ||
|
||
public String getStoreName() { | ||
return storeName; | ||
} | ||
|
||
public void setStoreName(String storeName) { | ||
this.storeName = storeName; | ||
} | ||
|
||
public Integer getTid() { | ||
return tid; | ||
} | ||
|
||
public void setTid(Integer tid) { | ||
this.tid = tid; | ||
} | ||
|
||
public Integer getLun() { | ||
return lun; | ||
} | ||
|
||
public void setLun(Integer lun) { | ||
this.lun = lun; | ||
} | ||
|
||
public String getStoreUser() { | ||
return storeUser; | ||
} | ||
|
||
public void setStoreUser(String storeUser) { | ||
this.storeUser = storeUser; | ||
} | ||
|
||
public String getEncryptedPassword() { | ||
return encryptedPassword; | ||
} | ||
|
||
public void setEncryptedPassword(String encryptedPassword) { | ||
this.encryptedPassword = encryptedPassword; | ||
} | ||
} |
273 changes: 273 additions & 0 deletions
273
...dules/storage-controller/src/main/java/edu/ucsb/eucalyptus/storage/EquallogicManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
/******************************************************************************* | ||
*Copyright (c) 2009 Eucalyptus Systems, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, only version 3 of the License. | ||
* | ||
* | ||
* This file is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Please contact Eucalyptus Systems, Inc., 130 Castilian | ||
* Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/> | ||
* if you need additional information or have any questions. | ||
* | ||
* This file may incorporate work covered under the following copyright and | ||
* permission notice: | ||
* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2008, Regents of the University of California | ||
* All rights reserved. | ||
* | ||
* Redistribution and use of this software in source and binary forms, with | ||
* or without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | ||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF | ||
* THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE | ||
* LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS | ||
* SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING | ||
* IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA | ||
* BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN | ||
* THE REGENTS’ DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT | ||
* OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR | ||
* WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH | ||
* ANY SUCH LICENSES OR RIGHTS. | ||
*******************************************************************************/ | ||
/* | ||
* | ||
* Author: Sunil Soman sunils@cs.ucsb.edu | ||
*/ | ||
|
||
package edu.ucsb.eucalyptus.storage; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.util.List; | ||
|
||
import org.apache.commons.io.output.ByteArrayOutputStream; | ||
import org.apache.log4j.Logger; | ||
|
||
import com.eucalyptus.util.EucalyptusCloudException; | ||
import com.jcraft.jsch.Channel; | ||
import com.jcraft.jsch.JSch; | ||
import com.jcraft.jsch.JSchException; | ||
import com.jcraft.jsch.Session; | ||
|
||
public class EquallogicManager implements LogicalStorageManager { | ||
private PSCredentialsManager credentialsManager; | ||
private static EquallogicManager singleton; | ||
private static Logger LOG = Logger.getLogger(EquallogicManager.class); | ||
|
||
public static LogicalStorageManager getInstance( ) { | ||
synchronized ( EquallogicManager.class ) { | ||
if ( singleton == null ) { | ||
singleton = new EquallogicManager( ); | ||
} | ||
} | ||
return singleton; | ||
} | ||
|
||
public EquallogicManager() { | ||
credentialsManager = new PSCredentialsManager(); | ||
} | ||
|
||
@Override | ||
public void addSnapshot(String snapshotId) throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void checkPreconditions() throws EucalyptusCloudException { | ||
credentialsManager.checkConnection(); | ||
} | ||
|
||
@Override | ||
public void cleanSnapshot(String volumeId) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void cleanVolume(String volumeId) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void configure() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public List<String> createSnapshot(String volumeId, String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public void createVolume(String volumeId, int size) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public int createVolume(String volumeId, String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void deleteSnapshot(String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void deleteVolume(String volumeId) throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void dupVolume(String volumeId, String dupedVolumeId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public int getSnapshotSize(String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public List<String> getSnapshotValues(String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<String> getStatus(List<String> volumeSet) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getVolumeProperty(String volumeId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void loadSnapshots(List<String> snapshotSet, | ||
List<String> snapshotFileNames) throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public List<String> prepareForTransfer(String snapshotId) | ||
throws EucalyptusCloudException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public void reload() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void setStorageInterface(String storageInterface) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void startupChecks() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
public class PSCredentialsManager { | ||
private String host; | ||
private String username; | ||
private String password; | ||
|
||
public void checkConnection() throws EucalyptusCloudException { | ||
String show = execCommand("show"); | ||
if(show.length() <= 0) | ||
throw new EucalyptusCloudException("Connection failed."); | ||
} | ||
|
||
public String execCommand(String command) throws EucalyptusCloudException { | ||
try { | ||
JSch jsch = new JSch(); | ||
Session session; | ||
session = jsch.getSession(username, host); | ||
session.setConfig("StrictHostKeyChecking", "no"); | ||
session.setPassword(password); | ||
session.connect(); | ||
Channel channel = session.openChannel("shell"); | ||
channel.setInputStream(new ByteArrayInputStream(command.getBytes())); | ||
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); | ||
channel.setOutputStream(bytesOut); | ||
channel.connect(); | ||
try { | ||
Thread.sleep(700); | ||
} catch (InterruptedException e) { | ||
LOG.error(e); | ||
} | ||
channel.disconnect(); | ||
session.disconnect(); | ||
return bytesOut.toString(); | ||
} catch (JSchException e1) { | ||
LOG.error(e1, e1); | ||
throw new EucalyptusCloudException(e1); | ||
} | ||
} | ||
} | ||
} | ||
|