Skip to content

Commit 7a8f511

Browse files
CLOUDSTACK-7372: [vGPU] When a host is put in maintenance mode, vGPU enabled VMs
failed to migrate to the other host in the cluster. Migration for vGPU VMs is not supported in XS, so instead of migrating them to new server, stopping them.
1 parent ce51fe3 commit 7a8f511

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
import com.cloud.exception.InvalidParameterValueException;
100100
import com.cloud.exception.PermissionDeniedException;
101101
import com.cloud.exception.ResourceInUseException;
102+
import com.cloud.gpu.GPU;
102103
import com.cloud.gpu.HostGpuGroupsVO;
103104
import com.cloud.gpu.VGPUTypesVO;
104105
import com.cloud.gpu.dao.HostGpuGroupsDao;
@@ -125,6 +126,7 @@
125126
import com.cloud.org.Grouping.AllocationState;
126127
import com.cloud.org.Managed;
127128
import com.cloud.serializer.GsonHelper;
129+
import com.cloud.service.dao.ServiceOfferingDetailsDao;
128130
import com.cloud.storage.GuestOSCategoryVO;
129131
import com.cloud.storage.StorageManager;
130132
import com.cloud.storage.StoragePool;
@@ -223,6 +225,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
223225
PlannerHostReservationDao _plannerHostReserveDao;
224226
@Inject
225227
private DedicatedResourceDao _dedicatedDao;
228+
@Inject
229+
private ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
226230

227231
private List<? extends Discoverer> _discoverers;
228232

@@ -1193,7 +1197,9 @@ private boolean doMaintain(final long hostId) {
11931197

11941198
List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
11951199
for (final VMInstanceVO vm : vms) {
1196-
if (hosts == null || hosts.isEmpty() || !answer.getMigrate()) {
1200+
if (hosts == null || hosts.isEmpty() || !answer.getMigrate()
1201+
|| _serviceOfferingDetailsDao.findDetail(vm.getServiceOfferingId(), GPU.Keys.vgpuType.toString()) != null) {
1202+
// Migration is not supported for VGPU Vms so stop them.
11971203
// for the last host in this cluster, stop all the VMs
11981204
_haMgr.scheduleStop(vm, hostId, WorkType.ForceStop);
11991205
} else if (HypervisorType.LXC.equals(host.getHypervisorType()) && VirtualMachine.Type.User.equals(vm.getType())){

0 commit comments

Comments
 (0)