mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Api refactor:
* Moved ManagementServer interface from "core" to "server" package * Changed AddConfig, UpdateCfg, UpdateAccount commands
This commit is contained in:
parent
8825147f0d
commit
167433e562
@ -24,8 +24,10 @@ import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
|
||||
@Implementation(method="addConfig", manager=Manager.ManagementServer)
|
||||
@Implementation(method="addConfig", manager=Manager.ConfigManager)
|
||||
public class AddConfigCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddConfigCmd.class.getName());
|
||||
|
||||
@ -87,6 +89,7 @@ public class AddConfigCmd extends BaseCmd {
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return s_name;
|
||||
|
||||
@ -25,24 +25,19 @@ import java.util.Map;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@Implementation(method="updateAccount", manager=Manager.ManagementServer)
|
||||
public class UpdateAccountCmd extends BaseCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateAccountCmd.class.getName());
|
||||
private static final String s_name = "updateaccountresponse";
|
||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||
|
||||
static {
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NEW_NAME, Boolean.TRUE));
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT, Boolean.TRUE));
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.DOMAIN_ID, Boolean.TRUE));
|
||||
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -80,52 +75,48 @@ public class UpdateAccountCmd extends BaseCmd{
|
||||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
@Override
|
||||
public List<Pair<Enum, Boolean>> getProperties() {
|
||||
return s_properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||
Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName());
|
||||
String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName());
|
||||
String newAccountName = (String)params.get(BaseCmd.Properties.NEW_NAME.getName());
|
||||
Account adminAccount = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());;
|
||||
Boolean updateAccountResult = false;
|
||||
Account account = null;
|
||||
|
||||
// check if account exists in the system
|
||||
account = getManagementServer().findAccountByName(accountName, domainId);
|
||||
if (account == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account " + accountName + " in domain " + domainId);
|
||||
}
|
||||
|
||||
if ((adminAccount != null) && !getManagementServer().isChildDomain(adminAccount.getDomainId(), account.getDomainId())) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid account " + accountName + " in domain " + domainId + " given, unable to update account.");
|
||||
}
|
||||
|
||||
// don't allow modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not modify system account");
|
||||
}
|
||||
|
||||
try {
|
||||
getManagementServer().updateAccount(account.getId(), newAccountName);
|
||||
account = getManagementServer().findAccountById(account.getId());
|
||||
if (account.getAccountName().equals(newAccountName)) {
|
||||
updateAccountResult = true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("Exception updating account", ex);
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account " + accountName + " in domain " + domainId + ": internal error.");
|
||||
}
|
||||
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
if (updateAccountResult == true) {
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), new Boolean(true)));
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account " + accountName + " in domain " + domainId);
|
||||
}
|
||||
return returnValues;
|
||||
}
|
||||
// @Override
|
||||
// public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||
// Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName());
|
||||
// String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName());
|
||||
// String newAccountName = (String)params.get(BaseCmd.Properties.NEW_NAME.getName());
|
||||
// Account adminAccount = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName());;
|
||||
// Boolean updateAccountResult = false;
|
||||
// Account account = null;
|
||||
//
|
||||
// // check if account exists in the system
|
||||
// account = getManagementServer().findAccountByName(accountName, domainId);
|
||||
// if (account == null) {
|
||||
// throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account " + accountName + " in domain " + domainId);
|
||||
// }
|
||||
//
|
||||
// if ((adminAccount != null) && !getManagementServer().isChildDomain(adminAccount.getDomainId(), account.getDomainId())) {
|
||||
// throw new ServerApiException(BaseCmd.PARAM_ERROR, "Invalid account " + accountName + " in domain " + domainId + " given, unable to update account.");
|
||||
// }
|
||||
//
|
||||
// // don't allow modify system account
|
||||
// if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "can not modify system account");
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// getManagementServer().updateAccount(account.getId(), newAccountName);
|
||||
// account = getManagementServer().findAccountById(account.getId());
|
||||
// if (account.getAccountName().equals(newAccountName)) {
|
||||
// updateAccountResult = true;
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// s_logger.error("Exception updating account", ex);
|
||||
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account " + accountName + " in domain " + domainId + ": internal error.");
|
||||
// }
|
||||
//
|
||||
// List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
// if (updateAccountResult == true) {
|
||||
// returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), new Boolean(true)));
|
||||
// } else {
|
||||
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account " + accountName + " in domain " + domainId);
|
||||
// }
|
||||
// return returnValues;
|
||||
// }
|
||||
}
|
||||
|
||||
@ -25,23 +25,18 @@ import java.util.Map;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
@Implementation(method="updateConfiguration", manager=Manager.ConfigManager)
|
||||
public class UpdateCfgCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateCfgCmd.class.getName());
|
||||
|
||||
private static final String s_name = "updateconfigurationresponse";
|
||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||
|
||||
static {
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.NAME, Boolean.TRUE));
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.VALUE, Boolean.FALSE));
|
||||
|
||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
@ -72,30 +67,27 @@ public class UpdateCfgCmd extends BaseCmd {
|
||||
public String getName() {
|
||||
return s_name;
|
||||
}
|
||||
public List<Pair<Enum, Boolean>> getProperties() {
|
||||
return s_properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||
String name = (String) params.get(BaseCmd.Properties.NAME.getName());
|
||||
String value = (String) params.get(BaseCmd.Properties.VALUE.getName());
|
||||
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
}
|
||||
|
||||
try {
|
||||
getManagementServer().updateConfiguration(userId, name, value);
|
||||
} catch (Exception ex) {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
|
||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), "true"));
|
||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), "Successfully updated configuration value."));
|
||||
|
||||
return returnValues;
|
||||
}
|
||||
// @Override
|
||||
// public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||
// String name = (String) params.get(BaseCmd.Properties.NAME.getName());
|
||||
// String value = (String) params.get(BaseCmd.Properties.VALUE.getName());
|
||||
// Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||
//
|
||||
// if (userId == null) {
|
||||
// userId = Long.valueOf(User.UID_SYSTEM);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// getManagementServer().updateConfiguration(userId, name, value);
|
||||
// } catch (Exception ex) {
|
||||
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
|
||||
// }
|
||||
//
|
||||
// List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||
// returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), "true"));
|
||||
// returnValues.add(new Pair<String, Object>(BaseCmd.Properties.DISPLAY_TEXT.getName(), "Successfully updated configuration value."));
|
||||
//
|
||||
// return returnValues;
|
||||
// }
|
||||
}
|
||||
|
||||
@ -19,8 +19,10 @@ package com.cloud.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.commands.AddConfigCmd;
|
||||
import com.cloud.api.commands.CreateDiskOfferingCmd;
|
||||
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
||||
import com.cloud.api.commands.UpdateCfgCmd;
|
||||
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
||||
import com.cloud.api.commands.UpdateZoneCmd;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
@ -47,6 +49,16 @@ public interface ConfigurationManager extends Manager {
|
||||
*/
|
||||
void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* Updates a configuration entry with a new value
|
||||
* @param userId
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
void updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new service offering
|
||||
* @param id
|
||||
@ -84,7 +96,7 @@ public interface ConfigurationManager extends Manager {
|
||||
* @param tags
|
||||
* @return updated disk offering
|
||||
*/
|
||||
DiskOfferingVO updateDiskOffering(UpdateDiskOfferingCmd cmd);
|
||||
DiskOfferingVO updateDiskOffering(UpdateDiskOfferingCmd cmd) throws InvalidParameterValueException;
|
||||
|
||||
/**
|
||||
* Deletes a disk offering
|
||||
@ -238,5 +250,5 @@ public interface ConfigurationManager extends Manager {
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
public boolean addConfig(String instance, String component,String category, String name, String value, String description);
|
||||
public boolean addConfig(AddConfigCmd cmd);
|
||||
}
|
||||
|
||||
@ -33,8 +33,10 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.commands.AddConfigCmd;
|
||||
import com.cloud.api.commands.CreateDiskOfferingCmd;
|
||||
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
||||
import com.cloud.api.commands.UpdateCfgCmd;
|
||||
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
||||
import com.cloud.api.commands.UpdateZoneCmd;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
@ -158,6 +160,13 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_CONFIGURATION_VALUE_EDIT, "Successfully edited configuration value.", "name=" + name, "value=" + value);
|
||||
}
|
||||
|
||||
public void updateConfiguration(UpdateCfgCmd cmd) throws InvalidParameterValueException, InternalErrorException{
|
||||
long userId = UserContext.current().getUserId();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
updateConfiguration (userId, name, value);
|
||||
}
|
||||
|
||||
|
||||
private String validateConfigurationValue(String name, String value) throws InvalidParameterValueException {
|
||||
if (value == null) {
|
||||
@ -921,18 +930,25 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||
return _diskOfferingDao.persist(newDiskOffering);
|
||||
}
|
||||
|
||||
public DiskOfferingVO updateDiskOffering(UpdateDiskOfferingCmd cmd) {
|
||||
public DiskOfferingVO updateDiskOffering(UpdateDiskOfferingCmd cmd) throws InvalidParameterValueException{
|
||||
Long diskOfferingId = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String displayText = cmd.getDisplayText();
|
||||
String tags = cmd.getTags();
|
||||
|
||||
//Check if diskOffering exists
|
||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId);
|
||||
|
||||
if (diskOffering == null) {
|
||||
throw new InvalidParameterValueException("Unable to find disk offering by id " + diskOfferingId);
|
||||
}
|
||||
|
||||
boolean updateNeeded = (name != null || displayText != null || tags != null);
|
||||
if (!updateNeeded) {
|
||||
return _diskOfferingDao.findById(diskOfferingId);
|
||||
}
|
||||
|
||||
DiskOfferingVO diskOffering = _diskOfferingDao.createForUpdate(diskOfferingId);
|
||||
diskOffering = _diskOfferingDao.createForUpdate(diskOfferingId);
|
||||
|
||||
if (name != null) {
|
||||
diskOffering.setName(name);
|
||||
@ -1735,8 +1751,13 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addConfig(String instance, String component,String category, String name, String value, String description)
|
||||
{
|
||||
public boolean addConfig(AddConfigCmd cmd){
|
||||
String category = cmd.getCategory();
|
||||
String instance = cmd.getInstance();
|
||||
String component = cmd.getComponent();
|
||||
String name = cmd.getName();
|
||||
String value = cmd.getValue();
|
||||
String description = cmd.getDescription();
|
||||
try
|
||||
{
|
||||
ConfigurationVO entity = new ConfigurationVO(category, instance, component, name, value, description);
|
||||
|
||||
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.alert.AlertVO;
|
||||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.AsyncJobVO;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
@ -98,6 +99,7 @@ import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VmStats;
|
||||
|
||||
|
||||
/**
|
||||
* ManagementServer is the interface to talk to the Managment Server.
|
||||
* This will be the line drawn between the UI and MS. If we need to build
|
||||
@ -223,7 +225,7 @@ public interface ManagementServer {
|
||||
* @return true if update was successful, false otherwise
|
||||
*/
|
||||
|
||||
boolean updateAccount(long accountId, String accountName);
|
||||
boolean updateAccount(UpdateAccountCmd cmd) throws InvalidParameterValueException;
|
||||
|
||||
/**
|
||||
* Enables a user by userId
|
||||
@ -1030,20 +1032,20 @@ public interface ManagementServer {
|
||||
*/
|
||||
DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String dns3, String dns4, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
/**
|
||||
* Edits a zone in the database
|
||||
* @param userId
|
||||
* @param zoneId
|
||||
* @param newZoneName
|
||||
* @param dns1
|
||||
* @param dns2
|
||||
* @param dns3
|
||||
* @param dns4
|
||||
* @param vnetRange range of the vnet to add to the zone.
|
||||
* @param guestNetworkCidr
|
||||
* @return Zone
|
||||
*/
|
||||
DataCenterVO editZone(long userId, Long zoneId, String newZoneName, String dns1, String dns2, String dns3, String dns4, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException;
|
||||
// /**
|
||||
// * Edits a zone in the database
|
||||
// * @param userId
|
||||
// * @param zoneId
|
||||
// * @param newZoneName
|
||||
// * @param dns1
|
||||
// * @param dns2
|
||||
// * @param dns3
|
||||
// * @param dns4
|
||||
// * @param vnetRange range of the vnet to add to the zone.
|
||||
// * @param guestNetworkCidr
|
||||
// * @return Zone
|
||||
// */
|
||||
// DataCenterVO editZone(long userId, Long zoneId, String newZoneName, String dns1, String dns2, String dns3, String dns4, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
/**
|
||||
* Deletes a zone from the database
|
||||
@ -1436,7 +1438,7 @@ public interface ManagementServer {
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException;
|
||||
// void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException;
|
||||
|
||||
/**
|
||||
* Creates or updates an IP forwarding or load balancer rule.
|
||||
@ -2132,7 +2134,7 @@ public interface ManagementServer {
|
||||
|
||||
boolean checkLocalStorageConfigVal();
|
||||
|
||||
boolean addConfig(String instance, String component, String category, String name, String value, String description);
|
||||
// boolean addConfig(String instance, String component, String category, String name, String value, String description);
|
||||
|
||||
boolean validateCustomVolumeSizeRange(long size) throws InvalidParameterValueException;
|
||||
}
|
||||
@ -76,6 +76,7 @@ import com.cloud.api.commands.ReconnectHostCmd;
|
||||
import com.cloud.api.commands.StartRouterCmd;
|
||||
import com.cloud.api.commands.StartSystemVMCmd;
|
||||
import com.cloud.api.commands.StartVMCmd;
|
||||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.api.commands.UpgradeVMCmd;
|
||||
import com.cloud.async.AsyncInstanceCreateStatus;
|
||||
import com.cloud.async.AsyncJobExecutor;
|
||||
@ -1137,15 +1138,41 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateAccount(long accountId, String accountName) {
|
||||
public boolean updateAccount(UpdateAccountCmd cmd) throws InvalidParameterValueException{
|
||||
Long domainId = cmd.getDomainId();
|
||||
String accountName = cmd.getAccountName();
|
||||
String newAccountName = cmd.getNewName();
|
||||
|
||||
if (newAccountName == null) {
|
||||
newAccountName = accountName;
|
||||
}
|
||||
|
||||
boolean success = false;
|
||||
AccountVO account = _accountDao.findById(accountId);
|
||||
if ((account == null) || (account.getAccountName().equals(accountName))) {
|
||||
Account account = _accountDao.findAccount(accountName, domainId);
|
||||
|
||||
//Check if account exists
|
||||
if (account == null) {
|
||||
s_logger.error("Unable to find account " + accountName + " in domain " + domainId);
|
||||
throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain " + domainId);
|
||||
}
|
||||
|
||||
//Don't allow to modify system account
|
||||
if (account.getId().longValue() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new InvalidParameterValueException ("Can not modify system account");
|
||||
}
|
||||
|
||||
//Check if user performing the action is allowed to modify this account
|
||||
Account adminAccount = (Account)UserContext.current().getAccountObject();
|
||||
if ((adminAccount != null) && isChildDomain(adminAccount.getDomainId(), account.getDomainId())) {
|
||||
throw new InvalidParameterValueException("Invalid account " + accountName + " in domain " + domainId + " given, unable to update account.");
|
||||
}
|
||||
|
||||
if (account.getAccountName().equals(accountName)) {
|
||||
success = true;
|
||||
} else {
|
||||
AccountVO acctForUpdate = _accountDao.createForUpdate();
|
||||
acctForUpdate.setAccountName(accountName);
|
||||
success = _accountDao.update(Long.valueOf(accountId), acctForUpdate);
|
||||
acctForUpdate.setAccountName(newAccountName);
|
||||
success = _accountDao.update(Long.valueOf(account.getId()), acctForUpdate);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -4204,11 +4231,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return _hostPodDao.listByDataCenterId(dataCenterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfiguration(long userId, String name, String value) throws InvalidParameterValueException, InternalErrorException {
|
||||
_configMgr.updateConfiguration(userId, name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) {
|
||||
return _configMgr.createServiceOffering(userId, name, cpu, ramSize, speed, displayText, localStorageRequired, offerHA, useVirtualNetwork, tags);
|
||||
@ -4240,10 +4262,10 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return _configMgr.createZone(userId, zoneName, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataCenterVO editZone(long userId, Long zoneId, String newZoneName, String dns1, String dns2, String dns3, String dns4, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException {
|
||||
return _configMgr.editZone(userId, zoneId, newZoneName, dns1, dns2, dns3, dns4, vnetRange, guestCidr);
|
||||
}
|
||||
// @Override
|
||||
// public DataCenterVO editZone(long userId, Long zoneId, String newZoneName, String dns1, String dns2, String dns3, String dns4, String vnetRange, String guestCidr) throws InvalidParameterValueException, InternalErrorException {
|
||||
// return _configMgr.editZone(userId, zoneId, newZoneName, dns1, dns2, dns3, dns4, vnetRange, guestCidr);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void deleteZone(long userId, Long zoneId) throws InvalidParameterValueException, InternalErrorException {
|
||||
@ -8185,12 +8207,6 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addConfig(String instance, String component,String category, String name, String value, String description)
|
||||
{
|
||||
return _configMgr.addConfig(category, instance, component, name, value, description);
|
||||
}
|
||||
|
||||
public boolean preparePrimaryStorageForMaintenance(long primaryStorageId, long userId) {
|
||||
return _storageMgr.preparePrimaryStorageForMaintenance(primaryStorageId, userId);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user