ganeti-local
10 years agoBump new upstream version debian-2.8-grnet
Dimitris Aragiorgis [Tue, 17 Dec 2013 11:11:22 +0000 (13:11 +0200)]
Bump new upstream version

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoMerge branch 'stable-2.8.4-grnet' into debian-2.8.4-grnet
Dimitris Aragiorgis [Tue, 17 Dec 2013 11:01:44 +0000 (13:01 +0200)]
Merge branch 'stable-2.8.4-grnet' into debian-2.8.4-grnet

10 years ago(packaging) Add vcs-version file stable-2.8-grnet
Dimitris Aragiorgis [Tue, 17 Dec 2013 11:00:44 +0000 (13:00 +0200)]
(packaging) Add vcs-version file

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoAdd new debian/changelog section
Dimitris Aragiorgis [Wed, 11 Dec 2013 15:38:28 +0000 (17:38 +0200)]
Add new debian/changelog section

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoChange source package to snf-ganeti
Dimitris Aragiorgis [Wed, 11 Dec 2013 14:19:00 +0000 (16:19 +0200)]
Change source package to snf-ganeti

..and make ganeti2 dummy package depend on snf-ganeti.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoRemove debian patch that cannot apply
Dimitris Aragiorgis [Tue, 10 Dec 2013 09:27:39 +0000 (11:27 +0200)]
Remove debian patch that cannot apply

Since we run autogen.sh inside debian rules Makefile.in is not
included in original source tree and thus a debian patch that
changes this file cannot apply.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoRun ./autogen.sh before configure
Dimitris Aragiorgis [Mon, 9 Dec 2013 13:45:34 +0000 (15:45 +0200)]
Run ./autogen.sh before configure

This is needed so that packaging can be done by using official
src tree found on git repo.

Official debian packages provide in orig tarball the files
that get generated by automake, autoconf, and aclocal:

 * configure
 * Makefile.in
 * autotools scripts

We decide not to track those files in upstream branch (which are
already included in .gitignore), instead we generate those
files on every build.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoganeti -> snf-ganeti in debian/rules
Dimitris Aragiorgis [Tue, 15 Oct 2013 16:16:53 +0000 (19:16 +0300)]
ganeti -> snf-ganeti in debian/rules

override dh_install init, cron, logrotate with --name option.

Additional changes:
 - Let ganeti run as root
 - Do not enable restricted commands and do not require specific user/group.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoRename ganeti.* debian files to snf-ganeti.*
Dimitris Aragiorgis [Tue, 15 Oct 2013 15:44:57 +0000 (18:44 +0300)]
Rename ganeti.* debian files to snf-ganeti.*

Change genscript.py to search for those files

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoganeti -> snf-ganeti in debian/control
Dimitris Aragiorgis [Tue, 15 Oct 2013 13:48:41 +0000 (16:48 +0300)]
ganeti -> snf-ganeti in debian/control

snf-ganeti Provides, Replaces, Conflicts ganeti
ganeti-haskell replaces snf-ganeti
 - /usr/share/man/man8/ganeti-confd.8.gz
   was in Ganeti 2.6 but now is provided by ganeti-haskell
ganeti still replaces deprecated ganeti2 package

Additionall changes:
 - Add python-fdsend dependency needed by hotplug
 - Suggest ganeti-instance-debootstrap; don't recommend it

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoRemove debian patch that does not apply on 2.8
Dimitris Aragiorgis [Fri, 6 Dec 2013 06:18:42 +0000 (08:18 +0200)]
Remove debian patch that does not apply on 2.8

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoImport debian files from wheezy-backports
Dimitris Aragiorgis [Fri, 6 Dec 2013 06:06:34 +0000 (08:06 +0200)]
Import debian files from wheezy-backports

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(ipfix) Allow NICs with mode=routed and ip=none
Dimitris Aragiorgis [Mon, 16 Dec 2013 01:13:48 +0000 (03:13 +0200)]
(ipfix) Allow NICs with mode=routed and ip=none

