Skip to content

Commit 872ecae

Browse files
committed
Disallow importing to disbled clusters
1 parent 0bed37b commit 872ecae

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,10 @@ private UserVmResponse baseImportInstance(ImportUnmanagedInstanceCmd cmd) {
13061306
Long clusterId = cmd.getClusterId();
13071307
Cluster cluster = basicAccessChecks(clusterId);
13081308

1309+
if (!cluster.getAllocationState().equals(Cluster.AllocationState.Enabled)) {
1310+
throw new InvalidParameterValueException(String.format("Cluster [%s] is not enabled.", cluster));
1311+
}
1312+
13091313
final Account caller = CallContext.current().getCallingAccount();
13101314
final DataCenter zone = dataCenterDao.findById(cluster.getDataCenterId());
13111315
final Account owner = accountService.getActiveAccountById(cmd.getEntityOwnerId());

ui/src/views/tools/ManageInstances.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ export default {
826826
options: {
827827
zoneid: _.get(this.zone, 'id'),
828828
podid: this.podId,
829-
hypervisor: this.destinationHypervisor
829+
hypervisor: this.destinationHypervisor,
830+
allocationstate: 'Enabled'
830831
},
831832
field: 'clusterid'
832833
},

0 commit comments

Comments
 (0)