Skip to content

Commit b226861

Browse files
committed
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"
1 parent 4ea260c commit b226861

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

api/src/com/cloud/storage/Storage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public static enum StoragePoolType {
9494
ISO(false), // for iso image
9595
LVM(false), // XenServer local LVM SR
9696
SharedMountPoint(true),
97-
VMFS(true); // VMware VMFS storage
97+
VMFS(true), // VMware VMFS storage
98+
PreSetup(true); // for XenServer, Storage Pool is set up by customers.
99+
98100

99101
boolean shared;
100102

core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5515,6 +5515,8 @@ protected SR getStorageRepository(Connection conn, StorageFilerTO pool) {
55155515
return getNfsSR(conn, pool);
55165516
} else if (pool.getType() == StoragePoolType.IscsiLUN) {
55175517
return getIscsiSR(conn, pool);
5518+
} else if (pool.getType() == StoragePoolType.PreSetup) {
5519+
throw new CloudRuntimeException("The pool type: " + pool.getType().name() + " uuid " + pool.getUuid() + " doesn't exist");
55185520
} else {
55195521
throw new CloudRuntimeException("The pool type: " + pool.getType().name() + " is not supported.");
55205522
}

core/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ protected SR getStorageRepository(Connection conn, StorageFilerTO pool) {
174174
try {
175175
SR sr = super.getStorageRepository(conn, pool);
176176

177-
if (pool.getType() != StoragePoolType.IscsiLUN && pool.getType() != StoragePoolType.NetworkFilesystem) {
177+
if (!sr.getShared(conn) || ( pool.getType() != StoragePoolType.IscsiLUN
178+
&& pool.getType() != StoragePoolType.NetworkFilesystem
179+
&& pool.getType() != StoragePoolType.PreSetup)) {
178180
return sr;
179181
}
180182
setupHeartbeatSr(conn, sr, false);

server/src/com/cloud/storage/StorageManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,8 @@ public StoragePoolVO createPool(CreateStoragePoolCmd cmd) throws ResourceInUseEx
987987
pool = new StoragePoolVO(StoragePoolType.Filesystem, "localhost", 0, hostPath);
988988
} else if (scheme.equalsIgnoreCase("sharedMountPoint")) {
989989
pool = new StoragePoolVO(StoragePoolType.SharedMountPoint, storageHost, 0, hostPath);
990+
} else if (scheme.equalsIgnoreCase("PreSetup")) {
991+
pool = new StoragePoolVO(StoragePoolType.PreSetup, storageHost, 0, hostPath);
990992
} else if (scheme.equalsIgnoreCase("iscsi")) {
991993
String[] tokens = hostPath.split("/");
992994
int lun = NumbersUtil.parseInt(tokens[tokens.length - 1], -1);
@@ -1052,6 +1054,8 @@ public StoragePoolVO createPool(CreateStoragePoolCmd cmd) throws ResourceInUseEx
10521054
String uuid = null;
10531055
if (scheme.equalsIgnoreCase("sharedmountpoint")) {
10541056
uuid = UUID.randomUUID().toString();
1057+
} else if (scheme.equalsIgnoreCase("PreSetup")) {
1058+
uuid = hostPath.replace("/", "");
10551059
} else {
10561060
uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString();
10571061
}
@@ -1233,8 +1237,8 @@ public boolean addPoolToHost(long hostId, StoragePoolVO pool) {
12331237
s_logger.debug("Adding pool " + pool.getName() + " to host " + hostId);
12341238
if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem
12351239
&& pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS
1236-
&& pool.getPoolType() != StoragePoolType.SharedMountPoint) {
1237-
1240+
&& pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup) {
1241+
s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType());
12381242
return true;
12391243
}
12401244

0 commit comments

Comments
 (0)