userportal,webadmin: fix dtd check

In another patch we added set-property-fallback which is
not defined in the GWT dtd before 2.5. This patch sets
the DTD to 2.5 so that eclipse doesn't complain about it.
Note that the DTD version for userportal was 2.3 and
webadmin was 2.2. The build doesn't actually care about the
DTD.

Change-Id: I9523686fa7b7e005830b4f247d998fbfb01259e2
Signed-off-by: Alexander Wels <awels@redhat.com>
webadmin: Application continue polling after logout

- Fixed queries to BookMarks not stopping when logging out.
- Fixed queries to RoleListModel not stopping when logging out.
- Fixed queries to SystemPermissionListModel not stopping
when logging out.

Change-Id: Ibd2718649ab4031e6ff2b0d0e6c449f53164ff9f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=888492
Signed-off-by: Alexander Wels <awels@redhat.com>
core: Fix for wrong error massage in add disk

while quota in audit mode, when user tried to add a disk to an SD which
has no assigned quota - an error message was presented and the operation
was blocked. The error message was not correctly formatted.

This happens because when the DC was moved from Enforced to Audit mode
the quota cache was not refreshed. So all quotas on that DC remained in
the old enforcement mode.

Fixed the cache refresh rule. Now that the error is thrown from the
correct place in the code and only in Enforced mode, it is correctly
formatted.

Change-Id: Ifb23898a52c654dd03b7c9d1421fe456c9196da2
Bug-Url: https://bugzilla.redhat.com/906485
Signed-off-by: Ofri Masad <omasad@redhat.com>
webadmin: Fix gluster host force detach message

The message is changed to 'Force Detach' to be inline
with force remove message.

Change-Id: I05508feb015f92d85dc5a55cf0ffb57a5e6ac4ca
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
webadmin: display N/A for gluster services port if not applicable

'SHD' services may not have port numbers and it will be displayed
as 'N/A' if portNo is 0.

Change-Id: I92485213c23ed26742b70db26c1230ea662bc0e5
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
packaging: engine-service: recover from corrupted pid file

The case in which pidfile is empty is common.

Change-Id: I1b2a175cd0ef14bb6f60822f510059ee5be23c43
Signed-off-by: Alon Bar-Lev <alonbl@redhat.com>
frontend: ConcurrentModificationException in AdElementListModel

The exception occured in the populateRoles method when user is adding
permissions to the VM in permissions subtab. The problem is introduced by
refactoring in 05c06da3 and is only visible in gwt-debug console.

The problem was caused by removing items from the list in the for-each loop.
Fixed by introducing a copy of the modified list (to avoid modifying the
collection passed in the argument).

Change-Id: Id845725507782162c14f6e7b214f65cc6060f59b
Signed-off-by: Frantisek Kobzik <fkobzik@redhat.com>
webadmin: Adding validation for volume name

The following validations are added for volume name.
- length cannot be more than 50
- name can have only ASCII letters, numbers, '_' or '-' signs

Change-Id: I691c7bbaecb764dcc722fd4d9f3fa7be5018a6d2
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
engine: avoid passing userId in User queries

Motivation: in the included queries (user queries), a user id
is passed in parameters.
In user query there is no point in passing userId (it can be taken
from session in server side).
Removed user id paramerters classes, query base class, related tests, and
references both in UI and REST.

Note: although there can be a use case for fetching other user vm/pools, it
can be revisited upon request (currently there is no use for that).

Change-Id: I06bec1770adbc6dce07baae8e5fc7f163b39fc52
Signed-off-by: Gilad Chaplik <gchaplik@redhat.com>
core+webadmin: Fix aggregate unlimited quota

Unlimited specific quota was not aggregated to unlimited.

This was fixed both in QuotaManager and in the WebAdmin.

Added a pop-up confirmation window alerting the user that using
unlimited specific quota is inadvisable and asking his confirmation.

Change-Id: If8f5eb7b2ad1fd5264039ede728c746b0a3cf1b3
Bug-Url: https://bugzilla.redhat.com/923868
Signed-off-by: Ofri Masad <omasad@redhat.com>
core: Fix unpermitted storage related commands in Audit mode

