core: Adding command context support for Register Disk

Adding command context constructor for Register Disk.

Change-Id: Ic3303599c7e0b8d27bef6e63ca5c5615a292131f
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Register all the OVF disks to Storage

Manage all the OVF_STORE disks with one list,
so all those disks will be registered as floating shareable disks in the Storage
and will also be used for getting the most updateable OVF_STORE disk to
be retrieved entities from.

Change-Id: I9fc6666a64efa16968935cfceb10e19b8a4e2eef
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
dal: Unregistered entities fixups in DAO and fixtures

1. Add unregistered Template entity to fixtures file
2. Use FixturesTool with the new entities
3. Fix UnregisteredOVFDataDAOTest accordingly
4. Fix typos found in the UnregisteredOVFDataDAOTest

Change-Id: I3b8663eec50968c0553c8fc6e841b3244ffd418b
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Get all unregisterd entities for Storage Domain

When entity type is NULL, fetch all the unregistered entities

Change-Id: I1fa749c309381a9f034dc8e6ea499740c33f8990
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Verify that date is initialized in OVF_STORE disk

Verify that the last_update date is initizlied in the OVF_STORE disk to prevent NPE.
If the last_update date is not initialized in the disk we don't count
this disk to be retrieved, unregistered entities, from, since it is not
initilized with entities.

Change-Id: I8e59086ce7242d7aaec10b57b6775ab968c9fe1c
Bug-Url: https://bugzilla.redhat.com/1130976
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Override unregistered entity on deatch.

Override unregistered entity when there is an existing entity which
already exists as an unregistered entity.

This can happen when a domain with an unregistered entity, is attached and
a VM with disks on multiple storage domains exists in the setup and also
as an unregistered VM.

Once the VM will be created with disk on the attached Storage Domain,
the unregistered entity should be overriden with the existing one, on
detach process.

Change-Id: Id22390ae392e95bbc73a5976fc886ed21da4989b
Bug-Url: https://bugzilla.redhat.com/1132568
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Add unregistered entities to the ovf tar file

Sync the unregistered entities with the existing entities in the setup
to be stored in the OVF_STORE disk.

Change-Id: Icc5fc1c1b704ecbb49fe3d4c2561ec1836093369
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Validate disk registration only if a domain exists.

Registeration of a disk is only a DB operation and does not encounter
any VDS commands, therefore there should not be any validation for Storage
Domain activation.

Change-Id: I71c138ede22808b5a887e9b9982c154e5591d5c9
Related to Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Use the latest OVF_STORE files

Rotate over the OVF_STORE disks and retrieve the entities from the best
match of the OVF_STORE disk until succeeded.
Also register those disks as OVF_STORE disks, so it will be updated
every time there will be any change in the entities' OVF.

Change-Id: I8252281f295df49a28c3c131d9a98fef9af8f35e
Bug-Url: https://bugzilla.redhat.com/1138114
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Validate Storage Domain for Importing Template from configuration

For each disk in the template, we should fetch the Storage Domain and
validate that it exists and active.

Today, we set the storage id for each image and then use getStorageDomain method to fetch
the Storage Domain with that id, but when the Storage Domain being initialized, it will always check
the first Storage Domain every time.

Change-Id: I2bfe3ba9b48747650291a887255e85358ed0799a
Bug-Url: https://bugzilla.redhat.com/1138200
Bug-Url: https://bugzilla.redhat.com/1140560
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>
core: Use error for audit log on import template from configuration.

Use error audit log instead of refular audit log when the import VM from
configuration fails

Change-Id: I134f3a2015b7f249a361bd237b824709f7210f40
Bug-Url: https://bugzilla.redhat.com/1140584
Signed-off-by: Maor Lipchuk <mlipchuk@redhat.com>