This allows us to define an IPv6 only network (currently with a
dummy IPv4 network) with connectivity mode 'routed' and let
the NICs inside this network have only IPv6 address (auto-generated
from their MAC and the network's prefix).

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(kvm) Add migration capabilities if supported
Dimitris Aragiorgis [Tue, 3 Dec 2013 13:42:28 +0000 (15:42 +0200)]
(kvm) Add migration capabilities if supported

This just adds two monitor commands before migration
in order to optimize performance. If the migrate_set_capability
command is not supported nothing bad happens.

TODO: parse monitor output or introduce a method to find
supported monitor commands.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(ext) Do not remove disks if --keep-disks and DT_EXT
Dimitris Aragiorgis [Thu, 17 Oct 2013 15:47:18 +0000 (18:47 +0300)]
(ext) Do not remove disks if --keep-disks and DT_EXT

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(ext) Override disk_cache hvp with disk param in ext
Dimitris Aragiorgis [Tue, 3 Dec 2013 09:41:30 +0000 (11:41 +0200)]
(ext) Override disk_cache hvp with disk  param in ext

This is a hack that brings disk_cache hypervisor param
at disk level. This is supported only for disks of ext
template that allow arbitrary params. The corresponding
param that should be used is 'cache'.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(ext) Pass disk geometry in kvm command
Dimitris Aragiorgis [Tue, 3 Dec 2013 09:32:21 +0000 (11:32 +0200)]
(ext) Pass disk geometry in kvm command

Currently we allow this feature only for ext templates that
allow arbitrary params per disk. If both 'heads' and 'secs'
params are given then 'cyls' is calculated from the disk size.

TODO: export these params in IDISK_PARAMS since the can be
useful for every disk.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(ext) Export logical_id info to hooks env
Dimitris Aragiorgis [Mon, 2 Dec 2013 10:26:58 +0000 (12:26 +0200)]
(ext) Export logical_id info to hooks env

DISK_ID as the second part of logical_id

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(b64) Use base64 encoding in networks' bitarrays
Dimitris Aragiorgis [Wed, 2 Oct 2013 19:36:54 +0000 (22:36 +0300)]
(b64) Use base64 encoding in networks' bitarrays

This is needed for GRNET'S production environment.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(snap) Snapshot support for ExtStorage
Dimitris Aragiorgis [Wed, 16 Oct 2013 18:46:25 +0000 (21:46 +0300)]
(snap) Snapshot support for ExtStorage

Extend existing RPC params with the snapshot name and
add allow snapshot not only for LVM but also for EXT.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(grnet) Remove deprecated idx slot from NIC/Disk objects
Dimitris Aragiorgis [Thu, 28 Nov 2013 09:39:00 +0000 (11:39 +0200)]
(grnet) Remove deprecated idx slot from NIC/Disk objects

This code will run when reading old kvm runtime files created
by hot-plugging related code back in Ganeti 2.6.2

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(grnet) Enable -device option for old disks upon migration
Dimitris Aragiorgis [Thu, 28 Nov 2013 07:04:09 +0000 (09:04 +0200)]
(grnet) Enable -device option for old disks upon migration

Change _GenerateDeviceKVMId() to take device index as an
extra argument. In case device has uuid and pci info
we return proper device id. In case idx is given we return
a dummy id (e.g. hotdisk-0). Otherwise we raise an Exception.

This is used only by GenerateKVMBlockDevicesOptions() for
block_devices found in runtime files that have not uuid or
pci info (Ganeti 2.6.2 hotplug implementation). By returning
a dummy id we enable -device option in for paravirtual disk types.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(grnet) Move disk options before nic ones in kvm command
Dimitris Aragiorgis [Thu, 28 Nov 2013 06:25:59 +0000 (08:25 +0200)]
(grnet) Move disk options before nic ones in kvm command

Older versions of Ganeti did ensure that during startup
disk devices will be inserted before nic devices in PCI
configuration space. KVM inserts devices to PCI slots
depending on the order of command line options.

Upon migration kvm command options are re-generated based
on runtime files info. To be able to migrate instances
with old format runtime files put disk options before
NIC ones so that disk occupy the first pci slots available
and not the other way around.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(grnet) Hotplug: cfgupgrade for deprecated fields
Dimitris Aragiorgis [Fri, 12 Jul 2013 12:34:07 +0000 (15:34 +0300)]
(grnet) Hotplug: cfgupgrade for deprecated fields

Add cfgupgrade so that we remove any deprecated fields hotplug
implementation used in the past.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Introduce _UpgradeSerializedRuntime() method
Dimitris Aragiorgis [Fri, 29 Nov 2013 19:14:19 +0000 (21:14 +0200)]
(2.10) Introduce _UpgradeSerializedRuntime() method

This method is invoked during _AnalizeSerializedRuntime() and is
meant to modify runtime files in the way cfgupgrade does for
config.data.  This could remove deprecated fields, change the
format of the file, add/remove sections, etc.

There is a possibility data included inside runtime
files to cause migration failures after a Ganeti upgrade.
Use this method to avoid such cases.

Commit cc6fd3d exports NICs' UUIDs to configuration scripts.
It assumes UUIDs as an non optional slot in NIC object.
This is true for latest Ganeti versions. Still there might
be instances created back in Ganeti 2.7 missing that slot.

Ganeti 2.10 supports hot-plugging of devices. A prerequisite
for this feature was to change the format of runtime files and
add another entry containing block devices. This was done in
_AnalizeSerializedRuntime(). Move this logic in the new method.

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

10 years ago(2.10) Export NIC's UUID and name to network scripts
Dimitris Aragiorgis [Fri, 22 Nov 2013 19:59:45 +0000 (21:59 +0200)]
(2.10) Export NIC's UUID and name to network scripts

In case of kvm None values are not allowed in env dict
so we have to add name only if not None.

In case of Xen since we are writing on a file that
is going to be sourced we should not add INTERFACE_NAME=None.

Fix IP=None case.

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

10 years ago(2.10) Use HooksDict() to export network options in Xen
Dimitris Aragiorgis [Fri, 22 Nov 2013 19:59:44 +0000 (21:59 +0200)]
(2.10) Use HooksDict() to export network options in Xen

Remove duplicate code that exports network options to environment
variables.

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

Conflicts:
lib/hypervisor/hv_xen.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Export tags via GetTags() to network scripts
Dimitris Aragiorgis [Fri, 22 Nov 2013 19:59:43 +0000 (21:59 +0200)]
(2.10) Export tags via GetTags() to network scripts

Use GetTags() instance method in order to export instance tags
to NIC configuration scripts and files of kvm and xen hypervisors.

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

10 years ago(2.10) Fix net-common script in case of routed mode
Dimitris Aragiorgis [Fri, 22 Nov 2013 19:59:42 +0000 (21:59 +0200)]
(2.10) Fix net-common script in case of routed mode

setup_route should run in case or routed mode and not
openvswitch.

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

10 years ago(2.10) Introduce --hotplug-if-possible option
Dimitris Aragiorgis [Thu, 21 Nov 2013 12:27:10 +0000 (14:27 +0200)]
(2.10) Introduce --hotplug-if-possible option

This will be useful for an external entity using RAPI that
wants to modify devices of instances.

The common use case for that is:
"I want to add a NIC/disk to an instance. If it is running
then try to hotplug the device. If not, then just add it to config."

Another use case is that if we are unaware of the instance's
hypervisor: "I want do add a NIC/disk to an instance and if
its hypervisor is KVM try to hotplug it."

For all those cases just print a warning in CheckPrereq() and
disable any further hotplug related actions (and let
modifications take place after reboot).

Add NoHoplugSupport and HotplugIfPossible unittests an modify
existing by explicitly creating successful RPC results for
call_hotplug_supported.

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

Add pylint disable in CheckPrereq() of LUInstanceSetParams
(too many local variables)

Conflicts:
lib/cmdlib/instance.py
src/Ganeti/OpCodes.hs
src/Ganeti/OpParams.hs
test/py/cmdlib/instance_unittest.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) RAPI: Make use of request_body in Reboot/Remove
Dimitris Aragiorgis [Thu, 14 Nov 2013 12:10:53 +0000 (14:10 +0200)]
(2.10) RAPI: Make use of request_body in Reboot/Remove

