mirror of https://github.com/apache/cloudstack.git
bug 6703, 6704: use the correct method signatures for invoking updateTemplate/updateIso and updateTemplatePermissions/updateIsoPermissions APIs. It's possible that the reflection should just use 'isAssignableFrom' when getting methods since the manager methods were using a base class as the parameter rather than UpdateTemplateCmd/UpdateIsoCmd and UpdateTemplatePermissions/UpdateIsoPermissions, but for now the explicit methods are added for simplicity.
status 6703, 6704: resolved fixed
This commit is contained in:
parent
d229877cd8
commit
83e4922b94
|
|
@ -43,7 +43,7 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
private Long id;
|
||||
|
||||
@Parameter(name="name", type=CommandType.STRING, description="the name of the image file")
|
||||
private String isoName;
|
||||
private String templateName;
|
||||
|
||||
@Parameter(name="ostypeid", type=CommandType.LONG, description="the ID of the OS type that best represents the OS of this image.")
|
||||
private Long osTypeId;
|
||||
|
|
@ -70,8 +70,8 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
return id;
|
||||
}
|
||||
|
||||
public String isoName() {
|
||||
return isoName;
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
}
|
||||
|
||||
public Long getOsTypeId() {
|
||||
|
|
@ -85,5 +85,4 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,10 @@ import com.cloud.api.commands.StopSystemVmCmd;
|
|||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.api.commands.UpdateDomainCmd;
|
||||
import com.cloud.api.commands.UpdateIPForwardingRuleCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplatePermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateUserCmd;
|
||||
import com.cloud.api.commands.UpdateVMGroupCmd;
|
||||
import com.cloud.api.commands.UploadCustomCertificateCmd;
|
||||
|
|
@ -595,10 +597,11 @@ public interface ManagementServer {
|
|||
/**
|
||||
* Creates a new template
|
||||
* @param cmd
|
||||
* @return success/failure
|
||||
* @return updated template
|
||||
* @throws InvalidParameterValueException, PermissionDeniedException
|
||||
*/
|
||||
boolean updateTemplate(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
VMTemplateVO updateTemplate(UpdateIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
VMTemplateVO updateTemplate(UpdateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Copies a template from one secondary storage server to another
|
||||
|
|
@ -1173,7 +1176,8 @@ public interface ManagementServer {
|
|||
boolean checkLocalStorageConfigVal();
|
||||
|
||||
boolean updateUser(UpdateUserCmd cmd) throws InvalidParameterValueException;
|
||||
boolean updateTemplatePermissions(UpdateTemplateOrIsoPermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
boolean updateTemplatePermissions(UpdateTemplatePermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
boolean updateTemplatePermissions(UpdateIsoPermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
String[] createApiKeyAndSecretKey(RegisterCmd cmd);
|
||||
|
||||
VolumeVO findVolumeByInstanceAndDeviceId(long instanceId, long deviceId);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ import com.cloud.api.commands.StopSystemVmCmd;
|
|||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.api.commands.UpdateDomainCmd;
|
||||
import com.cloud.api.commands.UpdateIPForwardingRuleCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplatePermissionsCmd;
|
||||
|
|
@ -222,8 +224,6 @@ import com.cloud.storage.GuestOSCategoryVO;
|
|||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.LaunchPermissionVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Upload;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.Snapshot.SnapshotType;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
|
|
@ -236,7 +236,7 @@ import com.cloud.storage.StorageStats;
|
|||
import com.cloud.storage.Upload.Type;
|
||||
import com.cloud.storage.UploadVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume.VolumeType;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeStats;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
|
|
@ -252,7 +252,6 @@ import com.cloud.storage.dao.UploadDao;
|
|||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao.TemplateFilter;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.download.DownloadMonitor;
|
||||
import com.cloud.storage.preallocatedlun.PreallocatedLunVO;
|
||||
import com.cloud.storage.preallocatedlun.dao.PreallocatedLunDao;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
|
|
@ -3423,9 +3422,18 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTemplate(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
public VMTemplateVO updateTemplate(UpdateIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
return updateTemplateOrIso(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO updateTemplate(UpdateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
return updateTemplateOrIso(cmd);
|
||||
}
|
||||
|
||||
private VMTemplateVO updateTemplateOrIso(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String name = cmd.getTemplateName();
|
||||
String displayText = cmd.getDisplayText();
|
||||
String format = cmd.getFormat();
|
||||
Long guestOSId = cmd.getOsTypeId();
|
||||
|
|
@ -3462,7 +3470,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
boolean updateNeeded = !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null);
|
||||
if (!updateNeeded) {
|
||||
return true;
|
||||
return template;
|
||||
}
|
||||
|
||||
template = _templateDao.createForUpdate(id);
|
||||
|
|
@ -3504,7 +3512,9 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
template.setBootable(bootable);
|
||||
}
|
||||
|
||||
return _templateDao.update(id, template);
|
||||
_templateDao.update(id, template);
|
||||
|
||||
return _templateDao.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -5178,7 +5188,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
sc.setParameters("accountId", accountId);
|
||||
} else if (domainId != null) {
|
||||
DomainVO domain = _domainDao.findById((Long)domainId);
|
||||
SearchCriteria joinSearch = sc.getJoin("accountSearch");
|
||||
SearchCriteria<?> joinSearch = sc.getJoin("accountSearch");
|
||||
joinSearch.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
||||
}
|
||||
|
||||
|
|
@ -5216,9 +5226,20 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @DB
|
||||
public boolean updateTemplatePermissions(UpdateTemplatePermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
return updateTemplateOrIsoPermissions(cmd);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public boolean updateTemplatePermissions(UpdateIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
return updateTemplateOrIsoPermissions(cmd);
|
||||
}
|
||||
|
||||
@DB
|
||||
public boolean updateTemplatePermissions(UpdateTemplateOrIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
protected boolean updateTemplateOrIsoPermissions(UpdateTemplateOrIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue