diff --git a/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java b/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java index 81f3e5329ef..e5a1c903f96 100644 --- a/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/CreateServiceOfferingCmd.java @@ -25,6 +25,7 @@ import com.cloud.api.BaseCmd.Manager; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.response.ServiceOfferingResponse; +import com.cloud.offering.NetworkOffering.GuestIpType; import com.cloud.service.ServiceOfferingVO; @Implementation(method="createServiceOffering", manager=Manager.ConfigManager, description="Creates a service offering.") @@ -127,6 +128,7 @@ public class CreateServiceOfferingCmd extends BaseCmd { response.setOfferHa(offering.getOfferHA()); response.setStorageType(offering.getUseLocalStorage() ? "local" : "shared"); response.setTags(offering.getTags()); + response.setUseVirtualNetwork(offering.getGuestIpType().equals(GuestIpType.Virtualized)); response.setResponseName(getName()); return response; diff --git a/server/src/com/cloud/api/commands/ListHostsCmd.java b/server/src/com/cloud/api/commands/ListHostsCmd.java index 40afb7c8ac9..d9746f95770 100644 --- a/server/src/com/cloud/api/commands/ListHostsCmd.java +++ b/server/src/com/cloud/api/commands/ListHostsCmd.java @@ -141,6 +141,7 @@ public class ListHostsCmd extends BaseListCmd { hostResponse.setState(host.getStatus()); hostResponse.setIpAddress(host.getPrivateIpAddress()); hostResponse.setVersion(host.getVersion()); + hostResponse.setCreated(host.getCreated()); GuestOSCategoryVO guestOSCategory = ApiDBUtils.getHostGuestOSCategory(host.getId()); if (guestOSCategory != null) { diff --git a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java index 742934b34dd..bf69e45aa47 100644 --- a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java +++ b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java @@ -110,7 +110,7 @@ public class ListResourceLimitsCmd extends BaseListCmd { } } - resourceLimitResponse.setResourceType(limit.getType().ordinal()); + resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().ordinal()).toString()); resourceLimitResponse.setMax(limit.getMax()); resourceLimitResponse.setResponseName("resourcelimit"); diff --git a/server/src/com/cloud/api/commands/RebootRouterCmd.java b/server/src/com/cloud/api/commands/RebootRouterCmd.java index b1a68483a90..3a48cf809bd 100644 --- a/server/src/com/cloud/api/commands/RebootRouterCmd.java +++ b/server/src/com/cloud/api/commands/RebootRouterCmd.java @@ -22,12 +22,10 @@ import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; import com.cloud.api.BaseAsyncCmd; -import com.cloud.api.BaseCmd; import com.cloud.api.BaseCmd.Manager; import com.cloud.api.Implementation; import com.cloud.api.Parameter; -import com.cloud.api.ServerApiException; -import com.cloud.api.response.SuccessResponse; +import com.cloud.api.response.DomainRouterResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.vm.DomainRouterVO; @@ -82,16 +80,45 @@ public class RebootRouterCmd extends BaseAsyncCmd { } @Override @SuppressWarnings("unchecked") - public SuccessResponse getResponse() { - SuccessResponse response = new SuccessResponse(); - Boolean responseObject = (Boolean)getResponseObject(); + public DomainRouterResponse getResponse() { + DomainRouterResponse response = new DomainRouterResponse(); + DomainRouterVO router = (DomainRouterVO)getResponseObject(); - if (responseObject != null) { - response.setSuccess(responseObject); - } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router"); - } + response.setId(router.getId()); + response.setZoneId(router.getDataCenterId()); + response.setZoneName(ApiDBUtils.findZoneById(router.getDataCenterId()).getName()); + response.setDns1(router.getDns1()); + response.setDns2(router.getDns2()); + response.setNetworkDomain(router.getDomain()); + response.setGateway(router.getGateway()); + response.setName(router.getName()); + response.setPodId(router.getPodId()); + if (router.getHostId() != null) { + response.setHostId(router.getHostId()); + response.setHostName(ApiDBUtils.findHostById(router.getHostId()).getName()); + } + + response.setPrivateIp(router.getPrivateIpAddress()); + response.setPrivateMacAddress(router.getPrivateMacAddress()); + response.setPrivateNetmask(router.getPrivateNetmask()); + response.setPublicIp(router.getPublicIpAddress()); + response.setPublicMacAddress(router.getPublicMacAddress()); + response.setPublicNetmask(router.getPublicNetmask()); + response.setGuestIpAddress(router.getGuestIpAddress()); + response.setGuestMacAddress(router.getGuestMacAddress()); + response.setGuestNetmask(router.getGuestNetmask()); + response.setTemplateId(router.getTemplateId()); + response.setCreated(router.getCreated()); + response.setState(router.getState()); + + Account accountTemp = ApiDBUtils.findAccountById(router.getAccountId()); + if (accountTemp != null) { + response.setAccountName(accountTemp.getAccountName()); + response.setDomainId(accountTemp.getDomainId()); + response.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName()); + } + response.setResponseName(getName()); return response; } diff --git a/server/src/com/cloud/api/commands/RegisterIsoCmd.java b/server/src/com/cloud/api/commands/RegisterIsoCmd.java index 13f443a0f2e..372242b3c11 100755 --- a/server/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/server/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -145,7 +145,7 @@ public class RegisterIsoCmd extends BaseCmd { templateResponse.setFeatured(template.isFeatured()); templateResponse.setBootable(template.isBootable()); templateResponse.setOsTypeId(template.getGuestOSId()); - templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getName()); + templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getDisplayName()); Account owner = ApiDBUtils.findAccountById(template.getAccountId()); if (owner != null) { diff --git a/server/src/com/cloud/api/commands/UpdateCfgCmd.java b/server/src/com/cloud/api/commands/UpdateCfgCmd.java index 4ea9fa85c8f..2c39f50ce87 100644 --- a/server/src/com/cloud/api/commands/UpdateCfgCmd.java +++ b/server/src/com/cloud/api/commands/UpdateCfgCmd.java @@ -69,6 +69,7 @@ public class UpdateCfgCmd extends BaseCmd { if (responseObject != null) { response.setSuccess(responseObject); + response.setDisplayText("Successfully updated configuration value."); } else { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config"); } diff --git a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java index 07145bedbc8..23dc4dbe00a 100644 --- a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java @@ -19,13 +19,12 @@ package com.cloud.api.commands; import org.apache.log4j.Logger; -import com.cloud.api.ApiDBUtils; import com.cloud.api.BaseCmd; import com.cloud.api.BaseCmd.Manager; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.api.response.DiskOfferingResponse; +import com.cloud.api.response.SuccessResponse; import com.cloud.storage.DiskOfferingVO; @Implementation(method="updateDiskOffering", manager=Manager.ConfigManager, description="Updates a disk offering.") @@ -80,19 +79,11 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ } @SuppressWarnings("unchecked") - public DiskOfferingResponse getResponse() { - DiskOfferingResponse response = new DiskOfferingResponse(); + public SuccessResponse getResponse() { + SuccessResponse response = new SuccessResponse(); DiskOfferingVO responseObject = (DiskOfferingVO)getResponseObject(); if (responseObject != null) { - response.setId(responseObject.getId()); - response.setCreated(responseObject.getCreated()); - response.setDiskSize(responseObject.getDiskSize()); - response.setDisplayText(responseObject.getDisplayText()); - response.setDomainId(responseObject.getDomainId()); - response.setName(responseObject.getName()); - response.setTags(responseObject.getTags()); - response.setDomainId(ApiDBUtils.findDomainById(responseObject.getDomainId()).getId()); - response.setDomain(ApiDBUtils.findDomainById(responseObject.getDomainId()).getName()); + response.setSuccess(Boolean.TRUE); } else { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering"); } diff --git a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java index 361b66f2cd9..df7b12f75cc 100644 --- a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java +++ b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java @@ -103,7 +103,7 @@ public class UpdateResourceLimitCmd extends BaseCmd { response.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName()); } } - response.setResourceType(limit.getType().ordinal()); + response.setResourceType(Integer.valueOf(limit.getType().ordinal()).toString()); response.setMax(limit.getMax()); response.setResponseName(getName()); diff --git a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java index 83d2454781a..101a3073bae 100644 --- a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java @@ -101,6 +101,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd { response.setDisplayText(offering.getDisplayText()); response.setCpuNumber(offering.getCpu()); response.setCpuSpeed(offering.getSpeed()); + response.setMemory(offering.getRamSize()); response.setCreated(offering.getCreated()); String storageType = offering.getUseLocalStorage() ? "local" : "shared"; response.setStorageType(storageType); diff --git a/server/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java b/server/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java index 322c412a900..2a368d458f2 100644 --- a/server/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java +++ b/server/src/com/cloud/api/commands/UpdateTemplateOrIsoCmd.java @@ -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; } - } diff --git a/server/src/com/cloud/api/commands/UpgradeVMCmd.java b/server/src/com/cloud/api/commands/UpgradeVMCmd.java index ee11b9b4792..cfb2b091b59 100644 --- a/server/src/com/cloud/api/commands/UpgradeVMCmd.java +++ b/server/src/com/cloud/api/commands/UpgradeVMCmd.java @@ -17,6 +17,8 @@ */ package com.cloud.api.commands; +import java.text.DecimalFormat; + import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; @@ -25,7 +27,7 @@ import com.cloud.api.BaseCmd.Manager; import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; -import com.cloud.api.response.UpgradeVmResponse; +import com.cloud.api.response.UserVmResponse; import com.cloud.offering.ServiceOffering; import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.VMTemplateVO; @@ -76,13 +78,14 @@ public class UpgradeVMCmd extends BaseCmd { } @Override @SuppressWarnings("unchecked") - public UpgradeVmResponse getResponse() { + public UserVmResponse getResponse() { UserVmVO userVm = (UserVmVO)getResponseObject(); - UpgradeVmResponse response = new UpgradeVmResponse(); + UserVmResponse response = new UserVmResponse(); if (userVm != null) { Account acct = ApiDBUtils.findAccountById(userVm.getAccountId()); - response.setAccount(acct.getAccountName()); + response.setId(userVm.getId()); + response.setAccountName(acct.getAccountName()); ServiceOffering offering = ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId()); response.setCpuSpeed(offering.getSpeed()); @@ -94,17 +97,26 @@ public class UpgradeVMCmd extends BaseCmd { } response.setServiceOfferingId(userVm.getServiceOfferingId()); - + + //stats calculation + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + String cpuUsed = null; VmStats vmStats = ApiDBUtils.getVmStatistics(userVm.getId()); if (vmStats != null) { - response.setCpuUsed((long) vmStats.getCPUUtilization()); - response.setNetworkKbsRead((long) vmStats.getNetworkReadKBs()); - response.setNetworkKbsWrite((long) vmStats.getNetworkWriteKBs()); + float cpuUtil = (float) vmStats.getCPUUtilization(); + cpuUsed = decimalFormat.format(cpuUtil) + "%"; + response.setCpuUsed(cpuUsed); + + long networkKbRead = (long)vmStats.getNetworkReadKBs(); + response.setNetworkKbsRead(networkKbRead); + + long networkKbWrite = (long)vmStats.getNetworkWriteKBs(); + response.setNetworkKbsWrite(networkKbWrite); } response.setCreated(userVm.getCreated()); response.setDisplayName(userVm.getDisplayName()); - response.setDomain(ApiDBUtils.findDomainById(acct.getDomainId()).getName()); + response.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName()); response.setDomainId(acct.getDomainId()); response.setHaEnable(userVm.isHaEnabled()); diff --git a/server/src/com/cloud/api/response/DomainRouterResponse.java b/server/src/com/cloud/api/response/DomainRouterResponse.java index f2aeedd461a..c7037829ca2 100644 --- a/server/src/com/cloud/api/response/DomainRouterResponse.java +++ b/server/src/com/cloud/api/response/DomainRouterResponse.java @@ -84,7 +84,7 @@ public class DomainRouterResponse extends BaseResponse { @SerializedName("guestipaddress") @Param(description="the guest IP address for the router") private String guestIpAddress; - @SerializedName("guestmacaddress") @Param(description="the guest MAC address for the router") + @SerializedName("macaddress") @Param(description="the guest MAC address for the router") private String guestMacAddress; @SerializedName("guestnetmask") @Param(description="the guest netmask for the router") diff --git a/server/src/com/cloud/api/response/ResourceLimitResponse.java b/server/src/com/cloud/api/response/ResourceLimitResponse.java index 5b4ba74a4df..3c501397201 100644 --- a/server/src/com/cloud/api/response/ResourceLimitResponse.java +++ b/server/src/com/cloud/api/response/ResourceLimitResponse.java @@ -31,7 +31,7 @@ public class ResourceLimitResponse extends BaseResponse { private String domainName; @SerializedName("resourcetype") @Param(description="resource type. Values include 0, 1, 2, 3, 4. See the resourceType parameter for more information on these values.") - private Integer resourceType; + private String resourceType; @SerializedName("max") @Param(description="the maximum number of the resource. A -1 means the resource currently has no limit.") private Long max; @@ -60,11 +60,11 @@ public class ResourceLimitResponse extends BaseResponse { this.domainName = domainName; } - public Integer getResourceType() { + public String getResourceType() { return resourceType; } - public void setResourceType(Integer resourceType) { + public void setResourceType(String resourceType) { this.resourceType = resourceType; } diff --git a/server/src/com/cloud/api/response/SuccessResponse.java b/server/src/com/cloud/api/response/SuccessResponse.java index 19576261eb9..14b5c4fce2e 100644 --- a/server/src/com/cloud/api/response/SuccessResponse.java +++ b/server/src/com/cloud/api/response/SuccessResponse.java @@ -7,6 +7,9 @@ public class SuccessResponse extends BaseResponse { @SerializedName("success") @Param(description="true if operation is executed successfully") private Boolean success; + @SerializedName("displaytext") @Param(description="any text associated with the success or failure") + private String displayText; + public Boolean getSuccess() { return success; } @@ -14,4 +17,12 @@ public class SuccessResponse extends BaseResponse { public void setSuccess(Boolean success) { this.success = success; } + + public String getDisplayText() { + return displayText; + } + + public void setDisplayText(String displayText) { + this.displayText = displayText; + } } diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3aac91cac2c..d441dd512f5 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -1099,7 +1099,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager { public ServiceOfferingVO updateServiceOffering(UpdateServiceOfferingCmd cmd) { String displayText = cmd.getDisplayText(); Long id = cmd.getId(); - String name = cmd.getName(); + String name = cmd.getServiceOfferingName(); Boolean ha = cmd.getOfferHa(); String tags = cmd.getTags(); Boolean useVirtualNetwork = cmd.getUseVirtualNetwork(); diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java index a17bef17278..1f0823a3a13 100644 --- a/server/src/com/cloud/network/NetworkManager.java +++ b/server/src/com/cloud/network/NetworkManager.java @@ -144,10 +144,10 @@ public interface NetworkManager extends Manager { /** * Reboots domain router * @param cmd the command specifying router's id - * @return success or failure + * @return the rebooted router * @throws InvalidParameterValueException, PermissionDeniedException */ - boolean rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException; + DomainRouterVO rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException; /** * @param hostId get all of the virtual machine routers on a host. * @return collection of VirtualMachineRouter diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 1d5a270075d..ab8f755254d 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -422,16 +422,16 @@ public class NetworkManagerImpl implements NetworkManager, DomainRouterService { public boolean rebootRouter(final long routerId, long startEventId) { return _routerMgr.rebootRouter(routerId, startEventId); } - + @Override - public boolean rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException{ - return _routerMgr.rebootRouter(cmd); + public DomainRouterVO rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException{ + _routerMgr.rebootRouter(cmd); + return _routerMgr.getRouter(cmd.getId()); } @Override public boolean associateIP(final DomainRouterVO router, final List ipAddrList, final boolean add, long vmId) { Commands cmds = new Commands(OnError.Continue); - int i=0; boolean sourceNat = false; for (final String ipAddress: ipAddrList) { if (ipAddress.equalsIgnoreCase(router.getPublicIpAddress())) diff --git a/server/src/com/cloud/server/ManagementServer.java b/server/src/com/cloud/server/ManagementServer.java index f6278a5686e..e6d189d26c1 100644 --- a/server/src/com/cloud/server/ManagementServer.java +++ b/server/src/com/cloud/server/ManagementServer.java @@ -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); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 0bf1a5591b8..0fe1e29d75a 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -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(); diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 0759115fc98..b7282e96750 100644 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -410,6 +410,7 @@ public class AccountManagerImpl implements AccountManager { public ResourceLimitVO updateResourceLimit(UpdateResourceLimitCmd cmd) throws InvalidParameterValueException { Account account = (Account)UserContext.current().getAccount(); + String accountName = cmd.getAccountName(); Long domainId = cmd.getDomainId(); Long max = cmd.getMax(); Integer type = cmd.getResourceType(); @@ -447,9 +448,9 @@ public class AccountManagerImpl implements AccountManager { } if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { - if ((domainId != null) && (account.getAccountName() == null) && domainId.equals(account.getDomainId())) { + if ((domainId != null) && (accountName == null) && domainId.equals(account.getDomainId())) { // if the admin is trying to update their own domain, disallow... - throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update resource limit for " + ((account.getAccountName() == null) ? "" : "account " + account.getAccountName() + " in ") + "domain " + domainId + ", permission denied"); + throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update resource limit for domain " + domainId + ", permission denied"); } // If there is an existing ROOT domain limit, make sure its max isn't being exceeded @@ -471,15 +472,12 @@ public class AccountManagerImpl implements AccountManager { if (domainId == null) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to update resource limit, unable to determine domain in which to update limit."); - } else if (account != null) { - if (account.getAccountName() != null) { - Account userAccount = _accountDao.findActiveAccount(account.getAccountName(), domainId); - if (userAccount == null) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account by name " + account.getAccountName() + " in domain with id " + domainId); - } - accountId = userAccount.getId(); - domainId = userAccount.getDomainId(); + } else if (accountName != null) { + Account userAccount = _accountDao.findActiveAccount(accountName, domainId); + if (userAccount == null) { + throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account by name " + account.getAccountName() + " in domain with id " + domainId); } + accountId = userAccount.getId(); } if (accountId != null) domainId = null; diff --git a/ui/new/css/jquery-ui-1.8.2.custom.css b/ui/new/css/jquery-ui-1.8.2.custom.css index 00ea6f1a02c..dbc6b0e1672 100755 --- a/ui/new/css/jquery-ui-1.8.2.custom.css +++ b/ui/new/css/jquery-ui-1.8.2.custom.css @@ -34,7 +34,7 @@ ----------------------------------*/ /* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index:1007;} /* diff --git a/ui/new/css/main.css b/ui/new/css/main.css index 7fb1868b866..2c28a9c1158 100644 --- a/ui/new/css/main.css +++ b/ui/new/css/main.css @@ -9,7 +9,7 @@ html,body{ font-family:Arial, Helvetica, sans-serif; font-size:11px; - color:#717171; + color:#333; height:auto; font-weight:normal; background:#00374e url(../images/login_bg.gif) repeat-x top left; @@ -270,7 +270,7 @@ a:hover { top: 0%; left: 0%; width: 100%; - min-height: 1070px; + min-height: 1000px; height: 100%; background-color: black; z-index:1001; @@ -280,6 +280,8 @@ a:hover { overflow:hidden; } + + .vmpopup_container { width:737px; height:505px; @@ -2153,6 +2155,27 @@ a:hover.search_button { padding:0; } +.midmenu_itemheader { + width:220px; + height:auto; + float:left; + background:#989898 url(../images/midmenu_titlebg.gif) repeat-x top left; + margin:0; + padding:0 0 4px 0; +} + +.midmenu_titlebox p{ + width:220px; + height:auto; + float:left; + color:#333; + text-align:left; + font-weight:bold; + font-size:11px; + margin:3px 0 0 10px; + padding:0; +} + .midmenu_content{ width:220px; height:auto; @@ -2167,9 +2190,10 @@ a:hover.search_button { padding:0 0 4px 0; } -.midmenu_content.selected{ - background:#626262 url(../images/leftmenu_selected.gif) repeat-x top left;7497ae url(../images/mid_addingbg.gif) repeat-x top left; - color:#FFF; +.midmenu_content.selected { + background:#626262 url(../images/leftmenu_selected.gif) repeat-x top left; + color:#FFF !important; + } .midmenu_content.inaction{ @@ -2205,6 +2229,17 @@ a:hover.search_button { } .midmenu_textbox p { + width:165px; + height:auto; + float:left; + text-align:left; + font-weight:normal; + font-size:11px; + margin:3px 0 0 0; + padding:0; + +} +.midmenu_textbox span { width:165px; height:auto; float:left; @@ -2213,6 +2248,7 @@ a:hover.search_button { font-size:10px; margin:3px 0 0 0; padding:0; + color:#999; } @@ -2222,14 +2258,16 @@ a:hover.search_button { height:auto; margin:0 0 0 221px; padding:0; + position:relative; } .main_contentarea_without_midmenu { width:auto; min-height:1000px; height:auto; - margin:0 0 0 10px; + margin:0 0 0 0; padding:0; + position:relative; } .main_title { @@ -2309,6 +2347,41 @@ a:hover.search_button { cursor:hand; } +.rightpanel_mainloaderbox { + width:auto; + height:auto; + position:absolute; + top:30%; + left:40%; + background:#FFF; + border:1px solid #CCC; + margin:0; + padding:0; + z-index:1008; +} + +.rightpanel_mainloaderbox p{ + width:auto; + height:auto; + float:left; + color:#333; + font-size:16px; + font-weight:normal; + margin:15px 10px 0 10px; + display:inline; + padding:0; +} +.rightpanel_mainloader_animatedicon { + width:40px; + height:40px; + float:left; + background:url(../images/big_loading.gif) no-repeat top left; + margin:3px 0 0 5px; + display:inline; + padding:0; +} + + .text_container { width:100%; height:auto; diff --git a/ui/new/images/big_loading.gif b/ui/new/images/big_loading.gif index 375efeec9b2..59b42658faf 100644 Binary files a/ui/new/images/big_loading.gif and b/ui/new/images/big_loading.gif differ diff --git a/ui/new/images/midmenu_titlebg.gif b/ui/new/images/midmenu_titlebg.gif new file mode 100644 index 00000000000..f8fbafd737e Binary files /dev/null and b/ui/new/images/midmenu_titlebg.gif differ diff --git a/ui/new/images/midmenuicon_host.png b/ui/new/images/midmenuicon_host.png index 5bd2ab897fb..e429c7ffe16 100644 Binary files a/ui/new/images/midmenuicon_host.png and b/ui/new/images/midmenuicon_host.png differ diff --git a/ui/new/images/midmenuicon_primarystorage.png b/ui/new/images/midmenuicon_primarystorage.png index c72f04d7554..3486191c8b5 100644 Binary files a/ui/new/images/midmenuicon_primarystorage.png and b/ui/new/images/midmenuicon_primarystorage.png differ diff --git a/ui/new/index.jsp b/ui/new/index.jsp index ae777103bba..bee9823d813 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -225,6 +225,14 @@ long milliseconds = new Date().getTime(); <%=t.t("add")%> + - + +