Until now, the shutdown_timeout parameter could only be passed to
ShutdownInstance() inside kwargs, causing it to be included in the
request body. Based on that, extend RebootInstance() and
RemoveInstance() so that they can take extra arguments (e.g.
shutdown_timeout) and pass them eventually to the corresponding opcode.

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

10 years ago(2.10) RAPI: Pass depends body arg (if any) to opcode
Dimitris Aragiorgis [Thu, 14 Nov 2013 12:10:52 +0000 (14:10 +0200)]
(2.10) RAPI: Pass depends body arg (if any) to opcode

Most rlib2 classes override the default _GetDefaultData() method with
custom methods that parse a request's body and query args and return a
(body, specific_static) tuple eventually passed to FillOpCode().
Job dependencies are defined in the `depends` body argument that might
get lost because most of those methods return {} as the body. In order
not to modify every custom method we update the returned body with
the `depends` argument of the original request body for all RAPI calls
inside OpcodeResource._GenericHandler(). It's up to the client to
include the `depends` argument with the job dependencies if desired.

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

10 years ago(2.10) Allow instances to obtain externally reserved IPs
Dimitris Aragiorgis [Fri, 1 Nov 2013 14:24:38 +0000 (16:24 +0200)]
(2.10) Allow instances to obtain externally reserved IPs

The administrator should be able to assign an externally reserved IP
to a Ganeti instance manually, if desired. Currently this is not
supported. External reservations should act as holes in the pool and
not just as IPs already used by someone outside of Ganeti.
Automatic allocation with ip=pool will continue to exclude those IPs
as happens now.

To allow such functionality the administrator needs to pass explicitly
the desired IP along with the ``--no-conflicts-check`` option, or else
an error will be produced as happens now.

The aforementioned require the following changes:

 - Make IsReserved() to look either in reservations or external ones.
 - Make Reserve() and Release() to use IsReserved() with external
   argument True or False.
 - Pass extra option to ReserveIp() to bypass checking of external reservations
 - Update man pages and design doc for this change.

Furthermore, a side effect of this patch is that it fixes the
following problem:
Currently, one could not mark an IP as external if it was already
reserved (i.e. belonged to an instance). The code would produce a warning
and fail silently.

Fix config_mock.py so that if network and ip is given then reserve it in
the pool.

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

Conflicts:
test/py/cmdlib/testsupport/config_mock.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Mark cluster's IPs as externally reserved
Dimitris Aragiorgis [Fri, 1 Nov 2013 14:24:37 +0000 (16:24 +0200)]
(2.10) Mark cluster's IPs as externally reserved

Currently, upon network creation, nodes' and master's IPs
are reserved in the pool.

This leads to pool reservations ('X' in map) that cannot be changed
afterwards, although they may need to (e.g. in case of node
removal/modification). Also, these IPs are not actually handled by
Ganeti in the sense that they are not assigned to the cluster's VMs.

Thus, we should mark the as externally reserved and not just reserved.

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

10 years ago(2.10) Check if hotplug is supported in CheckPrereq
Dimitris Aragiorgis [Wed, 30 Oct 2013 16:56:01 +0000 (18:56 +0200)]
(2.10) Check if hotplug is supported in CheckPrereq

Introduce new RPC hotplug_supported that invokes the corresponding
hypervisor's method which checks if hotplug is generally
supported. Call this RPC early in CheckPrereq() and abort if
hotplug is not supported. Currently only KVM hypervisor with
qemu versions > 1.0. Please note that this check is unaware of
target device and hotplug action. This latter check is still
done during hotplug_device() RPC.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

Conflicts:
lib/cmdlib/instance.py
test/py/cmdlib/instance_unittest.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) SimpleRetry on BlockDev.Remove()
Dimitris Aragiorgis [Fri, 25 Oct 2013 15:43:06 +0000 (18:43 +0300)]
(2.10) SimpleRetry on BlockDev.Remove()

Sometimes, upon disk removal, corresponding file descriptors
are kept briefly open by various processes (hypervisor, blkid, etc.).
With this patch, we retry several times before raising the appropriate
error, thus making disk removal more robust against those corner cases.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

In stable-2.10 we have constants auto-generated from haskell

Conflicts:
lib/constants.py
src/Ganeti/HsConstants.hs

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) drive_del after device_del in disk hot-remove
Dimitris Aragiorgis [Thu, 17 Oct 2013 12:25:12 +0000 (15:25 +0300)]
(2.10) drive_del after device_del in disk hot-remove

This is needed so that qemu process really releases the
corresponding file descriptor and thus we can dmsetup/lvremove
the device without errors.

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

10 years ago(2.10) Minor changes regarding hotplug support
Dimitris Aragiorgis [Sat, 12 Oct 2013 18:25:37 +0000 (21:25 +0300)]
(2.10) Minor changes regarding hotplug support

* Mention restrictions in NEWS
  - RBD userspace access mode
  - In case of a downgrade instances should suffer a reboot to be migrateable
* Bypass interactive verification in NIC modifications via --force option
  - Mention it in man page
* Print "modifications take place after restart" message no matter if
  --hotplug option is passed. Change cmdlib to append hotplug status info
  (if any) to the final result printed out to the user
* Change hotplug option description

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

Conflicts:
NEWS

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Fix in RPC
Dimitris Aragiorgis [Fri, 11 Oct 2013 00:53:23 +0000 (03:53 +0300)]
(2.10) Fix in RPC

Use _SingleDiskDictDP() instead of _ObjectDict() for serializing
a disk.

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

In stable-2.10 rpc methods take node as first argument.

Conflicts:
lib/rpc.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) block_devices -> kvm_disks renaming
Dimitris Aragiorgis [Fri, 11 Oct 2013 00:52:09 +0000 (03:52 +0300)]
(2.10) block_devices -> kvm_disks renaming

and a couple more styple fixes.
block_devices are misleading so rename them to kvm_disk (just like kvm_nics)

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

Remove uri occurrences.

Conflicts:
lib/hypervisor/hv_kvm.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Make hotplug related method raise HotplugError
Dimitris Aragiorgis [Fri, 11 Oct 2013 00:50:56 +0000 (03:50 +0300)]
(2.10) Make hotplug related method raise HotplugError

Hotplug is not supported by default and thus we raise
HotplugError() for hotplug related methods.
If a hypervisor wants to support it, we must override VerifyHotplugSupport()
and implement the Hot* method.

Backend invokes VerifyHotplugSupport() and raises RPCFail if an
exception is raised.

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

10 years ago(2.10) Some fixes in _GenerateKVMBlockDevicesOptions()
Dimitris Aragiorgis [Thu, 10 Oct 2013 13:00:44 +0000 (16:00 +0300)]
(2.10) Some fixes in _GenerateKVMBlockDevicesOptions()

* Add docstring.
* fix missed usecase of boot_disk=False if kernel_path is given.
* Use devlist arg in GenerateKVMBlockDeviceOptions()
  This is previously calculated in _ExecuteKVMRuntime()
  so there is no need to rerun the same command.

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

10 years ago(2.10) Add unittests for Hotplug support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:40 +0000 (17:45 +0300)]
(2.10) Add unittests for Hotplug support

Try base InstanceSetParams tests that modify instance's
devices with hotplug=True.

Add some unittests for kvm hypervisor regarding runtime file
manipulation. Based on a sample runtime file search for
specific disk and nic entries based on their UUID.

Add unittest for kvm device id generation.

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

The test should not expect the uri entry in kvm_disks tuple

Conflicts:
Makefile.am
test/py/cmdlib/instance_unittest.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Extend qa to test hotplug support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:39 +0000 (17:45 +0300)]
(2.10) Extend qa to test hotplug support

Only if default hypervisor is KVM try all hotplug related actions.

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

10 years ago(2.10) Hotplug: Update manpages and NEWS
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:37 +0000 (17:45 +0300)]
(2.10) Hotplug: Update manpages and NEWS

Add --hotplug entry in gnt-instance manpage.
Add NEWS entry for hotplug support.
In both cases mention that hotplug is only supported for
the KVM Hypervisor version >= 1.0.

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

Conflicts:
NEWS

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Hotplug: client support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:36 +0000 (17:45 +0300)]
(2.10) Hotplug: client support

Add --hotplug option. Only used in OpInstanceSetParams.
If this is omitted, modifications become effective after reboot.

Ask user confirmation in case NIC modify + hotplug because it will
be done via removing old NIC (and the corresponding tap) and adding
a new one in the same PCI slot.

Corresponding mods in haskell opcode definitions.

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

Conflicts:
src/Ganeti/OpCodes.hs
src/Ganeti/OpParams.hs

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(fix) SetDiskID() before blockdev_assemble()
Dimitris Aragiorgis [Sun, 8 Dec 2013 05:43:33 +0000 (07:43 +0200)]
(fix) SetDiskID() before blockdev_assemble()

Before blockdev_assemble we call SetDiskID() in order to fill up
physical_id of disk needed by bdev.Assemble and eventually by
constructor of each BlockDev.

This is not needed in 2.10 since physical_id has become deprecated.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Hotplug: cmdlib support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:35 +0000 (17:45 +0300)]
(2.10) Hotplug: cmdlib support

Hotplugging is done by functions invoked by ApplyContainerMods(). In
order hotplugging to take place the --hotplug option must be passed
otherwise the modifications will take place after reboot.

NIC hotplug supports add, remove and modify. The modify is done by removing
the existing NIC and adding a new one in the same pci slot.

Disk hotplug supports add and remove.  Before hotplugging a Disk it
must be assembled. Use blockdev_assemble RPC, get the device link_name
and then call hotplug RPC command.

In order to remove a disk (with blockdev_remove) it must be shutdown. So
after unplugging the disk ShutdownDiskInstanceDisks() must be invoked.

For both device types we use the generic RPC call_hotplug_device.

Also adapt unit tests to follow the change.

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

cmdlib unittests do not exist in stable-2.8
The other were easy to resolve

Conflicts:
lib/cmdlib/instance.py
lib/cmdlib/instance_storage.py
test/py/cmdlib/backup_unittest.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Return link_name in blockdev_assemble rpc
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:34 +0000 (17:45 +0300)]
(2.10) Return link_name in blockdev_assemble rpc

Until now this RPC returned only dev_path. Since we use it in
hotplug we have to know the simlink of the device so that we
pass it to the corresponding hypervisor command and include it
in block_devices entry in runtime files.

