core:Refactor locking mechanism

Refactor lock mechanism by swithing the key with the value.
Instead using entity name as key and guid as value, now the key will be
the GUI and the value will be the entity name.

This fix should be since now with shareable disk, there can be multiple
VMs which can be locked in one operation.

Change-Id: Icbe9e0eb5a0ec2e8af899b3e554b1cb6fccc6835
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core:Use attachable disk for shareable

Add shareable disks to be part of the suggested attachable disk list.
Add test for shareable disk

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I9e69edcd5ab63d09ae35abaec4ba6991978369be
core:Update VmDao to return multiple Vms for disk.

Changed the API of the VMDao to return list of VMs.
Also since now disk can be on multiple Vms, the validation if disk is part of
VM should reference a list of VMs.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: Ib8d0bbef4828100217e488d6dbab1b81ee65103d
core:Support move of shareable disk

Support shareable disk move operation.
Since all_disks list will return multi columns of VMs, it needed to be
considered in the CDA validation.
As part of the shareable disk, the locking mechanism has been changed
with the following changes:
 1. Change the lock to log all the VMs which has shared lock
 2. Use lock in the end of the CDA

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I8c59562fdd45cea4628c1e40e65713581647f86f
core:Validate shareable disk which attached to VMs

Use validation when updating disk to be un shared any more.
If the disk is attached to VMs then CDA message should block the
operation.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I1024782e96f341d0c9b1d24eb283e76797c0a128
core:Support remove of shareable disk.

The following patch has the following changes:
1.Adding support to remove disk from multiple vms.
The remove command was counting on the vm id which was in the disk.
After this change the vmId will be fetched from the DB.

2.Update vm device store procedures to use vmId as a parameter when remove
or getting a vm device.
This is neccessery for the Activate/Deactivate process to work for
shareable disk.

3.Update the lock mechanism in the remove disk command to log the VMs
which are using in the shared lock, and also change the aquire lock to be at
the end of the CDA instead before the validation.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: Idde509a7bdee94e6fd481fce510b26f89d6b0429
core:Fix images handler CDA.

Perform images checks in images handler should not use else if since
there will be only one validation each time instead validate all the
validations in the CDA.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I53c9537e48130cf4113c933fafbcac7dd06c5d77
core:Use shareable disk only for 3.1 DC version

Block ability to configure shareable disk for Data Ceneters which has
version which is less then 3.1, since the shareable disk is only
supported in Hosts which are on 3.1 cluster.
Adding storage pool id to the disk parameters, so that LUN disk can
have reference to the storage pool id

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I1928ea17b457b8a810b24637862d3977b7e001c8
core:Change CDA message to fit shareable disk

Use CDA message to fit more for shareable disks.

Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
Change-Id: I15e648267a78a76a5390ad24367a7cb2e9b8a2a3
core:Cleanup for BaseImageCommand

The next changes/fixes are introduced:
1.Using the disk id to fetch the VM id which contains the disk,
instead using the container id.

2.Clean clone and update image method from BaseImagesCommand.
This method was never called and does not has any reason to be in the
code.
The vmId initialized in the cloned VM from the container id is not
necessery in the BE, since all the
calling methods are not using this parameter, and the vm id should not
be part of the image state in the DB.

3. Remove use of container id when previewing a snapshot -
Use vm id instead of container id when previewing a snapshot.

4. Remove container id use when create snapshot.

5. Clean unlogic code
The initialization which is deleted is already done in getImage method.
The code which is deleted represents the following logic:
a = b;
if (a == null) then get(b.id)
if a is null then b is also null and there will be an NPE.

Change-Id: Ida5aa7be5d5193a0e15d89a7888bdc0a8c15b083
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>