core: block VM migration during live storage migration

This is a best-effort fix for preventing a VM from being migrated during
migration of one of its disks (live storage migration), and vice versa.

One way is already covered - live storage migration is made only when
the VM state is up or paused so it can't be executed when the VM is in
migration.

This patch is partial fix for the opposite way - a check is added to
MigrateVmCommand to verify that none of the VM's disks is locked, which
is the case when one of its disks is being migrated (or during snapshot
creation for the disk).

This fix doesn't cover a situation where the VM migration and storage
migration/snapshot creation are taking place simultanously, and not
cover the case where the VM migration fails thus being rerun and the VM
state is switched to 'UP' in the middle of the process.

Change-Id: Id630a01368290ba9ac6c71c5cab2095f84fa018b
Bug-Url: https://bugzilla.redhat.com/878131
Signed-off-by: Arik Hadas <ahadas@redhat.com>
core: [cleanup] organize canMigrateVm method

This patch organize MigrateVmCommand#canMigrateVm method:
1. replaced the unused paramter vmGuid with VM instance. that way, the
method is more testable (can be tested without mocking, just insert a
different VM to check as parameter)
2. remove the can-do-action error messages list from the parameters, and
use addCanDoActionMessage & failCanDoAction methods inside the method
instead
3. set the action and type for the can-do-action messages in the
standard way by override setActionMessageParameters method

Change-Id: Ica36ecc272a295ee82ec51d7b62a90d84489d8c9
Signed-off-by: Arik Hadas <ahadas@redhat.com>
gluster: Improved gluster validation in add host

When checking if the host is part of another gluster cluster,
- Ignore if the command (gluster peer status) fails, to handle cases
  where glusterfs is not installed or glusterd is down
- Do not perform the check if the cluster in which the host is being
  added is currently empty i.e. when the host being added will be the
  first host of the cluster.

Change-Id: I06a2ee4621b175aa70f1ccdcf7a740d830494acf
Bug-Url: https://bugzilla.redhat.com/956077
Signed-off-by: Shireesh Anjal <sanjal@redhat.com>
engine: Propagate error message when quering for LDAP users/groups

Propagating error message when searching AD users/groups via SearchQuery fails,
The error is propagated to the webadmin and an inline error message is displayed within the
permission view popup.

Change-Id: I50da72d12c6d60642ad5e65b9376efc49e4ef699
Signed-off-by: Asaf Shakarchi <asaf@redhat.com>
api: rename method in BackendStorageDomainsResource

Renamed internal method because it was too long and didn't match
all the use cases it was dealing with.

Change-Id: I862f7da6a9460268f3573f82acbfab68c0f14551
Signed-off-by: Alissa Bonas <abonas@redhat.com>
webadmin: start method with lowercase

Start private method with lowercase in StorageListModel

Change-Id: I515aaf27351928cf5b7d4f43378c2865f6a1fcf0
Signed-off-by: Alissa Bonas <abonas@redhat.com>
frontend: Fix findbugs error in VmListModel class

Change-Id: I38b0b40dd4316162440ed40d2947549a63a41b1e
Signed-off-by: Tal Nisan <tnisan@redhat.com>
core: Upgrade DC should not log failure on update process.

When VDSM fails to run the verb upgradeStoragePool,
engine should not print a failure in the audit log but a warning,
since the engine does not fail in the process and should eventually
upgrade the master domain and its storages when it will send SPM start
or when VDSM will get the storage connectivity again.

Change-Id: I17597f74eeaae62c716bf7dd8688f3fee2ca2ab6
Bug-Url: https://bugzilla.redhat.com/950637
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
findbugs: possible null pointer dereference

Change-Id: I47f76604af97462f60b7de8a52eec75f34f6560e
Signed-off-by: Shahar Havivi <shavivi@redhat.com>
webadmin: Making network related subtabs resizeable

