core: remove redundant image listing by pool

There is no need for a specific procedure (and specific DAO methods)
to get the list of ISO images for a Pool since it is possible to use
the regular getStorageDomainId method using the storage domain id
returned by getIsoStorageDomainIdForPool.

Change-Id: I6ed7de8141b73cec53899cf277a9fdfdc06f2fc1
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
core: unify GetImagesList using ImageFileType.All

It is possible to unify the two separate requests for Floppy and ISO
images using the enum ImageFileType.All. In order to do so the stored
procedures and the DAO methods have been updated to not filter by type
when ImageFileType.All is used.

Change-Id: I4e8fb85c3f0d58778b03fd0aa101d95bbeebf3f6
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
core: findbugs + improving code

Fixing findbugs issue + improving code
readability

1. Removed dictemp + assigntmet
2. Changed the if instanceof map "pattern"

Change-Id: Icc7794df32b8d0f4cf08f7c5259b83a5a17db14f
Signed-off-by: Yair Zaslavsky <yzaslavs@redhat.com>
core: Log stacktrace when VDS command execution failed

Added stacktrace to debug log when an exception is raised
during VDS command execution.

Change-Id: I67d502dd74d45cf75a4fe98c840a41df58ac8425
Bug-Url: https://bugzilla.redhat.com/948744
Signed-off-by: Martin Perina <mperina@redhat.com>
packaging: stricter FQDN validation

common_utils.getConfiguredIps now returns only Ips configured on
non loopback devices.

engine_validators.validateFQDN now tolerates that the FQDN provided
could not be resolved through a DNS but just only by /etc/hosts.
However, if the FQDN is resolved by DNS, it has also to reverse
resolve the ip address provided by the DNS.

engine-setup doesn't accept anymore a FQDN that doesn't pass the
validation, avoiding failures at later stages.

Change-Id: I512446c80dfa9c83adb179a445bfae82736d403f
Bug-Url: https://bugzilla.redhat.com/948311
Bug-Url: https://bugzilla.redhat.com/928667
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
engine,webadmin: Run and pause action enabled

'Start in Pause Mode' checkbox added to the Edit VM properties
dialog, instead of only in the Run Once dialog.

This is needed to assist the admin in boot-level troubleshooting.
Allowing the VM to always start in paused mode without having
to select "Run once" will save the admin time and hassle
when starting and stopping VMs multiple times.

Change-Id: Ib1fe46a9946f7914095310ddac9ab1a9e5a6564b
Signed-off-by: Libor Spevak <lspevak@redhat.com>
core,webadmin: Host reboot false for gluster only host

This patch sets requiresRebootAfterInstallation to false
in case of gluster only host.
Following UI flows for add host are changed
- Add New Host
- Reinstall Host
- Configure host (for Add Cluster)
- Import Cluster

Change-Id: I8c52e32de914b21998fa334088b302ec70aef49f
Signed-off-by: Sahina Bose <sabose@redhat.com>
core: Extract SD validations from ImagesHandler

Extracted the logic to perform validations on Storage Domains from
ImagesHandler.PerformImagesChecks, and made the relevant commands use it
directly.

In order to do this, a new type of validator was introduced,
MultipleStorageDomainsValidator, which aggregates validations from
individual StorageDomainValidators in a fast-fail pattern. This is done
for performance reasons, so there is no need to load all the storage
domains from the database preemptively.

This refactoring removes three parameters from PerformImagesChecks:
* checkStorageDomain and diskSpaceCheck - are now done directly by
  MultipleStorageDomainsValidator.
* storageDomainId - is used by the previous two checks, and by the image
  existence check. However, it is always equal to the storage domain id
  member of the DiskImage, so it is redundant as an additional
  parameter.

The changes in the commands are as follows:
* The parameters detailed above were removed from the
  ImagesHandler.PerformImagesCheck calls.
* Wherever appropriate, a direct call to StorageDomainValidator or
  MultipleStorageDomainsValidator was added.

Change-Id: I4cfc895dceed4de520476ed5e3fa9c1c7cfd78f4
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Remove PerformImagesChecks from AddDisk

Several previous patches have removed checks not related to DiskImages
from PerformImagesChecks (The last one being change id
I4cfc895dceed4de520476ed5e3fa9c1c7cfd78f4, that removed storage domain
validation).

Now, since PerformImagesChecks only checks DiskImages, passing an
emptyList() to it is meaningless, and can safely be removed.

Change-Id: I457dee7645dd16c430eda6886e03df77c7e91383
Signed-off-by: Allon Mureinik <amureini@redhat.com>
core: Unfilter ImagesHandler.PerformImagesChecks

Before this patch, ImagesHandler.PerformImagesChecks received a
collection of Disks, and filtered them so only DiskImages that aren't
sharable were evaluated.

This patch removes the filtering from this methods, and makes it the
responsibility of the calling method to perform any required filtering.
This patch also adds said filtering wherever relevant, so no behavior is
changed.

This achieves two goals:
1. Added flexibility, to allow possible validation on sharable disks.
2. A clearer API - it is now clear, in compile time, that this method
   only performs validations on DiskImages, as opposed to the way it
   was before the patch, where the function could be passed a faulty
   (e.g., non-existent) LunDisk, which would just be silently ignored.

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