Hello Kobi Ianko,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/27491
to review the following change.
Change subject: core: Add the ability to consume Quota in internal commands
......................................................................
core: Add the ability to consume Quota in internal commands
adding a new boolean to CommandBase to indicate
whether the command will consume quota when invoked as internal.
Added a c'tor to VdcActionType, to allow setting this boolean:
HotSetNumberOfCpus(184, ActionGroup.EDIT_VM_PROPERTIES, false,
QuotaDependency.VDS_GROUP, true)
Change-Id: Id4c8074eef5607107703bcb68df441a577137b04
Bug-Url: https://bugzilla.redhat.com/1083177
Signed-off-by: Kobi Ianko <[email protected]>
---
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
2 files changed, 26 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/91/27491/1
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
index ceeaefe..a501d2a 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
@@ -763,7 +763,7 @@
private boolean internalValidateAndSetQuota() {
// Quota accounting is done only in the most external Command.
- if (isInternalExecution() || !isQuotaDependant()) {
+ if (!isQuotaDependant()) {
return true;
}
@@ -794,8 +794,18 @@
return result;
}
- private boolean isQuotaDependant() {
- return getActionType().getQuotaDependency() !=
VdcActionType.QuotaDependency.NONE;
+ protected boolean isQuotaDependant() {
+ boolean result;
+ if (getActionType().getQuotaDependency() ==
VdcActionType.QuotaDependency.NONE)
+ result = false;
+ else if (!isInternalExecution())
+ result = true;
+ else if (getActionType().isQuotaDependentAsInternalCommand())
+ result = true;
+ else
+ result = false;
+
+ return result;
}
/**
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index 825a819..9fee534 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
@@ -339,6 +339,7 @@
private boolean isActionMonitored;
private static final java.util.HashMap<Integer, VdcActionType> mappings =
new HashMap<Integer, VdcActionType>();
private QuotaDependency quotaDependency;
+ private boolean quotaDependentAsInternalCommand = false;
static {
for (VdcActionType action : values()) {
@@ -365,6 +366,14 @@
this.quotaDependency = quotaDependency;
}
+ private VdcActionType(int value,
+ ActionGroup actionGroupValue,
+ boolean isActionMonitored,
+ QuotaDependency quotaDependency,
+ boolean quotaDependentAsInternalCommand) {
+ this(value, actionGroupValue, isActionMonitored, quotaDependency);
+ this.quotaDependentAsInternalCommand = quotaDependentAsInternalCommand;
+ }
public int getValue() {
@@ -387,6 +396,10 @@
return quotaDependency;
}
+ public boolean isQuotaDependentAsInternalCommand() {
+ return quotaDependentAsInternalCommand;
+ }
+
/**
* The QuotaDependency marks on which kind of quota regulated resources
each command is dependant.
* i.e. - Creating new Disk is dependant of Storage resources. Running a
VM is dependant of VDS (cluster) resources.
--
To view, visit http://gerrit.ovirt.org/27491
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4c8074eef5607107703bcb68df441a577137b04
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Kobi Ianko <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches