bug 8194: add new storage pool type PreSetup,

1. user setup SR for xenserver pool
2. in UI, add a new storage pool as PreSetup
   server: "ip of storage "
   path:"name of the SR"
This commit is contained in:
anthony 2011-02-02 19:29:44 -08:00
parent 4ea260cafd
commit b226861783
4 changed files with 14 additions and 4 deletions

View File

@ -94,7 +94,9 @@ public class Storage {
ISO(false), // for iso image
LVM(false), // XenServer local LVM SR
SharedMountPoint(true),
VMFS(true); // VMware VMFS storage
VMFS(true), // VMware VMFS storage
PreSetup(true); // for XenServer, Storage Pool is set up by customers.
boolean shared;

View File

@ -5515,6 +5515,8 @@ public abstract class CitrixResourceBase implements ServerResource {
return getNfsSR(conn, pool);
} else if (pool.getType() == StoragePoolType.IscsiLUN) {
return getIscsiSR(conn, pool);
} else if (pool.getType() == StoragePoolType.PreSetup) {
throw new CloudRuntimeException("The pool type: " + pool.getType().name() + " uuid " + pool.getUuid() + " doesn't exist");
} else {
throw new CloudRuntimeException("The pool type: " + pool.getType().name() + " is not supported.");
}

View File

@ -174,7 +174,9 @@ public class XenServer56Resource extends CitrixResourceBase {
try {
SR sr = super.getStorageRepository(conn, pool);
if (pool.getType() != StoragePoolType.IscsiLUN && pool.getType() != StoragePoolType.NetworkFilesystem) {
if (!sr.getShared(conn) || ( pool.getType() != StoragePoolType.IscsiLUN
&& pool.getType() != StoragePoolType.NetworkFilesystem
&& pool.getType() != StoragePoolType.PreSetup)) {
return sr;
}
setupHeartbeatSr(conn, sr, false);

View File

@ -987,6 +987,8 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
pool = new StoragePoolVO(StoragePoolType.Filesystem, "localhost", 0, hostPath);
} else if (scheme.equalsIgnoreCase("sharedMountPoint")) {
pool = new StoragePoolVO(StoragePoolType.SharedMountPoint, storageHost, 0, hostPath);
} else if (scheme.equalsIgnoreCase("PreSetup")) {
pool = new StoragePoolVO(StoragePoolType.PreSetup, storageHost, 0, hostPath);
} else if (scheme.equalsIgnoreCase("iscsi")) {
String[] tokens = hostPath.split("/");
int lun = NumbersUtil.parseInt(tokens[tokens.length - 1], -1);
@ -1052,6 +1054,8 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
String uuid = null;
if (scheme.equalsIgnoreCase("sharedmountpoint")) {
uuid = UUID.randomUUID().toString();
} else if (scheme.equalsIgnoreCase("PreSetup")) {
uuid = hostPath.replace("/", "");
} else {
uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString();
}
@ -1233,8 +1237,8 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
s_logger.debug("Adding pool " + pool.getName() + " to host " + hostId);
if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem
&& pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS
&& pool.getPoolType() != StoragePoolType.SharedMountPoint) {
&& pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup) {
s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType());
return true;
}