Alona Kaplan has uploaded a new change for review.
Change subject: engine: Throw canDo on addVmCommand if template is not in
cluster
......................................................................
engine: Throw canDo on addVmCommand if template is not in cluster
added a canDo-
'VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC'
to-
AddVmCommand- if the templates is not in the vm's dc.
AddVmFromScratchCommand- if the templates is not in the vm's dc
and not 'Blank'.
Change-Id: I2566b18049bf7603700572dc5d419a640f294ada
Bug-Url: https://bugzilla.redhat.com/1103058
Signed-off-by: Alona Kaplan <[email protected]>
---
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromScratchCommand.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
A packaging/services/config.py
8 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/30638/1
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
index 8d06e98..147a9b8 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java
@@ -452,6 +452,10 @@
return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED);
}
+ if (!isValidTemplate()) {
+ return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC);
+ }
+
// A VM cannot be added in a cluster without a defined architecture
if (getVdsGroup().getArchitecture() == ArchitectureType.undefined) {
return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_UNDEFINED_ARCHITECTURE);
@@ -1323,4 +1327,9 @@
getParameters().getVmStaticData().setDefaultDisplayType(defaultDisplayType);
}
}
+
+ protected boolean isValidTemplate() {
+ return getVmTemplate().getStoragePoolId().equals(getStoragePoolId());
+ }
+
}
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromScratchCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromScratchCommand.java
index 99f0273..919aea1 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromScratchCommand.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmFromScratchCommand.java
@@ -178,4 +178,10 @@
addPermissionSubjectForAdminLevelProperties(permissionList);
return permissionList;
}
+
+ @Override
+ protected boolean isValidTemplate() {
+ return
VmTemplateHandler.BLANK_VM_TEMPLATE_ID.equals(getVmTemplateId()) ||
super.isValidTemplate();
+ }
+
}
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 67134bc..3fc6733 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -224,6 +224,7 @@
ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS),
ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST(ErrorType.BAD_PARAMETERS),
ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED(ErrorType.CONFLICT),
+
ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC(ErrorType.BAD_PARAMETERS),
ACTION_TYPE_FAILED_IMAGE_ALREADY_EXISTS(ErrorType.CONFLICT),
ACTION_TYPE_FAILED_TEMPLATE_NAME_ALREADY_EXISTS(ErrorType.CONFLICT),
ACTION_TYPE_FAILED_TEMPLATE_GUID_ALREADY_EXISTS(ErrorType.CONFLICT),
diff --git
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 44e5077..c0fa772 100644
---
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -243,6 +243,7 @@
ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Instance Type doesn't exist.
ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Image Type doesn't exist.
ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template
is disabled, please try to enable the template first and try again.
+ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC=The specified Template
doesn't exist in the current Data Center.
ACTION_TYPE_FAILED_IMAGE_ALREADY_EXISTS=Cannot ${action} ${type}. One of the
Template Images already exists.
ACTION_TYPE_FAILED_TEMPLATE_GUID_ALREADY_EXISTS=Cannot ${action} ${type}. A
Template with the same identifier already exists.
ACTION_TYPE_FAILED_CANDIDATE_ALREADY_EXISTS=Cannot ${action} ${type}. The
export candidate already exists in the specified path.\n\
diff --git
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index b01262d..95be55f 100644
---
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -658,6 +658,9 @@
@DefaultStringValue("Cannot ${action} ${type}. The Template is disabled,
please try to enable the template first and try again.")
String ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED();
+ @DefaultStringValue("The specified Template doesn't exist in the current
Data Center.")
+ String ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC();
+
@DefaultStringValue("Cannot ${action} ${type}. One of the Template Images
already exists.")
String ACTION_TYPE_FAILED_IMAGE_ALREADY_EXISTS();
diff --git
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 79ab2db..88dd5e9 100644
---
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -234,6 +234,7 @@
ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Instance Type doesn't exist.
ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Image Type doesn't exist.
ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template
is disabled, please try to enable the template first and try again.
+ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC=The specified Template
doesn't exist in the current Data Center.
ACTION_TYPE_FAILED_IMAGE_ALREADY_EXISTS=Cannot ${action} ${type}. One of the
Template Images already exists.
ACTION_TYPE_FAILED_TEMPLATE_GUID_ALREADY_EXISTS=Cannot ${action} ${type}. A
Template with the same identifier already exists.
ACTION_TYPE_FAILED_CANDIDATE_ALREADY_EXISTS=Cannot ${action} ${type}. The
export candidate already exists in the specified path.\n\
diff --git
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index e082a63..4e33da1 100644
---
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -241,6 +241,7 @@
ACTION_TYPE_FAILED_INSTANCE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Instance Type doesn't exist.
ACTION_TYPE_FAILED_IMAGE_TYPE_DOES_NOT_EXIST=Cannot ${action} ${type}. The
relevant Image Type doesn't exist.
ACTION_TYPE_FAILED_TEMPLATE_IS_DISABLED=Cannot ${action} ${type}. The Template
is disabled, please try to enable the template first and try again.
+ACTION_TYPE_FAILED_TEMPLATE_NOT_EXISTS_IN_CURRENT_DC=The specified Template
doesn't exist in the current Data Center.
ACTION_TYPE_FAILED_IMAGE_ALREADY_EXISTS=Cannot ${action} ${type}. One of the
Template Images already exists.
ACTION_TYPE_FAILED_TEMPLATE_GUID_ALREADY_EXISTS=Cannot ${action} ${type}. A
Template with the same identifier already exists.
ACTION_TYPE_FAILED_CANDIDATE_ALREADY_EXISTS=Cannot ${action} ${type}. The
export candidate already exists in the specified path.\n\
diff --git a/packaging/services/config.py b/packaging/services/config.py
new file mode 100644
index 0000000..4b8e410
--- /dev/null
+++ b/packaging/services/config.py
@@ -0,0 +1,24 @@
+# Copyright 2012 Red Hat
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+ENGINE_DEFAULT_FILE =
'/home/alkaplan/ovirt-engine-profile/share/ovirt-engine/conf/engine.conf.defaults'
+ENGINE_VARS =
'/home/alkaplan/ovirt-engine-profile/etc/ovirt-engine/engine.conf'
+ENGINE_NOTIFIER_DEFAULT_FILE =
'/home/alkaplan/ovirt-engine-profile/share/ovirt-engine/conf/notifier.conf.defaults'
+ENGINE_NOTIFIER_VARS =
'/home/alkaplan/ovirt-engine-profile/etc/ovirt-engine/notifier/notifier.conf'
+ENGINE_WSPROXY_DEFAULT_FILE =
'/home/alkaplan/ovirt-engine-profile/share/ovirt-engine/conf/ovirt-websocket-proxy.conf.defaults'
+ENGINE_WSPROXY_VARS =
'/home/alkaplan/ovirt-engine-profile/etc/ovirt-engine/ovirt-websocket-proxy.conf'
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
--
To view, visit http://gerrit.ovirt.org/30638
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2566b18049bf7603700572dc5d419a640f294ada
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alona Kaplan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches