userportal,webadmin: Persist the changes from console popup

Make the changes made in console popup (both WA and UP) persistent
per browser.

The core of the implementation is the ConsoleOptionsFrontendPersisterImpl
which is a gin managed class containing two methods:
- storeToLocalStorage
- loadFromLocalStorage

This methods needs the model to/from to copy the data to/from local
storage and the context, which can be webadmin, userportal's basic
view or userportal's extended view (because the values are configured
separatly for this three places).

The load method copies the selected data from local storage only if
they are still possible in the specific context (for example when the
user selected some spice options, this has been stored to local
storage and than he changed the default console to VNC, the spice
options are not going to be copied).

When using, you need to make sure that you load the stored data
from the local storage before opening the edit console and before
connecting to the console, and also that you store all the data to
local storage after the user changes them in the edit console.

Change-Id: I847e17c6e28db7921f0bc162f0ff70399e671a03
Signed-off-by: Tomas Jelinek <tjelinek@redhat.com>
packaging: Updated the use of the taskcleaner utility

Taskcleaner utility was updated with new options. This
patch provides update to our code to use these new
options instead of previous ones.

Change-Id: I6c4185a6cdadb9ef152e3b3130c30d2c19cb07c0
Bug-Url: https://bugzilla.redhat.com/921201
Signed-off-by: Alex Lourie <alourie@redhat.com>
userportal,webadmin: add enable SPICE proxy checkbox

Added a new checkbox under SPICE options of the console
popup window named "Enable SPICE Proxy".

The behavior:
- if the SPICE proxy is configured on system level (SpiceProxyDefault)
  + the "Enable SPICE Proxy" checkbox is enabled and checked by default
  + if the selection is changed, than it is stored in the brower level

- if the SPICE proxy is NOT configured on system level (SpiceProxyDefault):
  + the "Enable SPICE Proxy" is not editable and has a title:
    "No SPICE proxy defined on system level"
  + it is not checked
  + if it was previously checked and this preference stored on browser level,
    this preference is ignored and the checkbox will be unchecked

Change-Id: I879a4976c649f1d568f42c2d72f9e995a618d874
Bug-Url: https://bugzilla.redhat.com/924605
Signed-off-by: Tomas Jelinek <tjelinek@redhat.com>
webadmin: Adding Volume ID to volume general tab

Volume ID field is added to volume's general subtab,
it will display the UUID of the selected volume.

Change-Id: If571171963d36669b436d24fced633b34afaaf81
Bug-Url: https://bugzilla.redhat.com/887806
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
webadmin: null checks added for Volume general model properties

null checks are added for the volume general model properties
to avoid NPE.

Change-Id: Icaa6463054d6eefd589f5991c43b09b7d9247507
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
core: Removed the unused GetImageByImageIdQuery

This patch removes the unused query GetImageByImageIdQuery.

This patch contains:
1. Removing aforementioned class, which has no usages in the code.
2. Removed the GetImageByImageId constant from VdcQueryType.
3. Renamed GetImageByImageIdParameters to
   GetStorageDomainsByImageIdParameters since
   GetStorageDomainsByImageIdQuery is now the only class that uses it.

Change-Id: Ib1ee84d3e8c903fc9a9cfd6144e8c44af06d04c4
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove unused GetVGInfoQuery

Removed the unused GetVGInfoiQuery.
This patch removes the following:
1. The unused GetVGInfoQuery class.
2. The VGQueryParameterBase class only used by GetVGInfoQuery.
3. The GetVGInfo constant in VdcQueryType corresponding to the removed
   class.

Change-Id: I1e43d685ffd2c0664094c024f883c853d7edfc75
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove GetStorageSessionsListQuery

GetStorageSessionsListQuery is not used anywhere in the code, and
hence should be removed.

This patch removes the following:
1. The GetStorageSessionsListQuery class
2. The GetStorageSessionsList constant representing it in
   VdcQueryType
3. The GetStorageSessionsListVDSCommand class which was only used by
   this query.
4. The GetStorageSessionList constant representing it in
   VDSCommandType.
5. The getSessionsList() method
   IVdsServer/VdsServerConnector/VdsServerWrapper, which was only used
   by GetStorageSessionsListVDSCommand.
6. The SessionsListReturnForXmlRpc class which was only used by
   GetStorageSessionsListVDSCommand.

Change-Id: I5ee43140a7ca0cbe9a2c15cc787c270ead619bda
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove GetPermittedStorageDomainsByTemplateId

GetPermittedStorageDomainsByTemplateIdQuery is not used anywhere in
the code, and hence should be removed.

This patch removes the following:
1. The GetPermittedStorageDoaminsByTemplateIdQuery class
2. The GetPermittedStorageDoaminsByTemplateId constant representing
   it in VdcQueryType
