Delete ui/libs/modernizr.custom.76777.js

modernizr provides support for HTML5 and CSS3. As all the browsers
supported by Kimchi alreay has support for those technologies we don't
need it.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Delete ui/js/modernizr.custom.2.6.2.min.js

This file is not in use by Kimchi. So we don't need to keep it in the
source code.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Prevent disks from being added twice

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Issue #473: Update selectMenu method to set a default value.

On all pages with selectMenu (combobox) the user had to choose an
option to effectively store its value in the form.

This patch updates the function to use the first option as default
value. With this patch, user can skip the combo selection if want
use the first option.

Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com>
Re-raise the original exception when creating a new Template

To avoid problems with full disks, all the objectstore operations are
made in a try/except block - so in any problem we can properly inform
the user. But an exception is also expected for duplicated entries.
In that case we should raise the original exception.
Fix it.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Use objectify to Remove metadata namespace

When libvirt does not support virDomain.metadata() we need to do string
manupulation to remove the Kimchi namespace. It was done using regex
which was causing problems to remove undesirable content.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Check currentMemory exists prior to remote its XML node

When updating the guest memory, the currentMemory node must be removed
to reflect the new value.
But if the guest was never started it does not have a currentMemory
node. So check it is exists prior to remove it.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Ensure the guest volume exists to remove it

In some cases, the guest volume may not be in a pool and
virStorageVol.storagePoolLookupByVolume() will raise an exception which
will point the user to a false negative guest deletion - as an error is
shown to him but the guest was really deleted.
So prevent it by using a try/except block around
virStorageVol.storagePoolLookupByVolume()

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Pass libvirt connection as CapabilitiesModel parameter

CapabilitiesModel depends on libvirt connection to properly run the
FeatureTests against the right connection.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
bug fix: Update storage volume ref_cnt when VM is deleted

As we only allow user to attach a free volume to a VM we need to make
sure this information is always valid.
So update the ref_cnt when deleting a VM.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Update clone test

The clone model test assumes that the default VM is running so it can
expect an exception when trying to clone that VM. But that's not always
the case. Also, the test doesn't wait for the clone operation to finish,
which sometimes may cause an error.

Make sure the VM used in the test is running before cloning it
(expecting an exception) and wait for the clone task to finish before
moving on to the next test.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Create domain snapshots

A new command is added to create a new snapshot:

POST /vms/<vm-name>/snapshots {'name': '<snapshot-name>'}

It creates a new snapshot with the current state of the VM. Currently,
due to Kimchi not supporting paused states, snapshots can only be
created when the VM is shut off. The parameter 'name' is optional;
Kimchi will create a default value based on the current time if it's not
provided.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Lookup a domain snapshot

A new command is added to look up an existing snapshot:

GET /vms/<vm-name>/snapshots/<snapshot-name>

It returns the following values:

* created: The time when the snapshot was created (in seconds, since the
    Unix Epoch);
* name: The snapshot name;
* parent: The name of the parent snapshot;
* state: The corresponding VM state when the snapshot was created
    (currently, it can only be 'shutoff');

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: List domain snapshots

A new command is added to list all existing snapshots on a virtual
machine:

GET /vms/<vm-name>/snapshots

It returns a list of snapshot structures (as returned by 'GET
/vms/<vm-name>/snapshots/<snapshot-name>') which exist on a virtual
machine.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Delete a domain snapshot

A new command is added to delete an existing snapshot:

DELETE /vms/<vm-name>/snapshots/<snapshot-name>

It deletes the specified snapshot from the virtual machine.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Lookup current snapshot on a domain

A new command is added to look up the current snapshot on a virtual
machine:

GET /vms/<vm-name>/snapshots/current

It returns a snapshot structure (as returned by 'GET
/vms/<vm-name>/snapshots/<snapshot-name>') of the current snapshot on
the specified virtual machine. If the VM doesn't have a current
snapshot, an exception will be returned.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Revert a domain to a snapshot

A new command is added to revert a virtual machine to a specified
snapshot:

POST /vms/<vm-name>/snapshots/<snapshot-name>/revert

It changes the specified VM state to the exact same one as it was when
the snapshot was created.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Add model tests

Add the model tests related to snapshot.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Delete snapshots when deleting a VM

If a virtual machine is deleted, its snapshots should also be deleted.

Update the function "VMModel.delete" in order to delete snapshots
before deleting the virtual machine.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
snapshot: Clone snapshots when cloning a VM

If a virtual machine is cloned, its snapshots should also be cloned so
we can have a real clone of the original VM.

Update the function "VMModel.clone" in order to clone the snapshots when
cloning a VM.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>