[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-18 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r182386542
 
 

 ##
 File path: server/src/main/java/com/cloud/projects/ProjectManagerImpl.java
 ##
 @@ -479,7 +479,7 @@ public void doInTransactionWithoutResult(TransactionStatus 
status) throws Resour
 throw new InvalidParameterValueException("Unable to find 
account name=" + newOwnerName + " in domain id=" + project.getDomainId());
 }
 Account currentOwnerAccount = getProjectOwner(projectId);
-if (currentOwnerAccount.getId() != futureOwnerAccount.getId()) {
+if (currentOwnerAccount !=null && currentOwnerAccount.getId() != 
futureOwnerAccount.getId()) {
 ProjectAccountVO futureOwner = 
_projectAccountDao.findByProjectIdAccountId(projectId, 
futureOwnerAccount.getAccountId());
 
 Review comment:
   Here, I think when currentOwnerAccount ==null, we should throw 
InvalidParameterValueException.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-17 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r182090707
 
 

 ##
 File path: 
server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
 ##
 @@ -740,14 +740,14 @@ public boolean startRemoteAccessVpn(final 
RemoteAccessVpn vpn, final VirtualRout
 throw new AgentUnavailableException("Unable to send commands to 
virtual router ", router.getHostId(), e);
 }
 Answer answer = cmds.getAnswer("users");
-if (!answer.getResult()) {
+if (answer != null && !answer.getResult()) {
 
 Review comment:
   hum, here is not change as @rafaelweingartner suggest


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181792497
 
 

 ##
 File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ##
 @@ -2337,8 +2337,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) 
{
 
disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
 }
 }
-
-vm.getDevices().addDevice(disk);
+if (vm.getDevices() != null) {
 
 Review comment:
   i got, the exception stack can help us where error happens accurately . 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181790224
 
 

 ##
 File path: 
engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
 ##
 @@ -126,8 +126,10 @@ public void updateDomainCount(long domainId, ResourceType 
type, boolean incremen
 delta = increment ? delta : delta * -1;
 
 ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, 
ResourceOwnerType.Domain, type);
-resourceCountVO.setCount(resourceCountVO.getCount() + delta);
-update(resourceCountVO.getId(), resourceCountVO);
+if (resourceCountVO != null) {
 
 Review comment:
   hum, you mean delete the updateDomainCount ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181789077
 
 

 ##
 File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ##
 @@ -2337,8 +2337,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) 
{
 
disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
 }
 }
-
-vm.getDevices().addDevice(disk);
+if (vm.getDevices() != null) {
 
 Review comment:
   hum. I mean another three "vm.getDevices;" are all in the same function,  
vm.getDevices can always return same object, so add checker at  line 2340 mean 
that check the parameter vm is legal.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181781752
 
 

 ##
 File path: 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ##
 @@ -2337,8 +2337,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) 
{
 
disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
 }
 }
-
-vm.getDevices().addDevice(disk);
+if (vm.getDevices() != null) {
 
 Review comment:
   Yes, an exception is better, but checker should need  shift to an earlier 
position, because there exist another three  "vm.getDevices;" in the flowing 
code . Move to line 2340 is suitable, code can be 
   if (vm.getDevices() == null){
   throw new CloudRuntimeException(There is no devices for " + vm);
   }


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181776550
 
 

 ##
 File path: 
engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
 ##
 @@ -126,8 +126,10 @@ public void updateDomainCount(long domainId, ResourceType 
type, boolean incremen
 delta = increment ? delta : delta * -1;
 
 ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, 
ResourceOwnerType.Domain, type);
-resourceCountVO.setCount(resourceCountVO.getCount() + delta);
-update(resourceCountVO.getId(), resourceCountVO);
+if (resourceCountVO != null) {
 
 Review comment:
It have no any callers


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181775057
 
 

 ##
 File path: 
engine/schema/src/main/java/com/cloud/configuration/dao/ResourceCountDaoImpl.java
 ##
 @@ -126,8 +126,10 @@ public void updateDomainCount(long domainId, ResourceType 
type, boolean incremen
 delta = increment ? delta : delta * -1;
 
 ResourceCountVO resourceCountVO = findByOwnerAndType(domainId, 
ResourceOwnerType.Domain, type);
-resourceCountVO.setCount(resourceCountVO.getCount() + delta);
-update(resourceCountVO.getId(), resourceCountVO);
+if (resourceCountVO != null) {
 
 Review comment:
   updateDomainCount is an @Deprecated method, can we ignore it?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] lujiefsi commented on a change in pull request #2573: Cloudstack 10356

2018-04-16 Thread GitBox
lujiefsi commented on a change in pull request #2573: Cloudstack 10356
URL: https://github.com/apache/cloudstack/pull/2573#discussion_r181772009
 
 

 ##
 File path: 
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
 ##
 @@ -499,6 +499,9 @@ public VolumeInfo copyVolumeFromSecToPrimary(VolumeInfo 
volume, VirtualMachine v
 
 // Find a suitable storage to create volume on
 StoragePool destPool = findStoragePool(dskCh, dc, pod, clusterId, 
null, vm, avoidPools);
+if (destPool == null) {
+throw new CloudRuntimeException("Failed to find a storage pool 
with enough capacity to copy the volume to.");
 
 Review comment:
   how about: throw new CloudRuntimeException("Failed to find a suitable 
storage pool to create Volume in the pod/cluster of the provided VM "+ 
vm.getUuid());


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services