Skip to content

Commit 2889e3d

Browse files
author
DK101010
committed
add possible to set a name for a local primary storage
1 parent 6d1a397 commit 2889e3d

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

api/src/main/java/com/cloud/agent/api/StoragePoolInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public StoragePoolInfo(String uuid, String host, String hostPath, String localPa
5252
this.details = details;
5353
}
5454

55+
public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, StoragePoolType poolType, long capacityBytes, long availableBytes,
56+
Map<String, String> details, String name) {
57+
this(uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
58+
this.details = details;
59+
this.name = name;
60+
}
61+
5562
public long getCapacityBytes() {
5663
return capacityBytes;
5764
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ private DataStore createLocalStorage(Map<String, Object> poolInfos) throws Conne
679679
StoragePoolType.Filesystem,
680680
capacityBytes,
681681
0,
682-
(Map<String,String>)poolInfos.get("details"));
682+
(Map<String,String>)poolInfos.get("details"),
683+
poolInfos.get("name").toString());
683684

684685
return createLocalStorage(host, pInfo);
685686
}
@@ -729,7 +730,7 @@ public DataStore createLocalStorage(Host host, StoragePoolInfo pInfo) throws Con
729730
DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
730731
if (pool == null) {
731732
Map<String, Object> params = new HashMap<String, Object>();
732-
String name = createLocalStoragePoolName(host, pInfo);
733+
String name = pInfo.getName() != null ? pInfo.getName() : createLocalStoragePoolName(host, pInfo);
733734
params.put("zoneId", host.getDataCenterId());
734735
params.put("clusterId", host.getClusterId());
735736
params.put("podId", host.getPodId());

0 commit comments

Comments
 (0)