CLOUDSTACK-6968: allowing cluster scope volumes to attach to any VM. If migration is

needed then first they will be migrated to appropriate cluster before attaching.
This commit is contained in:
Anshul Gangwar 2014-06-23 11:30:50 +05:30 committed by Devdeep Singh
parent 1c80185170
commit 6416de5770

View File

@ -26,7 +26,6 @@ import java.util.concurrent.ExecutionException;
import javax.inject.Inject;
import com.cloud.utils.DateUtil;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
@ -116,6 +115,7 @@ import com.cloud.user.User;
import com.cloud.user.VmDiskStatisticsVO;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.VmDiskStatisticsDao;
import com.cloud.utils.DateUtil;
import com.cloud.utils.EnumUtils;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
@ -2010,7 +2010,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
}
if (storeForNewStoreScope.getScopeId().equals(vmClusterId)) {
return false;
}
} else {
return true;
}
} else if (storeForNewStoreScope.getScopeType() == ScopeType.HOST
&& (storeForExistingStoreScope.getScopeType() == ScopeType.CLUSTER || storeForExistingStoreScope.getScopeType() == ScopeType.ZONE)) {
Long hostId = _vmInstanceDao.findById(existingVolume.getInstanceId()).getHostId();