Fix unittest to be aware of changed rpc

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

cmdlib unittest do not exist in stable-2.8

Conflicts:
test/py/cmdlib/instance_migration_unittest.py
test/py/cmdlib/instance_unittest.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Hotplug: rpc support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:33 +0000 (17:45 +0300)]
(2.10) Hotplug: rpc support

Introduce new RPC that eventually invoke hypervisor specific
hotplug functions. In order to be generic it has the following
arguments: device type, action, device, extra info, seq.
Device type can be NIC or DISK, action can be ADD, REMOVE,
device is the NIC or Disk object, extra info is used by Disk
hotplug to point the device path and seq is the device index
(from the master perspective)

Add HotplugSupported() in all Hypervisors

Only KVM hypervisor supports this method. The other hypervisors
raise HypervisorError.

Before trying hotplug in backend layer invoke hyper.HotplugSupported
and abort RPC in case it is not implemented or for some other reason
not supported (disk+chroot, nic without fdsend, etc).

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

RPC methods in stable-2.10 take node as first argument

Conflicts:
lib/rpc.py
lib/rpc_defs.py

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Introduce hotplug methods (hypervisor inteface)
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:32 +0000 (17:45 +0300)]
(2.10) Introduce hotplug methods (hypervisor inteface)

4 new methods: HotAddDevice, HotDelDevice, HotModDevice, HotplugSupported
All these are the hypervisor interface with the backend.
In general they read current runtime info, do the actual hotplug
and update the runtime file.

NIC hot-add:
 - open a tap and get its file descriptor.
 - pass fd with SCM rights (using python-fdsend) via monitor socket
 - create netdev and device with id=kvm_devid and proper pci info

Disk hot-add:
 - create drive with id=kvm_devid
 - create device with id=kvm_devid and corresponding pci info

Use MonitorSocket in _PassTapFd in order to connect to monitor socket
and pass the tap's file descriptor using fdsend.

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

10 years ago(2.10) Extract socket related code from QmpMonitor class
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:31 +0000 (17:45 +0300)]
(2.10) Extract socket related code from QmpMonitor class

Separate unix socket related code from QmpMonitor class and
make the latter extend the newly introduced one: MonitorSocket

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

10 years ago(2.10) Helper methods that check for hotplug support
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:30 +0000 (17:45 +0300)]
(2.10) Helper methods that check for hotplug support

Hotplug is currently *not* supported for:

 - KVM < 1.0
 - existing devices in the cluster
 - python-fdsend module is not installed (NIC hotplug)
 - chroot (Disk hotplug)
 - security mode other than None (Disk hotplug)

For the above reasons raise HotplugError exception and
let masterd handle it.

TODO: modify CallHotplugCommand() so that it parses
monitor output and reports whether the command
succeeded or not.

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

10 years ago(2.10) Use -device with pci info if possible
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:29 +0000 (17:45 +0300)]
(2.10) Use -device with pci info if possible

Extend kvm_cmd with -device option for the case of paravirual
Disks and NICs.

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

(fix) Remove uri from kvm_disks

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Helper methods for PCI slots and device ids
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:28 +0000 (17:45 +0300)]
(2.10) Helper methods for PCI slots and device ids

Device naming:
QEMU monitor expects devices to be uniquely named. Device ids derive
from the following function:
kvm_devid = <device_type>-<part of uuid>-pci-<pci_slot>
Device ids must be reproduce-able when we want to remove them.
For that reason we store the pci slot inside the runtime file and
in case we want to remove a device we obtain its pci slot by
parsing the corresponding runtime enrty and matching the device
by its uuid.

Finding the PCI slot:
For newly added devices Hypervisor parses existing PCI allocations
(via _GetFreePCISlot() and eventually ``info pci`` monitor
command) and decides the PCI slot to plug in the device. During
instance startup hypervisor invokes _UpdatePCISlots() for every
device of the instance.  Initial PCI reservations derive from KVM
default setup, that allocates 4 slots for devices other than disks
and NICs.

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

10 years ago(fix) Remove uri slot from block_devices
Dimitris Aragiorgis [Sat, 7 Dec 2013 22:45:38 +0000 (00:45 +0200)]
(fix) Remove uri slot from block_devices

In stable-2.10 we have userspace access mode for rbd. Backend
calculates uri along with link and dev_path. Thus we have
three items in block_devices and kvm_disks tuples.

We this patch we remove the third value.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Prepare block_devices runtime entry
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:27 +0000 (17:45 +0300)]
(2.10) Prepare block_devices runtime entry

With this patch we add another entry in runtime files along with
kvm_cmd, kvm_nics, and hvparams. block_devices that used to be
encapsulated inside kvm_cmd, live now separately just like nics do
but in tupples of (L{objects.Disk}, dev_path).

Introduce also _GetExistingDeviceInfo() helper function to search
for runtime entries. This is going to be useful later in hotplug
methods.

Define new exception: HotplugError.

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

10 years ago(2.10) Prepare kvm options to support -device for disks
Dimitris Aragiorgis [Wed, 9 Oct 2013 14:45:26 +0000 (17:45 +0300)]
(2.10) Prepare kvm options to support -device for disks

Newer kvm version support -device driver,... option where available
drivers can be found by running kvm -device ? command. Currently
ganeti uses `if` property of driver to define the disk type to use
which is also passed as hvparam. This patch prepares the use of
-device option only for paravirtual disks. To support other drivers
as well we must create a mapping between the values passed now as
disk_type hvparam and existing drivers. Note that if -device is used
`if` property of `drive` option should be `none`.

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

10 years ago(2.10) Introduce _GenerateKVMBlockDevicesOptions()
Dimitris Aragiorgis [Fri, 2 Aug 2013 16:37:02 +0000 (19:37 +0300)]
(2.10) Introduce _GenerateKVMBlockDevicesOptions()

Simply move logic that generates block device related
options out of _GenerateKVMRuntime().

NOTE: Back-port corresponding commit from stable-2.10

- 2.8 does not have user-space access support for rbd

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.10) Hotplug: objects and constants additions
Dimitris Aragiorgis [Thu, 9 Aug 2012 10:54:18 +0000 (13:54 +0300)]
(2.10) Hotplug: objects and constants additions

Add pci slot in NIC/Disk objects. This slot will be used only
by hypervisor code. Currently only KVM will use it and store it
temporarily in runtime files.
Add HOTPLUG_* constants to define device types an hotplug actions.

(fix) Add missing opcode parameter

In stable-2.10 opcodes.py is auto-generated from haskell ones.
Add hotplug* params to OpInstanceSetParams.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years ago(2.9) Document vif-ganeti usage
Dimitris Aragiorgis [Wed, 26 Jun 2013 14:38:18 +0000 (17:38 +0300)]
(2.9) 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>

10 years ago(2.9) Refactor NIC configuration scripts
Dimitris Aragiorgis [Wed, 26 Jun 2013 14:38:16 +0000 (17:38 +0300)]
(2.9) 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>

10 years ago(2.9) Make NIC setup more flexible in case of Xen
Dimitris Aragiorgis [Wed, 26 Jun 2013 14:38:15 +0000 (17:38 +0300)]
(2.9) 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>

10 years ago(2.8r) Workaround for Issue 621
Dimitris Aragiorgis [Mon, 25 Nov 2013 16:25:08 +0000 (18:25 +0200)]
(2.8r) Workaround for Issue 621

Upon LUNetworkDisconnect() and LUNetworkConnect() try to acquire
all cluster's instances.

By that _LS_ACQUIRE_ALL acquire mode is set and not
_LS_ACQUIRE_EXACT and thus the deleted lock does cause any problem.

NOTE: This workaround is not merged upstream. They prefer to have
one opcode fail and make the end user retry, rather than have a
greedy way that locks all instances to resolve this. Since synnefo
does not use nodegroups, locking all instances is the same with
locking instances on default nodegroup.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

10 years agoAdd support for blktap2 file-driver
Michele Tartara [Fri, 13 Dec 2013 13:26:23 +0000 (13:26 +0000)]
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>

10 years agoUpdate opcodes test to include network tags
Hrvoje Ribicic [Thu, 12 Dec 2013 15:33:04 +0000 (16:33 +0100)]
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>

10 years agoMake network tags searchable
Hrvoje Ribicic [Fri, 13 Dec 2013 12:47:27 +0000 (12:47 +0000)]
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>

10 years agoAdd network tag tests to QA
Hrvoje Ribicic [Thu, 12 Dec 2013 15:36:04 +0000 (16:36 +0100)]
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>

10 years agoFix RAPI network tag handling
Hrvoje Ribicic [Mon, 16 Dec 2013 13:21:04 +0000 (14:21 +0100)]
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>

10 years agoFix gnt-network list-tags
Dimitris Aragiorgis [Thu, 12 Dec 2013 13:04:11 +0000 (15:04 +0200)]
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>

10 years agoVersion bump for 2.8.3
Michele Tartara [Mon, 9 Dec 2013 13:21:12 +0000 (14:21 +0100)]
Version bump for 2.8.3

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

10 years agoUpdate NEWS for 2.8.3 release
Michele Tartara [Mon, 9 Dec 2013 13:20:28 +0000 (14:20 +0100)]
Update NEWS for 2.8.3 release

List all the changes that happened between 2.8.2 and 2.8.3.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

10 years agoSupport reseting arbitrary params of ext disks
Dimitris Aragiorgis [Tue, 10 Dec 2013 09:14:54 +0000 (11:14 +0200)]
Support reseting arbitrary params of ext disks

If param=default and the param already exists then we remove
it from params dict. This is stolen by GetUpdatedParams() which
is used for hvparams modification/inheritance.

This means that 'default' value is not accepted for an arbitrary
param of an ext disk.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoAllow modification of arbitrary params for ext
Dimitris Aragiorgis [Tue, 10 Dec 2013 16:00:55 +0000 (18:00 +0200)]
Allow modification of arbitrary params for ext

Disks of ext template are allowed to have arbitrary parameters
stored in the Disk object's params slot. Those parameters can be
passed during creation of a new disk, either in LUInstanceCreate()
or in LUInsanceSetParams(). Still those parameters can not be
changed afterwards. With this patch we override this limitation.

Currently, for the other disk templates we allow modifying only
'name' and 'mode'. Therefore, we introduce new constants
MODIFIABLE_IDISK_PARAM* to include those params. If any other
parameter is passed, _VerifyDiskModification() will raise an
exception.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoDo not clear disk.params in UpgradeConfig()
Dimitris Aragiorgis [Tue, 10 Dec 2013 09:14:52 +0000 (11:14 +0200)]
Do not clear disk.params in UpgradeConfig()

Commits 5dbee5e and cce4616 fix disk upgrades concerning params
slot. Since 2.7 params slot should be empty and gets filled
any time needed.

Still ext template allows passing arbitrary params per disk.
These params should be saved in config file for future use.
For instance if we have the shared-filer provider and we
specify shared_dir param during instance create, this param
is needed when we want to attach the disk e.g., during
retrieving instance info. If it gets overridden during a daemon
restart or a config reload we fail to get the instance's info.

To avoid such a failure, we set params slot to an empty dict
only if params not found in the first place.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoSetDiskID() before accepting an instance
Dimitris Aragiorgis [Mon, 9 Dec 2013 12:00:27 +0000 (14:00 +0200)]
SetDiskID() before accepting an instance

