mirror of https://github.com/apache/cloudstack.git
Fixes related to
- DescribeImages - Fix Vm current state in runInstances - Set hypervisor to UserVm response in CloudStack
This commit is contained in:
parent
1f81fca6d2
commit
46ccc1ec79
|
|
@ -1364,9 +1364,11 @@ public class EC2Engine {
|
|||
if (vm.getState().equalsIgnoreCase( "Running" ) || vm.getState().equalsIgnoreCase( "Destroyed" )) continue;
|
||||
|
||||
CloudStackUserVm resp = getApi().startVirtualMachine(vm.getId());
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("Starting VM " + vm.getId() + " job " + resp.getJobId());
|
||||
if(resp != null){
|
||||
vm.setState(resp.getState());
|
||||
if(logger.isDebugEnabled())
|
||||
logger.debug("Starting VM " + vm.getId() + " job " + resp.getJobId());
|
||||
}
|
||||
instances.addInstance(vm);
|
||||
}
|
||||
return instances;
|
||||
|
|
@ -1408,7 +1410,10 @@ public class EC2Engine {
|
|||
if(logger.isDebugEnabled())
|
||||
logger.debug("Stopping VM " + vm.getId() + " job " + resp.getJobId());
|
||||
}
|
||||
if (resp != null) instances.addInstance(vm);
|
||||
if (resp != null) {
|
||||
vm.setState(resp.getState());
|
||||
instances.addInstance(vm);
|
||||
}
|
||||
}
|
||||
return instances;
|
||||
} catch( Exception e ) {
|
||||
|
|
@ -1709,25 +1714,32 @@ public class EC2Engine {
|
|||
try {
|
||||
List<CloudStackTemplate> result = new ArrayList<CloudStackTemplate>();
|
||||
|
||||
List<CloudStackTemplate> selfExecutable = getApi().listTemplates("selfexecutable", null, null, null, templateId != null ? templateId : null, null, null, null);
|
||||
if(selfExecutable != null){
|
||||
result.addAll(selfExecutable);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> featured = getApi().listTemplates("featured", null, null, null, templateId != null ? templateId : null, null, null, null);
|
||||
if(featured != null){
|
||||
result.addAll(featured);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> sharedExecutable = getApi().listTemplates("sharedexecutable", null, null, null, templateId != null ? templateId : null, null, null, null);
|
||||
if(sharedExecutable != null){
|
||||
result.addAll(sharedExecutable);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> community = getApi().listTemplates("community", null, null, null, templateId != null ? templateId : null, null, null, null);
|
||||
if(community != null){
|
||||
result.addAll(community);
|
||||
}
|
||||
if(templateId != null){
|
||||
List<CloudStackTemplate> template = getApi().listTemplates("executable", null, null, null, templateId , null, null, null);
|
||||
if(template != null){
|
||||
result.addAll(template);
|
||||
}
|
||||
}else{
|
||||
List<CloudStackTemplate> selfExecutable = getApi().listTemplates("selfexecutable", null, null, null, null, null, null, null);
|
||||
if(selfExecutable != null){
|
||||
result.addAll(selfExecutable);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> featured = getApi().listTemplates("featured", null, null, null, null, null, null, null);
|
||||
if(featured != null){
|
||||
result.addAll(featured);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> sharedExecutable = getApi().listTemplates("sharedexecutable", null, null, null, null, null, null, null);
|
||||
if(sharedExecutable != null){
|
||||
result.addAll(sharedExecutable);
|
||||
}
|
||||
|
||||
List<CloudStackTemplate> community = getApi().listTemplates("community", null, null, null, null, null, null, null);
|
||||
if(community != null){
|
||||
result.addAll(community);
|
||||
}
|
||||
}
|
||||
|
||||
if (result != null && result.size() > 0) {
|
||||
for (CloudStackTemplate temp : result) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class EC2RegisterImage {
|
|||
|
||||
/**
|
||||
* We redefine the expected format of this field to be:
|
||||
* "format:zonename:ostypename"
|
||||
* "format:zonename:ostypename:hypervisor"
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -455,7 +455,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
//String accountId = null;
|
||||
String guestOSJoin = "";
|
||||
StringBuilder templateHostRefJoin = new StringBuilder();
|
||||
String dataCenterJoin = "";
|
||||
String dataCenterJoin = "", lpjoin = "";
|
||||
|
||||
if (isIso && !hyperType.equals(HypervisorType.None)) {
|
||||
guestOSJoin = " INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) ";
|
||||
|
|
@ -468,8 +468,11 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) {
|
||||
dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
|
||||
}
|
||||
if (templateFilter == TemplateFilter.sharedexecutable){
|
||||
lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
|
||||
}
|
||||
|
||||
sql += guestOSJoin + templateHostRefJoin + dataCenterJoin;
|
||||
sql += guestOSJoin + templateHostRefJoin + dataCenterJoin + lpjoin;
|
||||
String whereClause = "";
|
||||
|
||||
//All joins have to be made before we start setting the condition settings
|
||||
|
|
@ -551,7 +554,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
} else if (templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) {
|
||||
whereClause += " AND t.account_id IN (" + permittedAccountsStr + ")";
|
||||
} else if (templateFilter == TemplateFilter.sharedexecutable) {
|
||||
whereClause += " LEFT JOIN launch_permission lp ON t.id = lp.template_id WHERE" +
|
||||
whereClause += " AND " +
|
||||
" (t.account_id IN (" + permittedAccountsStr + ") OR" +
|
||||
" lp.account_id IN (" + permittedAccountsStr + "))";
|
||||
} else if (templateFilter == TemplateFilter.executable && !permittedAccounts.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue