Add warning against hvparam changes with live migrations

Changing certain hvparams while an instance is running leads to a
dangerous situation for the instance. When the instance undergoes live
migration without having undergone a reboot that would have applied the
parameters, it is setup with the modified hvparams, and loaded with the
state relying on the old hvparams. Depending on what is used and how,
this might lead to a crash of the instance.

While a proper fix should go into a stable version of Ganeti as this is
not a trivial change, the least we can do is warn users that hvparam
changes may be dangerous.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Make userspace access checks properly strict

When a cluster- or group-level disk template access mode change is
specified, Ganeti makes sure that this change would not lead to an
invalid hypervisor/access mode combination on an existing instance.
This check was extended to non-RBD disk templates in patch 6488e5bc,
but was overly broad, targeting disk templates for which the
parameter was not set. This patch fixes the check.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix handling of the --online option

From the man page, the --online option is supposed to mark an
instance down only if it is already offline. Otherwise it should
fail. With this patch we avoid undesired transitions to ADMIN_down
state while the instance is already up and running.

Fix the corresponding QA test as well (TestInstanceModify).

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Fix NIC options in Xen's config files

Commit e32cc48 added wrongly an extra comma between mac and
type in NIC options. Fix this.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Gen nic_type related opts inside _WriteNicConfig()

The xen-hvm hypervisor has two extra hvparams concerning NICS;
nic_type, and vif_type. Let _WriteNicConfig() calculate all needed
extra options for the instance's NICs based on its hvparams.

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

It was decided that Ganeti is relicensed under the 2-clause
BSD license. Update the license statements accordingly (issue #936).

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  Update the license statement
  Fix handling of the --online option
  Add warning against hvparam changes with live migrations

Conflicts:
	lib/luxi.py
	src/Ganeti/Luxi.hs
	src/Ganeti/THH.hs
	test/py/ganeti.luxi_unittest.py
(all trivial)

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Change license statment in newly added files

It was decided to relicense Ganeti under terms of the 2-clause
BSD license (issue #936) from stable-2.10 onwards. So after merging
the corresponding changes from 2.10 to 2.11 change the license in
the files added in 2.11 as well.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
Merge branch 'stable-2.11' into stable-2.12

* stable-2.11
  Change license statment in newly added files

* stable-2.10
  Update the license statement
  Fix handling of the --online option
  Add warning against hvparam changes with live migrations

Conflicts:
	lib/backend.py
	lib/cli.py
	lib/client/gnt_cluster.py
	lib/client/gnt_group.py
	lib/client/gnt_instance.py
	lib/cmdlib/backup.py
	lib/cmdlib/cluster.py
	lib/cmdlib/common.py
	lib/cmdlib/group.py
	lib/cmdlib/instance.py
	lib/cmdlib/instance_operation.py
	lib/cmdlib/instance_storage.py
	lib/cmdlib/instance_utils.py
	lib/config.py
	lib/hypervisor/hv_kvm/__init__.py
	lib/objects.py
	lib/rpc/transport.py
	lib/rpc_defs.py
	lib/serializer.py
	lib/server/noded.py
	lib/utils/io.py
	src/AutoConf.hs.in
	src/Ganeti/Constants.hs
	src/Ganeti/Objects.hs
	src/Ganeti/OpCodes.hs
	src/Ganeti/OpParams.hs
	src/Ganeti/Path.hs
	src/Ganeti/Query/Server.hs
	src/Ganeti/Runtime.hs
	src/Ganeti/THH.hs
	src/Ganeti/Types.hs
	test/py/cmdlib/testsupport/lock_manager_mock.py
	tools/kvm-ifup.in
(all trivial)

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Adapt license statement

...also to the files added only in stable-2.12. See issue #936
for details.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
Design: Filtering: Fix typo RATELIMIT -> RATE_LIMIT

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Design: Filtering: Clarify when a filter rule applies

This makes the distinction between predicates *matching* and filter
rules *applying*.

Signed-off-by: Niklas Hambuechen <niklash@google.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
Merge branch 'stable-2.12' into master

* stable-2.12
  Adapt license statement
  Gen nic_type related opts inside _WriteNicConfig()
  Fix NIC options in Xen's config files

* stable-2.11
  Change license statment in newly added files
  Make userspace access checks properly strict

* stable-2.10
  Update the license statement
  Fix handling of the --online option
  Add warning against hvparam changes with live migrations

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>