Fix gnt-network list-tags

Define network tags in haskell part.

This fixes issue 641.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Fix RAPI network tag handling

The network tags were absent from an if check used to actually list
tags. The patch fixes the oversight, and adds a proper error message in
case the issue occurs again for a new tag type.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Add network tag tests to QA

The QA did not have a test for network tags until now, and this patch
remedies the situation.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Make network tags searchable

This patch adds the network tags to the tags searched by gnt-cluster
search-tags, and in the process cleans up the code slightly.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Update opcodes test to include network tags

This patch adds the network tags to the list of all other tag types
that can be tried in QuickCheck tests.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Add support for blktap2 file-driver

Newer Xen versions use blktap2 instead of blktap. This patch adds support
for it in Ganeti.

Fixes Issue 638.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Merge branch 'stable-2.8' into stable-2.9

* stable-2.8
  Add support for blktap2 file-driver
  Update opcodes test to include network tags
  Make network tags searchable
  Add network tag tests to QA
  Fix RAPI network tag handling
  Fix gnt-network list-tags

Conflicts:
	lib/cmdlib/tags.py
	test/py/ganeti.hypervisor.hv_xen_unittest.py
Resolution: manually apply the changes from stable-2.8 to
            the stable-2.9 code.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Fix testEncodeInstance test input

The input of the testEncodeInstance test was not adherent to the actual format
of the Ganeti configuration file: kvm has no HV_BLOCKDEV_PREFIX, and "hvparams"
inside an instance should only contain the values of the hypervisor parameters,
not the hypervisor name, which is already declared in the "hypervisor" field,
and which was not correctly aligned with the parameters in the "hvparams"
section.

All these problems are now fixed, and the assertions are changed accordingly.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Ensure that all the hypervisors exist in the config file

All the hypervisors are supposed to exist in the config file, but it might not
be so after upgrades from old versions. This patch ensures that all the missing
hypervisors are added with their default values to the config file.

Also, some tests are adapted, because now they receive the default values
instead of an empty dictionary when they are working using a minimal cluster
config as their input.

Fixes Issue 640.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Update the NEWS file with the Issue 640 fix

Add an entry in the NEWS file describing the fix of Issue 640.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Add an optional inotify to jobs in the scheduler

This provides the infrastructure to monitor running jobs
by inotify, and hence update the queue promptly upon
job changes.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Cleanup inotifies

When cleaning up finished jobs, remove the inotify
attached to them, if any.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
JQScheduler: always pass JobWithStat

When attaching inotifies to jobs, we need to preserve
it through potential requeuing actions. Also, this information
is needed for cleaning up.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Attach a watcher for jobs

Add a function that can serve as an event handler for inotify
updating a job in the job queue if the corresponding job file
changes. Also attach it to all jobs selected to be run.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
After detecting a finished job, schedule again

In order to obtain a higher throughput of jobs, schedule new jobs
as soon as a job was detected to have finished.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Increase job queue polling interval

Now that all jobs are monitored with inotify, increase the polling interval.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Catch exceptions when calling curses.setupterm() in QA

If it's running on a non-standard terminal, such as
rxvt-unicode-256color, the call fails with an exception. Instead, catch
the exception and proceed without coloring warnings/errors.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Change usb_devices separator to whitespace

The usb_devices parameter was using comma as a list separator, but this cannot
work because comma is already used as the hypervisor parameter separator.

Change it to use whitespace as a separator, in accordance to what already done
for the extra parameters.

The NEWS file is updated accordingly.

Fixes Issue 649.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Add missing NEWS entries from stable-2.8

Some fixes where pushed to the stable-2.8 branch without a corresponding NEWS
entry. This patch adds them.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Also consider filter fields for deciding if using live data

If the query fields don't require live data, we use the shortcut
and don't request live data. However, we cannot take this shortcut
if the fields the filter depends on requires live data.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>