Skip to content

Commit 4a6086e

Browse files
committed
압축중복제거 볼륨 사용중인 호스트 유지보수 모드 제한
호스트 유지보수 모드 설정시 가상머신 마이그레이션이 동작하는데, 해당 호스트에 압축중복제거 볼륨을 사용중인 가상머신이 동작중인 경우 유지보수모드 제한되도록 수정
1 parent 0059d14 commit 4a6086e

File tree

4 files changed

+698
-69
lines changed

4 files changed

+698
-69
lines changed

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
import com.cloud.service.ServiceOfferingVO;
164164
import com.cloud.service.dao.ServiceOfferingDao;
165165
import com.cloud.service.dao.ServiceOfferingDetailsDao;
166+
import com.cloud.storage.DiskOfferingVO;
166167
import com.cloud.storage.GuestOSCategoryVO;
167168
import com.cloud.storage.StorageManager;
168169
import com.cloud.storage.StoragePool;
@@ -1507,6 +1508,21 @@ public Host maintain(final PrepareForMaintenanceCmd cmd) {
15071508
logger.debug("Unable to find host " + hostId);
15081509
throw new InvalidParameterValueException("Unable to find host with ID: " + hostId + ". Please specify a valid host ID.");
15091510
}
1511+
1512+
List<VMInstanceVO> activeVMs = _vmDao.listByHostId(hostId);
1513+
for (VMInstanceVO vm : activeVMs) {
1514+
List<VolumeVO> volumesForVm = volumeDao.findUsableVolumesForInstance(vm.getId());
1515+
for (VolumeVO vol : volumesForVm) {
1516+
if (vol.getDiskOfferingId() != null) {
1517+
DiskOfferingVO diskOffering = diskOfferingDao.findById(vol.getDiskOfferingId());
1518+
if (diskOffering.getKvdoEnable()) {
1519+
logger.debug("The host on which maintenance mode is to be set cannot be run because there is a virtual machine using a compressed/deduplicated volume. Check the VM: " + vm.getInstanceName());
1520+
throw new InvalidParameterValueException("The host on which maintenance mode is to be set cannot be run because there is a virtual machine using a compressed/deduplicated volume. Check the VM: " + vm.getInstanceName());
1521+
}
1522+
}
1523+
}
1524+
}
1525+
15101526
if (!ResourceState.canAttemptMaintenance(host.getResourceState())) {
15111527
throw new CloudRuntimeException("Host is already in state " + host.getResourceState() + ". Cannot recall for maintenance until resolved.");
15121528
}

ui/src/config/section/compute.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ export default {
381381
docHelp: 'adminguide/virtual_machines.html#moving-vms-between-hosts-manual-live-migration',
382382
dataView: true,
383383
show: (record, store) => {
384-
return ['Stopped'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype)
384+
return ['Stopped'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) && !record.kvdoinuse
385385
},
386386
disabled: (record) => {
387387
return record.hostcontrolstate === 'Offline' || (record.details && 'extraconfig-1' in record.details)
@@ -1121,3 +1121,4 @@ export default {
11211121
}
11221122
]
11231123
}
1124+

0 commit comments

Comments
 (0)