3. The GetPermittedStorageDomainsByTemplateIdParameters class which
   was only used by the removed query class.
3. The getPermittedStorageDomainsById method in StorageDomainDAO
   (which was only used by the query), its implementation, and its
   test.
4. The Getstorage_domain_by_id_with_permitted_action stored procedure
   that was only used by the said DAO function.

Change-Id: I94f586e0daeebc0f768639b39444b30ff3101378
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Live snapshot should order child commands

End method of live snapshot should order the list of the child
commands by image id to avoid dead lock with UpdateRunTimeInfo when updating
disk image dynamic.

Change-Id: I2999a2f9fb042a70eaf34e17668877040d57a068
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Bug-Url: https://bugzilla.redhat.com/909937
webadmin: fix NPE on add NFS

Fix regression introduced by:
bfd9299661c6f6adeea998e93232c8a8789b9dc0

Change-Id: Ibf0f41ceb4d58997a918674bd1919337911d09ef
Signed-off-by: Tomas Jelinek <tjelinek@redhat.com>
core: Remove unused GetVmsByVmTemplateGuidQuery

GetVmsByVmTemplateGuidQuery is not used anywhere in the code, and
hence should be removed.

This patch removes the following:
1. The unused GetVmsByVmTemplateGuidQuery class.
2. The GetVmsByVmTemplateGuidParameters class used by the
   aforementioned query class. All its meaningful methods (i.e., getId()
   and the constructor from Guid were pulled up to
   GetVmTemplatesDisksParameters which used to extend it.
3. The GetVmsByVmTemplateGuid constant in VdcQueryType
   corresponding to the removed class.

Change-Id: Ieef493712c75bc386dce066f9774ffe83c1be8fa
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove unused bookmark queries

This patch removed the unused GetBookmarkById and GetBookmarkByName
queries.

Removed in this patch:
1. The query classes.
2. The parameter classes used by the aforementioned queries.
3. The validation methods used to validate the aforementioned
   parameters.
4. The constants from VdcQueryType corresponding to the aforementioned
   queries.

Change-Id: If130d51f240beebcfdda56e8c03c9f0321100ebf
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Removed unused VdcQueryType.CanFenceVds

Removed the CanFenceVds constant from VdcQueryType, as the
CanFenceVdsQuery associated with it no longer exists.

Change-Id: I5a9d97e7adbebccdc70760d0e11667d81bf55ff6
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove unused IsUserPowerUserOrAboveQuery

Removed the IsUserPowerUserOrAboveQuery and its corresponding constant
in VdcQueryType since it is not used anywhere in the code.

Change-Id: I82982b3a6950339a9c3623078f4bd0e36c9d8f6f
Signed-off-by: Allon Mureinik <amureini@redhat.com>
engine,webdmin: Restrict destination host parameter for administrators

Users aren't supposed to be able to provide any host level parameters
to commands.

New action groups added:
- EDIT_ADMIN_VM_PROPERTIES
- EDIT_ADMIN_TEMPLATE_PROPERTIES

The permission check is applied if e.g. destination host is specified
and is different from the default VM destination host
for Run/RunOnce/UpdateVM/UpdateVmTemplate/AddVM/AddVmTemplate VM actions.

The new action groups are assigned to:
- SuperUser, DataCenterAdmin, (ClusterAdmin, TemplateAdmin) roles.

GUI role tree is updated.
Permissions are propagated into REST API layer.

Change-Id: I5294854d24b235f2c50fa7f3d4e7472cf7598b53
Bug-Url: https://bugzilla.redhat.com/902353
Signed-off-by: Libor Spevak <lspevak@redhat.com>
packaging: reimplemented engine_firewalld

Reimplemented using the firewall-cmd command
instead of the python API, avoiding issues with dbus.
The firewall-cmd command will be used also in otopi based
rewrite of the engine-setup command.

Change-Id: Ie0d819c9607d4c99b3093e364ca504ae96acca36
Bug-Url: https://bugzilla.redhat.com/924071
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
restapi: Adding "MIGRATION" role as a network usage.

Migration role on a NetworkCluster indicates the migration of vm's
in the cluster will be done via this network.

Change-Id: If001d1388e3054f9f6215e3cb3d2f23cc84de05f
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: Remove GetVdsByHostQuery leftovers

Removed the VdcQueryType.GetVdsByHost constant and the
GetVdsByHostParameters class as the GetVdsByHost query no longer
exists in the codebase.

Change-Id: Ib426d8ae35d8536286f02dc67141b0f641f43971
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove GetVdsByTypeQuery leftovers

Removed the VdcQueryType.GetVdsByType constant and the
GetVdsByTypeParameters class as the GetVdsByType query no longer
exists in the codebase.

Change-Id: I42ecd45ccf58e544305df394e727926097f63dda
Signed-off-by: Allon Mureinik <amureini@redhat.com>