Skip to content

Commit 67ff6dc

Browse files
author
DK101010
committed
add possible to set a name for a local primary storage
1 parent b402e19 commit 67ff6dc

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
@@ -678,7 +678,8 @@ private DataStore createLocalStorage(Map<String, Object> poolInfos) throws Conne
678678
StoragePoolType.Filesystem,
679679
capacityBytes,
680680
0,
681-
(Map<String,String>)poolInfos.get("details"));
681+
(Map<String,String>)poolInfos.get("details"),
682+
poolInfos.get("name").toString());
682683

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

0 commit comments

Comments
 (0)