When Data Center is in quota enforcement mode 'Audit', a user can perform
disk actions on a SD which he does not have permission for (e.g. move
disk).

This was caused by wrong permission subjects list creation which
neglected the 'Audit' mode.

Fixed the permission subjects list creation to include 'Audit' mode as
well as 'Disabled' mode (in 'Enforcing' mode this operation will be
blocked by the quota QuotaManager)

Change-Id: Ie50e7dd91611c2b959cea3a78c2684451836760b
Signed-off-by: Ofri Masad <omasad@redhat.com>
webadmin: hiding virt related fields in Gluster mode

The following ui fields will be hidden when the Application mode is Gluster only.
- CPU colum in Cluster main tab
- Data Center name in Cluster general tab
- Console tab in Host popup
- SPM Priority in Host general tab

Change-Id: I5352cf678161905d46281331168df4fb7b97b622
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
engine: Improving memory footprint during audit logging - easy one

The following variable allocation is unneeded.
Improved memory allocation during every get from DB operation

Change-Id: I21b4964f278d067aa9daa0b153099b20f348919b
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Simplify AuditLogHelper

Replacing hand made code by java standard code.

Change-Id: Ibf52160dba842985b6cb1fa66fc08c538b2ead6a
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Improving memory footprint for almost every command in the system

The custom properties is private case, so allocation of HashMap is required only
in small number of commands, benefit - we will not allocate thouthands of HashMaps
In case that we need a custom properties , map will be allocated

Change-Id: I266ac0abd5e53ec7c7948059ee575aac6b53c17b
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Clean unused method

The following method is not in use, so removed

Change-Id: I82d7ae999a38c4ec9690192e4e26d09bf0f5343f
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Super audit log improvement

So what is current (before patch) behaviour inorder to make some audit log
message:

1. Pass class that extends AuditLogableBase
2. Pass a message with keys that should be replaces based on properties from passed class
3. Go over all properties in passed class, collect them and create a HashMap with key as
   property name and value as property value
4. Replace keys in message using a created HashMap.

Now, lets take a look on 3, how we retrieve a properties - we invoke all getXXX methods in our class.
How many getXXX methods has simple AuditLogableBase class?
How big will be our HashMap?
How many queries/calculations will run during invoking some of the getXXX messages, because our class not
simple bean?
The only answer is a lot, only in simple run I saw a HashMap with 150 values (sic!).

I fix this, if I have a message I know all keys that I need, I don't need to go throught all getXXX methods.

Intresting fact: optimized solution required less code.
Another intresting fact - adding of additional getter to AuditLogableBase, before a fix, was like adding a small
brake to the system.

Change-Id: Id68a098be36fcfc47c23c57fce3abea50e6273e3
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Additional clean up in AuditLogDirector

Variable auditLogable can not be null, if it null we will fail on
NullPointerException inside updateTimeoutLogableObject method.
After removing such condition, were removed all relevant and dead code.
Also, I chnaged tempVar to auditLog varibale, don't see reason for using tempVar

Change-Id: Ia0eb406d78965bb0d84c7ce80761028877ab2879
Signed-off-by: Michael Kublin <mkublin@redhat.com>
engine: Block Hot Adding a Nic in 3.0

This patch makes sure not to hot-plug a nic in a
VM that belongs to a cluster with a version that
does not support hot-plugging. Previously, the
condition that was used in the canDoAction coupled
between two conditions that are not related.

Change-Id: Ic0ee6563b55a84421b3a9a068e6d69ff228d46ae
Bug-Url: https://bugzilla.redhat.com/923332
Signed-off-by: Muli Salem <msalem@redhat.com>
webadmin: Wrong error message is shown, when SuperUser permissions are removing from admin internal

The following bug contains two errors:
1. Fixing error message: Cannot ${action} ${type}.
2. In canDoAction() , if we failed at first condition, no reason to perfrom additional checks

Change-Id: I825a379b383fd923046e17e6f1d27c6003c48900
Bug-Url: https://bugzilla.redhat.com/924880
Signed-off-by: Michael Kublin <mkublin@redhat.com>