rafaelweingartner commented on a change in pull request #2315: A comprehensive 
solution for #CLOUDSTACK-9025.
URL: https://github.com/apache/cloudstack/pull/2315#discussion_r151139334
 
 

 ##########
 File path: engine/schema/src/com/cloud/host/dao/HostDaoImpl.java
 ##########
 @@ -1194,4 +1178,26 @@ public HostVO findByIp(final String ipAddress) {
         sc.setParameters("type", type);
         return listBy(sc);
     }
-}
+
+    String sqlFindHostConnectedToSnapshotStoragePoolToExecuteCommand = "select 
h.id from snapshots s join volumes v on v.id = s.volume_id "
+            + "join storage_pool pool on pool.id = v.pool_id join cluster c on 
pool.cluster_id = c.id join host h on h.cluster_id = c.id "
 
 Review comment:
   @anshul1886  I tested this solution here to recover a volume from a snapshot 
of a volume that has been deleted, and it works. As you can see I am not 
filtering the volumes that have been deleted. 
   
   I also tested what you said that we only use the secondary storage to build 
the volume from snapshots, and it is right. This means, any XenServer of the 
Zone can execute this command then. I will update my select to reflect that.
   
   Regarding JPA, I have mixed feeling about the JPA implementation ACS uses. 
It is not a standard one and it requires too much code to achieve the same 
thing we do with SQL. Also, It does not seem to be a standard in ACS to do 
everything with JPA. I would rather use Spring-data with a commercial JPA 
implementation (EclipseLink, Hibernate, OpenJPA), but this requires some 
structural changes.
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to