mirror of https://github.com/apache/cloudstack.git
quota: fix stuff
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
8c81b02d9e
commit
124d1da209
|
|
@ -39,7 +39,6 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
|||
public static final String ACCOUNT_STATE_DISABLED = "disabled";
|
||||
public static final String ACCOUNT_STATE_ENABLED = "enabled";
|
||||
public static final String ACCOUNT_STATE_LOCKED = "locked";
|
||||
public static final String ACCOUNT_STATE_NOCREDIT = "nocredit";
|
||||
|
||||
public static final long ACCOUNT_ID_SYSTEM = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,4 @@ public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long>
|
|||
boolean isDynamic(long serviceOfferingId);
|
||||
|
||||
ServiceOfferingVO getcomputeOffering(ServiceOfferingVO serviceOffering, Map<String, String> customParameters);
|
||||
|
||||
ServiceOfferingVO findServiceOffering(Long vmId, long serviceOfferingId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,11 @@ import com.cloud.utils.db.DB;
|
|||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
|
||||
@Component
|
||||
@Local(value = { ServiceOfferingDao.class })
|
||||
@Local(value = {ServiceOfferingDao.class})
|
||||
@DB()
|
||||
public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Long> implements ServiceOfferingDao {
|
||||
protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
|
||||
|
|
@ -106,8 +105,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
|||
assert offering.getUniqueName() != null : "how are you going to find this later if you don't set it?";
|
||||
ServiceOfferingVO vo = findByName(offering.getUniqueName());
|
||||
if (vo != null) {
|
||||
// check invalid CPU speed in system service offering, set it to
|
||||
// default value of 500 Mhz if 0 CPU speed is found
|
||||
// check invalid CPU speed in system service offering, set it to default value of 500 Mhz if 0 CPU speed is found
|
||||
if (vo.getSpeed() <= 0) {
|
||||
vo.setSpeed(500);
|
||||
update(vo.getId(), vo);
|
||||
|
|
@ -237,21 +235,8 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
|
|||
if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) {
|
||||
dummyoffering.setRamSize(Integer.parseInt(customParameters.get(UsageEventVO.DynamicParameters.memory.name())));
|
||||
}
|
||||
|
||||
return dummyoffering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceOfferingVO findServiceOffering(final Long vmId, final long serviceOfferingId) {
|
||||
final short opendb = TransactionLegacy.currentTxn().getDatabaseId();
|
||||
TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
|
||||
ServiceOfferingVO result;
|
||||
try {
|
||||
result = findById(vmId, serviceOfferingId);
|
||||
} finally {
|
||||
txn.close();
|
||||
}
|
||||
TransactionLegacy.open(opendb).close();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,6 @@ DELETE FROM `cloud`.`configuration` WHERE name like 'saml%' and component='manag
|
|||
|
||||
ALTER TABLE `cloud`.`user` ADD COLUMN `external_entity` text DEFAULT NULL COMMENT "reference to external federation entity";
|
||||
|
||||
ALTER TABLE `cloud_usage`.`account`
|
||||
ADD COLUMN `quota_enforce` INT(1) NULL AFTER `default`,
|
||||
ADD COLUMN `quota_balance` DECIMAL(15,2) NULL AFTER `quota_enforce`,
|
||||
ADD COLUMN `quota_min_balance` DECIMAL(15,2) NULL AFTER `quota_balance`;
|
||||
ADD COLUMN `quota_balance_date` DATETIME NULL AFTER `quota_min_balance`,
|
||||
ADD COLUMN `quota_alert_date` DATETIME NULL AFTER `quota_balance_date`;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `cloud`.`saml_token`;
|
||||
CREATE TABLE `cloud`.`saml_token` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
|
@ -44,11 +36,17 @@ CREATE TABLE `cloud`.`saml_token` (
|
|||
CONSTRAINT `fk_saml_token__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Quota
|
||||
|
||||
ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `quota_calculated` tinyint(1) DEFAULT 0 COMMENT "quota calculation status";
|
||||
|
||||
ALTER TABLE `cloud_usage`.`account`
|
||||
ADD COLUMN `quota_enforce` INT(1) NULL AFTER `default`,
|
||||
ADD COLUMN `quota_balance` DECIMAL(15,2) NULL AFTER `quota_enforce`,
|
||||
ADD COLUMN `quota_min_balance` DECIMAL(15,2) NULL AFTER `quota_balance`,
|
||||
ADD COLUMN `quota_balance_date` DATETIME NULL AFTER `quota_min_balance`,
|
||||
ADD COLUMN `quota_alert_date` DATETIME NULL AFTER `quota_balance_date`;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cloud_usage`.`quota_tariff` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`usage_type` int(2) unsigned DEFAULT NULL,
|
||||
|
|
|
|||
Loading…
Reference in New Issue