Disable pylint E1101 on hypothetical import

In some versions of python the module IN does not provide
the constant SO_PEERCRED (issue 191). So in commit 069a4b
a work around was added. However, this work around still
leaves lint warnings when working with those versions of
python. So disable this warning during the work around,
so that users of these python versions can still develop
and contribute to ganeti.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Support big-step shrinking in tiered allocation

In tiered allocation, if by shrinking only a single resource a valid
allocation can be found, shrinking is bound to shrink on this resource.
Of course, after shrinking that resource a little bit without finding
an allocation, this property is still valid. So we can as well shrink
on that resource as far as needed to get a valid allocation.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Fix typo in ganeti-2.8 design doc

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add documentation for harep

Include a section in the Administrator's guide describing how to use the
autorepair tool.

Fixes Issue 446

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Update design document for hroller

The requirement to be able to plan full node evacuation came up after
the initial design. So add a section describing the algorithm, if
full evacuation is requested.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Make NIC setup more flexible in case of Xen

For every NIC write down a file that contains NIC's
info (MAC, mode, link, network details), that can
be sourced by any vif script.  The file location is:
/var/run/ganeti/xen-hypervisor/nic/<domname>/<nicidx>.

This file is created upon cfg file creation and before
starting the instance and can be sourced by an external
script. Before file creation ensure that all parent dirs
exist.

Cleanup NIC dir when removing config files. Upon Xen
configuration file removal, remove NIC dir as well.

Add new hv param vif_script that allows execution of
user defined networking script and overrides the one
xend is configured with in xend-config.sxp

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Refactor NIC configuration scripts

Add new script vif-ganeti that could be used instead of
default vif-bridge in order NIC customization can be more
flexible.

Extract common code from kvm-ifup and insert it in a new
file net-common that is being sourced by kvm-ifup and
vif-ganeti and located under package lib dir (/usr/lib/ganeti/).

Install vif-ganeti properly with make under /usr/lib/ganeti too.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Document vif-ganeti usage

In order to be able to use it as vif-script one has to
create a symbolic link inside /etc/xen/scripts pointing
to /usr/lib/ganeti/vif-ganeti and then add is a hypervisor
parameter.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Design doc for openvswitch support

This patch includes the design document for openvswitch support

Signed-off-by: Sebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Add exclusive_storage to blockdev_grow RPC

The flag is passed to the RPC, but it's still ignored by noded.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Limit the PVs used for disk growth with exclusive storage

The exclusive storage flag is passed along in the backend functions for
disk growth. LVM volumes handles the flag by reusing the same PVs, as disks
are constrained by the number of their spindles.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Enable disk growth with exclusive storage

Disk growth is now supported also with exclusive storage, so we let the
operation continue.

Enable disk growth test in qa also with exclusive storage.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Don't exceed the standard PV size when growing a disk

With exclusive storage, PVs are supposed to be used only up to the
standard PV size.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
build_chroot: use APT_INSTALL macro for packet installation

In this way, it is easier to change all the apt calls in the chroot.
In particular, this patch fixes the missing -y option for the installation
of the tools needed to build debian packages.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
build_chroot: fix duplicate install

In the last change to the chroot build script, the
apt-get command 'install' was moved to the APT_INSTALL
macro; however, it was forgotten to remove it outside
the macro, causing an error, as there is no package
with name 'install'.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Allow customization of the chroot

As different users have different needs about the chroot, allow
customization in its build script. This is achieved as follows.
- The environment variable EXTRA_DEBIAN_PACKAGES is honored,
  and the packages named there are additionally installed in
  the chroot. This should cover the most common cases.
- More complicated customizations can be achieved by setting
  the environment variable CHROOT_FINAL_HOOK. This is the last
  command executed in the chroot; typically, it would be
  a call to a personal script.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Remove obsolete TODO

Originally, hroller started as a tool for offline maintenance only.
There it made sense to warn about instances still running. By now,
default planning is to migrate instance off the nodes to be rebooted,
with options for other behavior (like pretending that all instances
will be shut down before the actual reboots start). In that scenario
instances running is the normal situation, not something to be warned
about.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Clarify meaning of --print-moves in hroller man page

When given the option --print-moves, hroller prints a list of
instance relocations after each reboot group. This sequential
presentation can lead to the wrong impression, that these are
all the moves to be carried out. Therefore, explicitly mention
the assumption that after each reboot of a group, all instances
are moved to their initial position.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Update comments in hroller code

hroller schedules moves of instances to have rebooted nodes
free of instances with this node as primary. Update the comments
to reflect that this move planning is for non-redundant instances
only.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
Make hroller not consider offline nodes for evacuation

When planing on where to evacuate the non-redundant instances
of the nodes to be rebooted, it doesn't make sense to consider
offline nodes. So add this restriction to hroller.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>