Skip to content

Commit 88916dc

Browse files
committed
Merge branch '4.19' into 4.20
2 parents 91db905 + f992ebb commit 88916dc

File tree

8 files changed

+54
-14
lines changed

8 files changed

+54
-14
lines changed

api/src/main/java/com/cloud/storage/MigrationOptions.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MigrationOptions implements Serializable {
2424

2525
private String srcPoolUuid;
2626
private Storage.StoragePoolType srcPoolType;
27+
private Long srcPoolClusterId;
2728
private Type type;
2829
private ScopeType scopeType;
2930
private String srcBackingFilePath;
@@ -38,21 +39,23 @@ public enum Type {
3839
public MigrationOptions() {
3940
}
4041

41-
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType) {
42+
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcBackingFilePath, boolean copySrcTemplate, ScopeType scopeType, Long srcPoolClusterId) {
4243
this.srcPoolUuid = srcPoolUuid;
4344
this.srcPoolType = srcPoolType;
4445
this.type = Type.LinkedClone;
4546
this.scopeType = scopeType;
4647
this.srcBackingFilePath = srcBackingFilePath;
4748
this.copySrcTemplate = copySrcTemplate;
49+
this.srcPoolClusterId = srcPoolClusterId;
4850
}
4951

50-
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType) {
52+
public MigrationOptions(String srcPoolUuid, Storage.StoragePoolType srcPoolType, String srcVolumeUuid, ScopeType scopeType, Long srcPoolClusterId) {
5153
this.srcPoolUuid = srcPoolUuid;
5254
this.srcPoolType = srcPoolType;
5355
this.type = Type.FullClone;
5456
this.scopeType = scopeType;
5557
this.srcVolumeUuid = srcVolumeUuid;
58+
this.srcPoolClusterId = srcPoolClusterId;
5659
}
5760

5861
public String getSrcPoolUuid() {
@@ -63,6 +66,10 @@ public Storage.StoragePoolType getSrcPoolType() {
6366
return srcPoolType;
6467
}
6568

69+
public Long getSrcPoolClusterId() {
70+
return srcPoolClusterId;
71+
}
72+
6673
public ScopeType getScopeType() { return scopeType; }
6774

6875
public String getSrcBackingFilePath() {

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/KvmNonManagedStorageDataMotionStrategy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ protected void copyTemplateToTargetFilesystemStorageIfNeeded(VolumeInfo srcVolum
215215
}
216216

217217
VMTemplateStoragePoolVO sourceVolumeTemplateStoragePoolVO = vmTemplatePoolDao.findByPoolTemplate(destStoragePool.getId(), srcVolumeInfo.getTemplateId(), null);
218-
if (sourceVolumeTemplateStoragePoolVO == null && (isStoragePoolTypeInList(destStoragePool.getPoolType(), StoragePoolType.Filesystem, StoragePoolType.SharedMountPoint))) {
218+
if (sourceVolumeTemplateStoragePoolVO == null && (isStoragePoolTypeInList(destStoragePool.getPoolType(), StoragePoolType.NetworkFilesystem, StoragePoolType.Filesystem, StoragePoolType.SharedMountPoint))) {
219219
DataStore sourceTemplateDataStore = dataStoreManagerImpl.getRandomImageStore(srcVolumeInfo.getDataCenterId());
220220
if (sourceTemplateDataStore != null) {
221221
TemplateInfo sourceTemplateInfo = templateDataFactory.getTemplate(srcVolumeInfo.getTemplateId(), sourceTemplateDataStore);

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -1949,18 +1949,26 @@ private SnapshotDetailsVO handleSnapshotDetails(long csSnapshotId, String value)
19491949
/**
19501950
* Return expected MigrationOptions for a linked clone volume live storage migration
19511951
*/
1952-
protected MigrationOptions createLinkedCloneMigrationOptions(VolumeInfo srcVolumeInfo, VolumeInfo destVolumeInfo, String srcVolumeBackingFile, String srcPoolUuid, Storage.StoragePoolType srcPoolType) {
1952+
protected MigrationOptions createLinkedCloneMigrationOptions(VolumeInfo srcVolumeInfo, VolumeInfo destVolumeInfo, String srcVolumeBackingFile, StoragePoolVO srcPool) {
1953+
String srcPoolUuid = srcPool.getUuid();
1954+
Storage.StoragePoolType srcPoolType = srcPool.getPoolType();
1955+
Long srcPoolClusterId = srcPool.getClusterId();
19531956
VMTemplateStoragePoolVO ref = templatePoolDao.findByPoolTemplate(destVolumeInfo.getPoolId(), srcVolumeInfo.getTemplateId(), null);
19541957
boolean updateBackingFileReference = ref == null;
19551958
String backingFile = !updateBackingFileReference ? ref.getInstallPath() : srcVolumeBackingFile;
1956-
return new MigrationOptions(srcPoolUuid, srcPoolType, backingFile, updateBackingFileReference, srcVolumeInfo.getDataStore().getScope().getScopeType());
1959+
ScopeType scopeType = srcVolumeInfo.getDataStore().getScope().getScopeType();
1960+
return new MigrationOptions(srcPoolUuid, srcPoolType, backingFile, updateBackingFileReference, scopeType, srcPoolClusterId);
19571961
}
19581962

19591963
/**
19601964
* Return expected MigrationOptions for a full clone volume live storage migration
19611965
*/
1962-
protected MigrationOptions createFullCloneMigrationOptions(VolumeInfo srcVolumeInfo, VirtualMachineTO vmTO, Host srcHost, String srcPoolUuid, Storage.StoragePoolType srcPoolType) {
1963-
return new MigrationOptions(srcPoolUuid, srcPoolType, srcVolumeInfo.getPath(), srcVolumeInfo.getDataStore().getScope().getScopeType());
1966+
protected MigrationOptions createFullCloneMigrationOptions(VolumeInfo srcVolumeInfo, VirtualMachineTO vmTO, Host srcHost, StoragePoolVO srcPool) {
1967+
String srcPoolUuid = srcPool.getUuid();
1968+
Storage.StoragePoolType srcPoolType = srcPool.getPoolType();
1969+
Long srcPoolClusterId = srcPool.getClusterId();
1970+
ScopeType scopeType = srcVolumeInfo.getDataStore().getScope().getScopeType();
1971+
return new MigrationOptions(srcPoolUuid, srcPoolType, srcVolumeInfo.getPath(), scopeType, srcPoolClusterId);
19641972
}
19651973

19661974
/**
@@ -1983,9 +1991,9 @@ protected void setVolumeMigrationOptions(VolumeInfo srcVolumeInfo, VolumeInfo de
19831991

19841992
MigrationOptions migrationOptions;
19851993
if (MigrationOptions.Type.LinkedClone.equals(migrationType)) {
1986-
migrationOptions = createLinkedCloneMigrationOptions(srcVolumeInfo, destVolumeInfo, srcVolumeBackingFile, srcPoolUuid, srcPoolType);
1994+
migrationOptions = createLinkedCloneMigrationOptions(srcVolumeInfo, destVolumeInfo, srcVolumeBackingFile, srcPool);
19871995
} else {
1988-
migrationOptions = createFullCloneMigrationOptions(srcVolumeInfo, vmTO, srcHost, srcPoolUuid, srcPoolType);
1996+
migrationOptions = createFullCloneMigrationOptions(srcVolumeInfo, vmTO, srcHost, srcPool);
19891997
}
19901998
migrationOptions.setTimeout(StorageManager.KvmStorageOnlineMigrationWait.value());
19911999
destVolumeInfo.setMigrationOptions(migrationOptions);

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

+4
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,10 @@ public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() {
639639
return libvirtUtilitiesHelper;
640640
}
641641

642+
public String getClusterId() {
643+
return clusterId;
644+
}
645+
642646
public CPUStat getCPUStat() {
643647
return cpuStat;
644648
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java

+6
Original file line numberDiff line numberDiff line change
@@ -2660,6 +2660,12 @@ public KVMStoragePool getTemplateSourcePoolUsingMigrationOptions(KVMStoragePool
26602660
return localPool;
26612661
}
26622662

2663+
if (migrationOptions.getScopeType().equals(ScopeType.CLUSTER)
2664+
&& migrationOptions.getSrcPoolClusterId() != null
2665+
&& !migrationOptions.getSrcPoolClusterId().toString().equals(resource.getClusterId())) {
2666+
return localPool;
2667+
}
2668+
26632669
return storagePoolMgr.getStoragePool(migrationOptions.getSrcPoolType(), migrationOptions.getSrcPoolUuid());
26642670
}
26652671
}

ui/src/components/view/InfoCard.vue

+5
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,11 @@ export default {
12081208
if (item.value) {
12091209
query[item.param] = this.resource[item.value]
12101210
} else {
1211+
if (item.name === 'template') {
1212+
query.templatefilter = 'self'
1213+
query.filter = 'self'
1214+
}
1215+
12111216
if (item.param === 'account') {
12121217
query[item.param] = this.resource.name
12131218
query.domainid = this.resource.domainid

ui/src/components/view/ListView.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@
160160
 
161161
<a-tag>static-nat</a-tag>
162162
</span>
163+
<span v-if="record.issystem">
164+
&nbsp;
165+
<a-tag>system</a-tag>
166+
</span>
163167
</template>
164168
<template v-if="column.key === 'ip6address'" href="javascript:;">
165169
<span>{{ ipV6Address(text, record) }}</span>
@@ -412,8 +416,8 @@
412416
<status :text="record.enabled ? record.enabled.toString() : 'false'" />
413417
{{ record.enabled ? 'Enabled' : 'Disabled' }}
414418
</template>
415-
<template v-if="['created', 'sent', 'removed', 'effectiveDate', 'endDate'].includes(column.key) || (['startdate'].includes(column.key) && ['webhook'].includes($route.path.split('/')[1])) || (column.key === 'allocated' && ['asnumbers', 'publicip', 'ipv4subnets'].includes($route.meta.name) && text)">
416-
{{ $toLocaleDate(text) }}
419+
<template v-if="['created', 'sent', 'removed', 'effectiveDate', 'endDate', 'allocated'].includes(column.key) || (['startdate'].includes(column.key) && ['webhook'].includes($route.path.split('/')[1])) || (column.key === 'allocated' && ['asnumbers', 'publicip', 'ipv4subnets'].includes($route.meta.name) && text)">
420+
{{ text && $toLocaleDate(text) }}
417421
</template>
418422
<template v-if="['startdate', 'enddate'].includes(column.key) && ['vm', 'vnfapp'].includes($route.path.split('/')[1])">
419423
{{ getDateAtTimeZone(text, record.timezone) }}

ui/src/config/section/network.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -840,10 +840,13 @@ export default {
840840
message: 'message.action.release.ip',
841841
docHelp: 'adminguide/networking_and_traffic.html#releasing-an-ip-address-alloted-to-a-vpc',
842842
dataView: true,
843-
show: (record) => { return record.state === 'Allocated' && !record.issourcenat },
843+
show: (record) => { return record.state === 'Allocated' && !record.issourcenat && !record.issystem },
844844
groupAction: true,
845845
popup: true,
846-
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
846+
groupMap: (selection) => { return selection.map(x => { return { id: x } }) },
847+
groupShow: (selectedIps) => {
848+
return selectedIps.every((ip) => ip.state === 'Allocated' && !ip.issourcenat && !ip.issystem)
849+
}
847850
},
848851
{
849852
api: 'reserveIpAddress',
@@ -863,7 +866,10 @@ export default {
863866
show: (record) => { return record.state === 'Reserved' },
864867
groupAction: true,
865868
popup: true,
866-
groupMap: (selection) => { return selection.map(x => { return { id: x } }) }
869+
groupMap: (selection) => { return selection.map(x => { return { id: x } }) },
870+
groupShow: (selectedIps) => {
871+
return selectedIps.every((ip) => ip.state === 'Reserved')
872+
}
867873
}
868874
]
869875
},

0 commit comments

Comments
 (0)