Fixed sub tabs-
- Network Cluster
- Network Host
- Network Vm
- Network Template
- Netwrok Permissions (there is some general code used by all
permissions sub-tabs, it will be fixed in a separate patch)
- Vm Interface (The left pane is fixed, the right pane is using
EntityModelCellTable which doesn't have support for resizing).
- Template interface
- Cluster Interface
- Dc Interface

Not Fixed sub tab-
Host Interface- this is unusual table constructed of multiple panel that
look together as a table. The is no infrastructure to support resizing
of such kind of table.

Change-Id: I04c6db892934fa94060bc126b2b317cb651fff32
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
core: server fails to load on wrong custom property regex

On server load we initialize custom properties regex-es,
in-case a regex doesn't match the pattern PatternSyntaxException
is caught, but rethrown somehow, and this fails
InitBackendServicesOnStartup.create()

Change-Id: I086662cc6cfbb7ade65111a55ef736ca02b33ca8
Signed-off-by: Gilad Chaplik <gchaplik@redhat.com>
core: [cleanup] split execute method of CreateAllSnapshots

CreateAllSnapshotsFromVmCommand#executeVmCommand method is too long.
it's going to be even longer after adding memory snapshot, so it's a
good point to organize it by spliting the different concerns in this
method to several private methods.

Change-Id: Ie401b3aa60abba497237e02c77d8d3a77cef9a20
Signed-off-by: Arik Hadas <ahadas@redhat.com>
core: change the order of checks in canDoAction of migrate vm

Change the order in which the checks whether a snapshot is being taken
for the VM or whether one of its disks is locked are carried on, so that
the snapshot check will be made before, as in that case the disks of the
VM are also locked but this check produces a more specific can-do-action
error for the user.

Change-Id: I3e7cacc97fddd48e16564fda0911e7c9604fc731
Signed-off-by: Arik Hadas <ahadas@redhat.com>
core: Use name groups for ISO tools

Use java7 feature of name groups when matching cluster
and tool version for ISO files in ISO domain.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: Id19888eee7c1afc7489af5208b6cddd2376d74a3
core: Use static memeber to get ISO regex pattern.

Use final static member instead recalculating the string over and over
again in a method.

Change-Id: Iffbdd09373916206d997132bc01fc02179d01973
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
webadmin: DataCenters main-tab: sub-tabs resizable columns

Sub-tabs under DataCenters main-tab now support
resizable columns.

* Invoked enableColumnResizing() on each sub-tab.
* Added a static width value for each column.

Change-Id: I71465d36e5c18ecb8eb6dbca436feaeea1c902a9
Signed-off-by: Daniel Erez <derez@redhat.com>
webadmin: Storage main-tab: sub-tabs resizable columns

Sub-tabs under Storage main-tab now support
resizable columns.

* Invoked enableColumnResizing() on each sub-tab.
* Added a static width value for each column.

Change-Id: I8ccb2acd6f6593938600c456814c3cfcb316335a
Signed-off-by: Daniel Erez <derez@redhat.com>
webadmin: Disks main-tab: sub-tabs resizable columns

Sub-tabs under Disks main-tab now support
resizable columns.

* Invoked enableColumnResizing() on each sub-tab.
* Added a static width value for each column.

Change-Id: Ia6ac016dd8e8428f17c873cd29d7e46170dadcc4
Signed-off-by: Daniel Erez <derez@redhat.com>
webadmin: Disks and Snapshots sub-tabs resizable columns

Disks and Snapshots sub-tabs now support
resizable columns.

* Invoked enableColumnResizing() on each sub-tab.
* Added a static width value for each column.

Change-Id: Ief60915ae0d7ddbfe5d9cb808756796773478541
Signed-off-by: Daniel Erez <derez@redhat.com>
core: Rename storage_pool entity to StoragePool

Renamed the storage_pool entity to StoragePool to fit Java convention
and to fix findbugs errors on the way

Change-Id: Ief7f05d7e226e86bf54587e31f1d75cf54a81118
Signed-off-by: Tal Nisan <tnisan@redhat.com>