SetDiskID() fills physical_id slot of a Disk object.

LUInstanceSetParams() does not invoke SetDiskID() upon creation of a
new disk. As a result the physical_id slot of the Disk object in
config data is missing.

In case of ext disk template, in AcceptInstance() we invoke
_GatherAndLinkBlockDevices(). This takes `instance` as an argument
which includes current disks info. So, after adding a disk,
migration of ext instances will fail because FindDevice() expects
the physical_id slot.

With this patch we invoke SetDiskID() for every disk of the instance
before accept_instance() RPC.

Fixes Issue 633.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoLock group(s) when creating instances
Petr Pudlak [Thu, 28 Nov 2013 14:38:57 +0000 (15:38 +0100)]
Lock group(s) when creating instances

This is required to prevent race conditions such as removing a network
from a group and adding an instance at the same time. (See issue 621#2.)

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoFix job error message after unclean master shutdown
Hrvoje Ribicic [Thu, 5 Dec 2013 09:49:01 +0000 (10:49 +0100)]
Fix job error message after unclean master shutdown

According to commit 599ee321eb, any job-related error messages should
be encoded within a Ganeti-specific error and not passed on as a
string, to allow for easier parsing.

For jobs suffering from an undesirable status after an unclean master
daemon shutdown, the message was not encoded, as reported in issue 618.
This patch fixes the problem.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

10 years agoAdd default file_driver if missing
Michele Tartara [Wed, 4 Dec 2013 17:49:50 +0000 (18:49 +0100)]
Add default file_driver if missing

If the file driver of an instance with file based storage is not specified, the
default one is automatically added by the UpgradeConfig function.

Fixes Issue 571.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

10 years agoUpdate tests
Jose A. Lopes [Mon, 2 Dec 2013 12:07:39 +0000 (13:07 +0100)]
Update tests

Update hypervisor unit tests.

Partial cherry-pick from d2e4e099e4248832fef8ed7b0755d01bd4178e3a

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoXen handle domain shutdown
Jose A. Lopes [Mon, 2 Dec 2013 11:41:33 +0000 (12:41 +0100)]
Xen handle domain shutdown

Update Xen backend to properly recognize when a domain has been
shutdown by the user and to properly cleanup a shutdown domain when
Ganeti requests Xen to stop this domain.

Partial cherry-pick from 9d22cc90609e3ee8f0f2b34b793a3daced3c0e61

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoFix evacuation out of drained node
Jose A. Lopes [Thu, 28 Nov 2013 10:04:25 +0000 (11:04 +0100)]
Fix evacuation out of drained node

* fix node daemon not to skip data, such as, memory and disk size,
  when building the node list to send to HBal, given that these data
  are important for HBal to determine whether an evacuation is
  possible
* fix iallocator to properly load drained nodes from the list passed
  by the node daemon, instead of zeroing all the data, such as, the
  memory and disk size
* this fixes issue 615

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

10 years agoRefactor reading live data in htools
Bernardo Dal Seno [Tue, 4 Jun 2013 16:38:11 +0000 (18:38 +0200)]
Refactor reading live data in htools

This simplifies different handling of individual items.

Cherry-picked from 8c72f7119f50a11661aacba2a1abffdfdc6f7cfa.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

10 years agomaster-up-setup: Ping multiple times with a shorter interval
Petr Pudlak [Tue, 3 Dec 2013 08:03:28 +0000 (09:03 +0100)]
master-up-setup: Ping multiple times with a shorter interval

In the case of network problems, one ping packet can possibly get lost.
Sending multiple packets is safer. The interval between packets is set
to 200ms so that the check finishes faster.

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

10 years agoAdd a packet number limit to "fping" in master-ip-setup
Petr Pudlak [Mon, 2 Dec 2013 10:04:54 +0000 (11:04 +0100)]
Add a packet number limit to "fping" in master-ip-setup

This fixes issue #630. Apparently there is a bug in fping 3.5 where it
loops forever without "-c" given an unreachable host, even though
"-c 1" should be the default according to the man page.

The "-c" flag works on Squeeze. Checking the man pages on the Internet,
fping supported "-c" at least since 2007. So there should be no backward
compatibility problems.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Jose A. Lopes <jabolopes@google.com>

10 years agoFix a bug in InstanceSetParams concerning names
Dimitris Aragiorgis [Thu, 28 Nov 2013 08:19:19 +0000 (10:19 +0200)]
Fix a bug in InstanceSetParams concerning names

In case no name is passed in disk modifications we should
keep the old one. If name=none then set disk name to None.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: Jose A. Lopes <jabolopes@google.com>

10 years agobuild_chroot: hard-code the version of blaze-builder
Petr Pudlak [Thu, 28 Nov 2013 10:46:38 +0000 (11:46 +0100)]
build_chroot: hard-code the version of blaze-builder

The newest version does not build on Debian squeeze, so avoid
it being pulled in as a dependency.

This is the same issue that has been fixed in [1e078ef3] on master.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

10 years agoFix error printing
Jose A. Lopes [Fri, 22 Nov 2013 13:44:02 +0000 (14:44 +0100)]
Fix error printing

Fixes issue 616.

Signed-off-by: Jose A. Lopes <jabolopes@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoAllow link local IPv6 gateways
Thomas Thrainer [Mon, 25 Nov 2013 14:48:41 +0000 (15:48 +0100)]
Allow link local IPv6 gateways

Each host using IPv6 always has a link local address in fe80::/10. It is
common to use fe80::1 as default gateway to ease client configuration.
Ganeti prevented this usage, because it made sure that the IPv6 gateway
is in the IPv6 network the instance is connected to.

This patch also allows to specify a IPv6 gateway in the link local
network in addition to the network the instance is connected to.

This fixes issue 624.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoFix NODE/NODE_RES locking in LUInstanceCreate
Thomas Thrainer [Mon, 25 Nov 2013 10:37:06 +0000 (11:37 +0100)]
Fix NODE/NODE_RES locking in LUInstanceCreate

Both NODE and NODE_RES locks were acquired opportunistically if so
requested by the user. LUInstanceCreate requires, however, that the
actually locked elements on NODE and NODE_RES level are the same.

This patch changes the locking of NODE_RES such that those locks are not
acquired opportunistically any more. Instead, the mandatory locks are
set to the acquired NODE locks once they are actually granted.

This fixes issue 622.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

10 years agoeta-reduce isIpV6
Klaus Aehlig [Tue, 26 Nov 2013 19:45:39 +0000 (20:45 +0100)]
eta-reduce isIpV6

This is not only better style, but also fixes a lint error.
Also use the infix form of `elem` to increase readability.

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

10 years agoGaneti.Rpc: use brackets for ipv6 addresses
Guido Trotter [Tue, 26 Nov 2013 15:27:17 +0000 (16:27 +0100)]
Ganeti.Rpc: use brackets for ipv6 addresses

We detect an IPv6 vs V4 address based on columns, rather than passing
the family from the cluster object to be more future proof (in case
we'll ever support mixed clusters).

Unfortunately quite a bit more code is required to test this: we need an
arbitrary node that does the right thing w.r.t. ip addresses and also
test-only exports. As such we'll do this out of the stable branch.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

10 years agoUpdate NEWS file with socket permission fix info
Hrvoje Ribicic [Fri, 15 Nov 2013 16:39:56 +0000 (16:39 +0000)]
Update NEWS file with socket permission fix info

The NEWS file now contains a 2.8.3 entry, describing the fix of the
previous patch.

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

10 years agoFix socket permissions after master-failover
Hrvoje Ribicic [Fri, 15 Nov 2013 10:44:04 +0000 (10:44 +0000)]
Fix socket permissions after master-failover

When using gnt-cluster master-failover, on the soon-to-be-master the
luxi daemon is started by the node daemon. This makes the luxi
daemon inherit the node daemon's umask 077, making the communication
socket unreadable to group members. When using Ganeti with non-root
users, this causes problems, as reported in issue 477.

To fix this, the socket permissions are set explicitly.

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

10 years agoVersion bump for 2.8.2 v2.8.2
Michele Tartara [Wed, 6 Nov 2013 12:26:24 +0000 (12:26 +0000)]
Version bump for 2.8.2

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

10 years agoUpdate NEWS file for 2.8.2 release
Michele Tartara [Wed, 6 Nov 2013 12:25:16 +0000 (12:25 +0000)]
Update NEWS file for 2.8.2 release

Add a section in the file for the new upcoming release.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

10 years agoDRBD: ensure peers are UpToDate for dual-primary
Apollon Oikonomopoulos [Tue, 5 Nov 2013 14:30:45 +0000 (16:30 +0200)]
DRBD: ensure peers are UpToDate for dual-primary

DrbdAttachNet supports both, normal primary/secondary node operation, and
(during live migration) dual-primary operation. When resources are newly
attached, we poll until we find all of them in connected or syncing operation.

Although aggressive, this is enough for primary/secondary operation, because
the primary/secondary role is not changed from within DrbdAttachNet. However,
in the dual-primary ("multimaster") case, both peers are subsequently upgraded
to the primary role.  If - for unspecified reasons - both disks are not
UpToDate, then a resync may be triggered after both peers have switched to
primary, causing the resource to disconnect:

  kernel: [1465514.164009] block drbd2: I shall become SyncTarget, but I am
    primary!
  kernel: [1465514.171562] block drbd2: ASSERT( os.conn == C_WF_REPORT_PARAMS )
    in /build/linux-rrsxby/linux-3.2.51/drivers/block/drbd/drbd_receiver.c:3245

This seems to be extremely racey and is possibly triggered by some underlying
network issues (e.g. high latency), but it has been observed in the wild. By
logging the DRBD resource state in the old secondary, we managed to see a
resource getting promoted to primary while it was:

  WFSyncUUID Secondary/Primary Outdated/UpToDate

We fix this by explicitly waiting for "Connected" cstate and
"UpToDate/UpToDate" disks, as advised in [1]:

  "For this purpose and scenario,
   you only want to promote once you are Connected UpToDate/UpToDate."

[1] http://lists.linbit.com/pipermail/drbd-user/2013-July/020173.html

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

10 years agoImprove error message for replace-disks
Michele Tartara [Mon, 4 Nov 2013 15:20:07 +0000 (15:20 +0000)]
Improve error message for replace-disks

In some conditions, replace-disks will fail if the disks are not properly
activated. Improve the error message suggesting to run activate-disks before
executing replace-disks.

Fixes Issue 606.

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

10 years agoAdd all dependencies for confd as test dependencies
Klaus Aehlig [Wed, 30 Oct 2013 10:13:48 +0000 (11:13 +0100)]
Add all dependencies for confd as test dependencies

Since our tests pull in confd as a dependency, all build dependencies
for confd are also necessary to run the tests.

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

10 years agoAdd snap-server to the test-relevenat packages
Klaus Aehlig [Tue, 29 Oct 2013 15:09:14 +0000 (16:09 +0100)]
Add snap-server to the test-relevenat packages

While snap-server is only needed for the optional monitoring daemon,
some tests, notably those testing these optional features, still depend
on it. So, if snap-server is missing, the Haskell tests should not be
run, as they cannot even be build.

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