ganeti-local
11 years agoMerge remote branch 'google/stable-2.6' into stable-2.6-ippool-hotplug-esi
Dimitris Aragiorgis [Wed, 12 Sep 2012 13:21:02 +0000 (16:21 +0300)]
Merge remote branch 'google/stable-2.6' into stable-2.6-ippool-hotplug-esi

Conflicts:
lib/rpc.py

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

11 years agorpc: Remove duplicated logic, fix unittests
Michael Hanselmann [Wed, 12 Sep 2012 12:41:24 +0000 (14:41 +0200)]
rpc: Remove duplicated logic, fix unittests

Commit 5fce6a89 changed RpcRunner._InstDict to add the disk parameters
on all encoded instances. It didn't remove a special case in
“_InstDictOspDp”. Update and fix unittests as well.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agoAnnotate disk params on instance_start
Constantinos Venetsanopoulos [Wed, 12 Sep 2012 11:27:16 +0000 (14:27 +0300)]
Annotate disk params on instance_start

We call _GatherAndLinkBlockDevs during the process, which in turn
calls _RecursiveFindBD. This needs disk parameters to work.

See also commit b8291e0.

This was reported by Ansgar and Damien.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agocmdlib: Handle locking.ALL_SET correctly when copying locks
Michael Hanselmann [Wed, 12 Sep 2012 10:38:03 +0000 (12:38 +0200)]
cmdlib: Handle locking.ALL_SET correctly when copying locks

When locks are copied “locking.ALL_SET” must be handled separately
(ALL_SET has the value None). Reported by Constantinos Venetsanopoulos
who saw failover for RDB-based instances not working.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

11 years agoFix bug in non-mirrored instance allocation
Iustin Pop [Thu, 6 Sep 2012 16:08:43 +0000 (01:08 +0900)]
Fix bug in non-mirrored instance allocation

The function `allocateOnSingle' has a bug in the calculation of the
cluster score used for deciding which of the many target nodes to use
in placing the instance: it uses the original node list for the score
calculation.

Due to this, since the original node list is the same for all target
nodes, it means that basically `allocateOnSingle' returns the same
score, no matter the target node, and hence the choosing of the node
is arbitrary, instead of being done on the basis of the algorithm.

This has gone uncaught until reported because the unittests only test
1 allocation at a time on an empty cluster, and do not check the
consistency of the score. I'll send separate patches on the master
branch for adding more checks to prevent this in the future.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

11 years agoDo not allow networks with less than 8 hosts
Dimitris Aragriorgs [Wed, 5 Sep 2012 17:02:50 +0000 (20:02 +0300)]
Do not allow networks with less than 8 hosts

This is only needed in case base64 and bitarray.tostring() is used for
saving reservations. If bitarray.to01() was used then we would not have
this restriction.

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

11 years agoFix gnt-debug iallocator
René Nussbaumer [Tue, 28 Aug 2012 11:14:58 +0000 (13:14 +0200)]
Fix gnt-debug iallocator

There was an issue with the recent ipolicy introduction which lead to a
bug in gnt-debug iallocator. It was not providing the spindle_use field
and therefore it wont let you create a valid iallocator request.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoFix warnings/errors with newer pylint
Iustin Pop [Tue, 28 Aug 2012 23:12:19 +0000 (01:12 +0200)]
Fix warnings/errors with newer pylint

To help developing Ganeti on newer distributions, let's try to fix
pylint warnings/errors. I'm using pylint from current Debian wheezy:
pylint 0.25.1, astng 0.23.1, common 0.58.0, and we have 3 things that
needs fixing.

First, a really wide "except", with the silencing in the wrong
place. I'm not sure why this doesn't have "except Exception", so let's
add it. However, pylint still complains about "Catching too general
exception", even though we do want to catch both system and our
exception, so let's add a silence for W0703. It's true that we
shouldn't catch KeyboardInterrupt and friends, but that should be
cleaned up on the master branch.

Second, pylint complains about "redefining name builtin tuple",
because we do some pattern matching in the except blocks in
netutils. This seems to be a false positive, but let's clean the code
around this.

And finally, type inference again goes bad, so let's silence E1103
with its "boolean doesn't have 'get' method".

After this, I can run "make lint", and by extension "make
commit-check" on Debian Wheezy, yay! We might be able to bump our
required pylint versions to something not ancient…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoFix decorator uses which crash newer pylint
Iustin Pop [Tue, 28 Aug 2012 22:59:00 +0000 (00:59 +0200)]
Fix decorator uses which crash newer pylint

Pylint version:

  pylint 0.25.1,
  astng 0.23.1, common 0.58.0

crashes when passing the fully-qualified decorator name with:

  File "/usr/lib/pymodules/python2.7/pylint/checkers/base.py", line 161, in visit_function
    if not redefined_by_decorator(node):
  File "/usr/lib/pymodules/python2.7/pylint/checkers/base.py", line 116, in redefined_by_decorator
    decorator.expr.name == node.name):
AttributeError: 'Getattr' object has no attribute 'name'

I found out that simply using a shortened name will 'fix' this issue,
so let's do this to allow running newer pylint versions.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

11 years agoRefactor _GetPCIInfo() in cmdlib v2.6.0+ippool7+hotplug2+extstorage2 v2.6.0+ippool7+nichotplug3+extstorage2
Dimitris Aragriorgs [Thu, 30 Aug 2012 19:31:37 +0000 (22:31 +0300)]
Refactor _GetPCIInfo() in cmdlib

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

11 years agoAdd logging in case of hotplug
Dimitris Aragriorgs [Thu, 30 Aug 2012 18:43:48 +0000 (21:43 +0300)]
Add logging in case of hotplug

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

11 years agoMaintain backwards compatibility in kvm runtime
Dimitris Aragriorgs [Thu, 30 Aug 2012 17:40:25 +0000 (20:40 +0300)]
Maintain backwards compatibility in kvm runtime

Introduce _GenerateKVMBlockDevicesOptions()

In case hotplug is enabled per instance then the runtime file
contains one more field: block_devices. In this case kvm_cmd
is extended with block device options during _ExecuteKVMRuntime().

If no hotplug is enabled then runtime file has block_devices info
encapsulated in kvm_cmd and block device options are exteded
during _GenerateKVMRuntime.

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

11 years agoMake stable-2.6 compatible with newer pep8
Iustin Pop [Mon, 27 Aug 2012 13:45:24 +0000 (15:45 +0200)]
Make stable-2.6 compatible with newer pep8

This is done so that all current branches can run with newer pep8;
note that instead of fixing the problems (like I did on master), I've
just silenced more. These should *not* be merged onto master!

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

11 years agocfupgrade for removing oldstyle hotplug info
Dimitris Aragiorgis [Sat, 11 Aug 2012 09:21:50 +0000 (12:21 +0300)]
cfupgrade for removing oldstyle hotplug info

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

11 years agoUse base64 format in network reservations slots
Dimitris Aragiorgis [Thu, 9 Aug 2012 13:10:52 +0000 (16:10 +0300)]
Use base64 format in network reservations slots

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

11 years agoMerge branch 'stable-esi'
Dimitris Aragiorgis [Wed, 22 Aug 2012 15:08:10 +0000 (18:08 +0300)]
Merge branch 'stable-esi'

Conflicts:
Makefile.am
lib/cli.py
lib/client/gnt_instance.py
lib/cmdlib.py
lib/constants.py
lib/opcodes.py

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

11 years agoAdd external storage interface related man pages
Constantinos Venetsanopoulos [Fri, 30 Mar 2012 08:41:37 +0000 (11:41 +0300)]
Add external storage interface related man pages

 * ganeti-extstorage-interface man page
 * gnt-storage man page

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoInitial ExtStorage support in htools
Constantinos Venetsanopoulos [Thu, 26 Jul 2012 13:41:08 +0000 (16:41 +0300)]
Initial ExtStorage support in htools

11 years agoAdd the gnt-storage client
Constantinos Venetsanopoulos [Wed, 28 Mar 2012 09:32:56 +0000 (12:32 +0300)]
Add the gnt-storage client

Add a new client called 'gnt-storage'.
The client interacts with the ExtStorage interface, similarly to
the way gnt-os interacts with the OS interface.

For now, only two commands are supported: 'info' and 'diagnose'.

'diagnose' calculates the node status of each provider on each node,
similarly to gnt-os diagnose. Furthermore, for every provider, it
calculates it's nodegroup validity for each nodegroup. This is done
inside the LU and not the client (marked as 'TODO' for the  global
validity of gnt-os diagnose).

In the future, gnt-storage can be used to manage storage pools,
or even be extended to diagnose other storage types supported by
Ganeti, such as lvm, drbd (INT_MIRROR) or rbd (EXT_MIRROR).

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoAdd --allow-arbit-params to gnt-instance modify
Constantinos Venetsanopoulos [Fri, 20 Jul 2012 15:38:10 +0000 (18:38 +0300)]
Add --allow-arbit-params to gnt-instance modify

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoMultiple ExtStorage Providers and ext-params
Constantinos Venetsanopoulos [Wed, 28 Mar 2012 09:29:22 +0000 (12:29 +0300)]
Multiple ExtStorage Providers and ext-params

Add support for passing parameters to the ext template (ext-params).
Take advantage of disk-params, that don't seem to make much sense in
this template (ExtStorage Providers are not predefined and we don't
know their needs) and use them to pass the ext-params dynamically to
the template.

ext-params are correlated with gnt-os-interface's os-params.
All ext-params are exported to the ExtStorage Provider through it's
environment, with variables prefixed with 'EXTP_' (similarly to the
OS interface's 'OSP_' params).

ext-params are passed through the --disk option. If the disk template
is of type `ext' during instance add, then any additional options that
are not in IDISK_PARAMS given to --disk are considered ext-params
e.g.:

 gnt-instance add -t ext --disk=0:size=2G,param1=value1,param2=value2

Finally, we introduce a new IDISK_PARAM called IDISK_PROVIDER, that is
mandatory for template `ext' and is used to select the desired
ExtStorage Provider. This parameter is not valid for other template
types.

The IDISK_PROVIDER parameter becomes the first element of the
disk's unique_id tuple e.g.:

 unique_id = ('sample_provider1', 'UUID.ext.diskX')

Example selecting different ExtStorage Providers for each disk and
passing different ext-params to them:

 -t ext --disk=0:size=2G,provider=sample_provider1,param1=value1
        --disk=1:size=3G,provider=sample_provider2,param2=value2

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoImplement the External Storage Interface
Constantinos Venetsanopoulos [Mon, 12 Mar 2012 15:49:18 +0000 (17:49 +0200)]
Implement the External Storage Interface

With this commit we introduce the External Storage Interface
to Ganeti, abbreviated: ExtStorage Interface.

The ExtStorage Interface provides Ganeti with the ability to interact
with externally connected shared storage pools, visible by all
VM-capable nodes. This means that Ganeti is able to handle VM disks
that reside inside a NAS/SAN or any distributed block storage provider.

The ExtStorage Interface provides a clear API, heavily inspired by the
gnt-os-interface API, that can be used by storage vendors or sysadmins
to write simple ExtStorage Providers (correlated to gnt-os-interface's
OS Definitions). Those Providers will glue externally attached shared
storage with Ganeti, without the need of preprovisioned block devices
on Ganeti VM-capable nodes as confined be the current `blockdev' disk
template.

To do so, we implement a new disk template called `ext' (of type
DTS_EXT_MIRROR) that passes control to externally provided scripts
(the ExtStorage Provider) for the template's basic functions:

 create / attach / detach / remove / grow

The scripts reside under ES_SEARCH_PATH (correlated to OS_SEARCH_PATH)
and only one ExtStorage Provider is supported called `ext'.

The disk's logical id is the tuple ('ext', UUID.ext.diskX), where UUID
is generated as in disk template `plain' and X is the disk's index.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoUpdate the shared storage design document
Constantinos Venetsanopoulos [Mon, 2 Apr 2012 17:05:51 +0000 (20:05 +0300)]
Update the shared storage design document

Update the shared storage design document to reflect the current
changes, after the implementation of the ExtStorage interface.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>

11 years agoMerge branch 'stable-hotplug'
Dimitris Aragiorgis [Wed, 22 Aug 2012 14:22:14 +0000 (17:22 +0300)]
Merge branch 'stable-hotplug'

Conflicts:
lib/cli.py
lib/client/gnt_instance.py
lib/cmdlib.py
lib/objects.py
lib/opcodes.py
lib/rpc.py

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

11 years agoHotplug: client support
Dimitris Aragiorgis [Thu, 9 Aug 2012 11:04:10 +0000 (14:04 +0300)]
Hotplug: client support

Add --hotplug option.
Only used by OpInstanceCreate()/OpInstanceSetParams.

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

11 years agoHotplug: cmdlib support
Dimitris Aragiorgis [Thu, 9 Aug 2012 11:00:13 +0000 (14:00 +0300)]
Hotplug: cmdlib support

Hotplugging is done by functions invoked by ApplyContainerMods().  In
order hotplugging to take place a --hotplug option must be passed.
Hotplug can enabled for a VM if --hotplug is passed during
gnt-instance add (hotplug_info will be added).

In order initial devices of a VM to be hotpluggable hotplug_info must be
early available. So _GetPCIInfo() gets either lu.hotplug_info in case of
LUInstanceCreate() or invokes lu.cfg.GetPCIInfo() in case of
LUInstanceSetParams(). To return a pci slot into the pool
lu.cfg.UpdatePCIInfo() must be invoked.

If no --hotplug is passed during gnt-instance modify --net add the nic
won't get a pci value and will be placed automaticaly in a free pci slot
after reboot. This means that is not going to be hotpluggable for the
rest of the instance's life.

To keep pci pool consistent we do not let a device that has been
hotplugged (i.e. has pci value) to be removed without --hotplug.

Before hotplugging a Disk it must be assembled. During
LuInstanceSetParams() newly created disks are not added to the instance
so _ExpandCheckDisks() in _AssembleInstanceDisks() will fail. So we make
this check optional only for this case.

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

Everything else is just like nic hotplugging.

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

11 years agoHoplug: rpc support
Dimitris Aragiorgis [Thu, 9 Aug 2012 10:59:11 +0000 (13:59 +0300)]
Hoplug: rpc support

Introduce new RPCs that eventually invoke hypervisor specific
hotplug functions.

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

11 years agoHotplug: KVM support
Dimitris Aragiorgis [Thu, 9 Aug 2012 10:55:01 +0000 (13:55 +0300)]
Hotplug: KVM support

KVM >= 1.0 is needed.

Introduce new methods: HotAddNic/HotDelNic

Both qemu monitor interface for hotplugging. If a device has
hotplug info (idx, pci) then:
 - it gets named after it (e.g. virtio-net-pci.%d % idx ).
 - it gets placed to the pci slot (hex(pci)) of bus 0.
If no hotplug info exist or kvm version is old then no hotplug takes
place and modifications will take place after reboot:
 - devices will get traditionaly named
 - and placed automaticaly in empty pci slots

NIC hotplug:
 - open a tap and get its file descriptor.
 - pass fd with SCM rights (using python-fdsend) via monitor socket
 - create netdev and device with proper qemu interface

Disk hotplug:
 - create drive with drive%d % idx name
 - create device virtio-blk-pci.%d % idx

In order to migrate a VM that has devices hotplugged, an identical
VM should be booted with -incoming. To this end every time a hotplug
takes place runtime file must be updated.

For disk hotplug support we removeds disk from kvm_cmd in
runtime file add added them separately just like nics. So code building
disk related options has been moved out from _GenerateKVMRuntime()
and added to _ExecuteKVMRuntime().

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

11 years agoHoplug: objects modifications/additions
Dimitris Aragiorgis [Thu, 9 Aug 2012 10:54:18 +0000 (13:54 +0300)]
Hoplug: objects modifications/additions

Introduce new HotplugInfo object as part of Instance object.

hotplug_info { 'nics': 0, 'disks': 0, 'pci_pool': [16, 17, 18] }

nics/disks is an index used for device identification and naming.
Everytime a new device (disk/nic) is hotadded these values get incremented.

pci_pool is a list of pci slots where a device can be placed. Every
time a device gets hot-plugged/unplugged a pci slot gets popped/appended.

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

11 years agoAdd tags in network objects
Dimitris Aragiorgis [Fri, 27 Jul 2012 07:50:04 +0000 (10:50 +0300)]
Add tags in network objects

Support:
 - gnt-network add --tags.
 - gnt-network list-tags/add-tags/remove-tags/.
 - gnt-network list -o +tags

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

11 years agoChange default fields for network listing
Dimitris Aragiorgis [Mon, 18 Jun 2012 16:05:28 +0000 (19:05 +0300)]
Change default fields for network listing

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

11 years agoPass detailed network info in hooks
Dimitris Aragiorgis [Thu, 7 Jun 2012 15:51:34 +0000 (18:51 +0300)]
Pass detailed network info in hooks

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

11 years agoPass netinfo in rpcs
Dimitris Aragiorgis [Wed, 6 Jun 2012 12:57:37 +0000 (15:57 +0300)]
Pass netinfo in rpcs

If a nic has a network field then encapsulate a network object in
netinfo slot for every rpc. This is needed to pass network info to
scripts managing nics (kvm-vif-bridge).

Introduce _BuildNetworkEnv()

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

11 years agocfgupgrade for networks
Dimitris Aragiorgis [Tue, 5 Jun 2012 23:08:11 +0000 (02:08 +0300)]
cfgupgrade for networks

Add networks slot in config data.
Add networks slot in nodegroups.

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

11 years agoUse network's mac prefix
Dimitris Aragiorgis [Tue, 5 Jun 2012 23:03:08 +0000 (02:03 +0300)]
Use network's mac prefix

Modify existing GenerateMAC so that it takes network as an argument.

Substitute _GenerateOneMAC with a decorator _GenerateMACPrefix
that chooses the prefix (network's or cluster's) and wraps
_GenerateMACSuffix that generates the three remaining bytes.

Check mac prefix validity when adding/modifing a network.

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

11 years agoInclude networks in Makefile and bash completion
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:52:31 +0000 (23:52 +0300)]
Include networks in Makefile and bash completion

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

11 years agoAdd gnt-network man page
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:51:44 +0000 (23:51 +0300)]
Add gnt-network man page

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

11 years agoRapi support for networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:20:09 +0000 (23:20 +0300)]
Rapi support for networks

Support:
 - GetNetwork(s)
 - CreateNetwork
 - ConnectNetwork
 - DisconnectNetwork
 - RemoveNetwork

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

11 years agoss_conf support for networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:15:42 +0000 (23:15 +0300)]
ss_conf support for networks

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

11 years agoIntroduce client support for networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:09:27 +0000 (23:09 +0300)]
Introduce client support for networks

gnt-network is used to manipulate and handle networks that
currently provides the following operations:

 * Add a new network:
   gnt-network add --network=1.2.3.0/28 --gateway=1.2.3.1
                   --add-reserved-ips=1.2.3.4,1.2.3.5 testnet

 * Remove an existing network:
   gnt-network remove testnet

 * Modify an existing network:
   gnt-network modify --gateway=1.2.3.6
                      --network-type=private
                      --network6=2001:648::/64
                      --gateway6=none testnet
                      --add-reserved-ips=1.2.3.10,1.2.3.10,
                      --remove-reserved-ips=1.2.3.20
                      testnet

 * Connect an existing network to a nodegroup:
   gnt-network connect testnet default bridged br100
   gnt-network connect testnet <nodegroup> <mode> <link>
   (pass all for <nodegroup> to connect to all nodegroups)

 * Disconnect an existing network from a nodegroup:
   gnt-network disconnect testnet <nodegroup>
   (pass all for <nodegroup> to disconnect from all nodegroups)

 * List available networks:
   gnt-network list

 * Show network info:
   gnt-network info [testnet]

Introduce new option NOCONFLICTSCHECK_OPT for not checking for
conflicting IPs. Using this might cause data inconsistency.

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

11 years agoModify instance client to support networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 20:03:44 +0000 (23:03 +0300)]
Modify instance client to support networks

Add --no-conflicts-check option.
Modify instance query methods to return nic's network info.

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

11 years agoPeripheral changes for networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 19:58:12 +0000 (22:58 +0300)]
Peripheral changes for networks

Specifically:
 * export a new environment variable for the gnt-os-interface
 * export a new environment variable for KVM specific scripts
 * ovf support for networks

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

11 years agoModify LUInstanceSetParams() to support networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 19:39:53 +0000 (22:39 +0300)]
Modify LUInstanceSetParams() to support networks

Keep backwards compatibility just like LUInstanceCreate() and
support network parameter for NIC object.

Add ec_id argument in Update() to be able to commit temporary
IPs that were previously reserved.

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

11 years agoModify RemoveInstance() to support networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 19:37:12 +0000 (22:37 +0300)]
Modify RemoveInstance() to support networks

Release any IPs held the instance before actually removing.

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

11 years agoModify LUInstanceCreate to support networks
Dimitris Aragiorgis [Mon, 4 Jun 2012 19:31:30 +0000 (22:31 +0300)]
Modify LUInstanceCreate to support networks

Implement backend support, to export the IP pool management
functionality to the clients. When the new NIC parameter 'network'
is given, the ippool management system is triggered.
If a NIC belongs to a network, it inherits the netparams
(mode, link) as its nicparams. If a network is requested, then
no 'mode' or 'link' should be specified. Backwards compatibility
is preserved, if 'network' parameter is omitted.

Examples for IP pool management system:

--net 0:network=net1
  for an IPless NIC in a network

--net 0:ip=pool,network=net1
  for automatically generated IP inside the network

--net 0:ip=1.2.3.4,network=net1
  for specific IP inside the network

--net 0:network=none
  for IPless NIC with default nicparams

Examples for traditional assignment:

--net 0:ip=1.2.3.4,link=br100,mode=bridged
--net 0:ip=none,link=rt2,mode=routed
--net 0

Check for conflicting IPs to ensure IP uniqueness inside nodegroups.

IAllocator should be extended to become network aware. If an instance
has a NIC inside a network, then IAllocator must pick a node that its
nodegroup is already connected with that network.

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

11 years agoConfig methods for reserving/releasing IPs
Dimitris Aragiorgis [Mon, 4 Jun 2012 19:24:47 +0000 (22:24 +0300)]
Config methods for reserving/releasing IPs

Use TemporaryReservationManager for IP handling to ensure
config data consistency.

Implement:
 - methods for reserving/releasing IPs
 - _UnlockedCommitTemporaryIps()
 - CheckIPInNodeGroup() used for conflicting IPs
 - GetGroupNetParams() used for inheriting netparams.

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

11 years agoImplement network/nodegroup mappings
Dimitris Aragiorgis [Mon, 4 Jun 2012 18:08:36 +0000 (21:08 +0300)]
Implement network/nodegroup mappings

LUNetworkConnect() connects a network to a nodegroup and defines
its netparams (mode and link). Specifically:
 * Check if network already exists
 * Check if netparams are valid
 * Check if already connected to the same nodegroup
 * Produce errors if any conflicting IPs found
 * Update the 'networks' slot in NodeGroup config object
   with the network UUID and netparams requested. E.g.
   nodegroup_uuid {
     networks {
       network_uuid: {mode: 'bridged', link: 'br100'}
     }
   }

LUNetworkDisconnect() unmaps a network from a nodegroup:
 * Produce errors if an instance has a NIC with IP inside the network
 * Remove corresponding entry in 'networks' slot of NodeGroup object

Check for conflicting ips can be avoided with corresponding option.

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

11 years agoImplement LUNetworkSetParams
Dimitris Aragiorgis [Mon, 4 Jun 2012 18:05:03 +0000 (21:05 +0300)]
Implement LUNetworkSetParams

Support modifying all network parameters except for network (ip range)
Cannot modify gateway and reserved ips at the same time.

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

11 years agoImplement LUNetworkQuery
Dimitris Aragiorgis [Mon, 4 Jun 2012 18:02:55 +0000 (21:02 +0300)]
Implement LUNetworkQuery

Summarily list all existing networks
Supply detailed info for every existing network
 - List used/free IPs
 - List instances with NICs assigned to the corresponding network
 - List NIC index and IP for the above instances

Implement complementary config methods for retrieving networks.

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

11 years agoBasic IP pool management logic
Dimitris Aragiorgis [Mon, 4 Jun 2012 15:54:02 +0000 (18:54 +0300)]
Basic IP pool management logic

Implement LUs for corresponding opcodes:
 * LUNetworkAdd:
   - Check for IP validity
   - Reserves all necessary IPs
   - Create new Network config object
 * LUNetworkRemove:
   - Checks if connected to any nodegroup
   - Remove a Network config object

Implement basic config methods:
 * LookupNetwork()
   - Given the network name return the network UUID
 * AddNetwork()
   - Add a new network to the config
 * RemoveNetwork()
   - Remove a network from the config

Add new locking level: LEVEL_NETWORK

Add various useful config methods for retrieving network info.

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

11 years agoIntroduce new module for IP pool management
Dimitris Aragiorgis [Mon, 4 Jun 2012 14:33:22 +0000 (17:33 +0300)]
Introduce new module for IP pool management

Add new library module lib/network.py.
Introduce new class: AddressPool.

AddressPool implements all operations needed for managing IPs
inside the IP pool.

Given a Network config object (nobj), the class:

 * initializes the corresponding IP pool object via
   network.AddressPool.InitializeNetwork(nobj)
 * obtains the corresponding IP pool object via
   network.AddressPool(nobj)
 * manipulates IPs inside the pool

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

11 years agoIP pool related objects, opcodes and constants
Dimitris Aragiorgis [Mon, 4 Jun 2012 13:50:42 +0000 (16:50 +0300)]
IP pool related objects, opcodes and constants

Config objects:
 * Introduce L{Network} with
  - IPv4 network field (mandatory)
  - IPv4 gateway, IPv6 (network/gateway), mac prefix, type (optional)
 * Modify existing config objects to support networks:
  - Add new slot 'network' to L{NIC} config object
  - Add new slot 'networks' to L{NodeGroup} config object

Opcodes:
 * Introduce new opcodes for networks
  - add/remove/modify/query/connect/disconnect.
 * In InstanceCreate/InstanceSetParams add conflicts_check option

Constants:
 * INIC_PARAM 'INIC_NETWORK'
 * NIC_IP_POOL for automaticaly obtain an IP from a pool
 * NETWORK_TYPE_PUBLIC/PRIVATE for network types

Checking of network_type handled by the opcode parameter validation.
Introduce _CheckCIDR*Notation() functions for network parameters validation.

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

11 years agoFix computation of disk sizes in _ComputeDiskSize
Constantinos Venetsanopoulos [Wed, 22 Aug 2012 11:16:48 +0000 (14:16 +0300)]
Fix computation of disk sizes in _ComputeDiskSize

Currently, hail fails with FailDisk when trying to add an instance
of type: 'file', 'sharedfile' and 'rbd'.

This is due to a "0" or None value in the corresponding dict inside
_ComputeDiskSize, which results in a "O" or non Int value of the
exported 'disk_space_total' parameter. This in turn makes hail fail,
when trying to process the value:

 - with "Unable to read Int" if value is None (file)
 - with FailDisk if value is 0 (sharedfile, rbd)

The latter happens because the 0 value doesn't match the instance's
IPolicy, since it is lower than the minimum disk size.

The second problem still exists when using adoption with 'plain'
and 'blockdev' template and will be addressed in another commit.

Signed-off-by: Constantinos Venetsanopoulos <cven@grnet.gr>
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

11 years agoAdd verification of RPC results in _WipeDisks
Iustin Pop [Wed, 15 Aug 2012 09:46:30 +0000 (11:46 +0200)]
Add verification of RPC results in _WipeDisks

Due to an oversight, the pause/resume sync RPC calls in _WipeDisks
lack the verification of the overall RPC status, and directly iterate
over the payload. The code actually doing the wipe does verify
correctly the results. This can result in jobs failing with a hard to
diagnose:

OpExecError ['NoneType' object is not iterable]

instead of proper "RPC failed" message.

This patch adds a hard check on the pause call, but for the resume
call it just logs a warning if the RPC failed; the rationale being
that if we can't contact the node for pausing the sync, it's likely
wiping will fail too, but after the wipe has been done, we can
continue.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd test for checking that all gnt-* subcommands run OK
Iustin Pop [Fri, 10 Aug 2012 09:49:09 +0000 (11:49 +0200)]
Add test for checking that all gnt-* subcommands run OK

This is a bit of a shell munging trickery, but works for now. Making
it more generic can be done later.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoFix double use of PRIORITY_OPT in gnt-node migrate
Iustin Pop [Fri, 10 Aug 2012 09:38:12 +0000 (11:38 +0200)]
Fix double use of PRIORITY_OPT in gnt-node migrate

This breaks the command, as optparse considers that an error.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd new Makefile target to rebuild the whole dist
René Nussbaumer [Wed, 8 Aug 2012 14:43:13 +0000 (16:43 +0200)]
Add new Makefile target to rebuild the whole dist

Due to the fact how the automake system works it doesn't rebuild already
prebuild files in distcheck. This lead to a bug, where a rebuild of the
documentation was failing because we missed the fact that the files were
missing from the archive.

By adding distrebuildcheck we workaround that issue by running a
maintainer-clean which also removes prebuild files.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd missing rst files to Makefile.am
René Nussbaumer [Tue, 7 Aug 2012 13:40:59 +0000 (15:40 +0200)]
Add missing rst files to Makefile.am

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoRelease version 2.6.0 (final) v2.6.0
Iustin Pop [Fri, 27 Jul 2012 10:59:54 +0000 (12:59 +0200)]
Release version 2.6.0 (final)

Phew, it wasn't easy, but…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

12 years agoFix 'explicitely' common typo
Iustin Pop [Thu, 26 Jul 2012 19:53:26 +0000 (21:53 +0200)]
Fix 'explicitely' common typo

It seems that 'explicitely' is wrong, and that the right form is
'explicitly'. This is just fixing the typo plus adjusting affected
paragraphs.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoFix issue in LUClusterVerifyGroup with multi-group clusters
Iustin Pop [Thu, 26 Jul 2012 14:43:18 +0000 (16:43 +0200)]
Fix issue in LUClusterVerifyGroup with multi-group clusters

In case LUClusterVerifyGroup is run on a group which doesn't contain
the master node, the following could happen:

- master node is selected due to the explicit check
- if the order of nodes in the 'absent_nodes' list is such that the
  master node is the first in it, then we'll select (again) the master
  node
- passing duplicate nodes to RPC calls will break due to RPC
  internals; this should be fixed separately, but in the meantime we
  just refrain from passing such duplicates

This patch should not change the semantics of the code, since it
wasn't guaranteed even before that we find a vm_capable node.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

12 years agoAdd QA test for node group modification of ndparams
Iustin Pop [Thu, 26 Jul 2012 11:24:58 +0000 (13:24 +0200)]
Add QA test for node group modification of ndparams

Additionally, we run hbal if the htools tests are enabled (new
key). Note that hbal will directly exit, since there are no instances,
but at least it will load and parse the group details.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoFix node group modification of node parameters
Iustin Pop [Thu, 26 Jul 2012 11:17:41 +0000 (13:17 +0200)]
Fix node group modification of node parameters

Commit 904b3bfe tried to fix the deletion of custom ndparams from
group, but instead broke both modification and deletion: because we
run ForceDictType on self.op.ndparams instead of the updated
new_ndparams, we can neither delete nor set properly spindle_count
(since it won't be coerced to int).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoMerge commit 'v2.5.2' into stable-2.6
Iustin Pop [Tue, 24 Jul 2012 16:44:59 +0000 (18:44 +0200)]
Merge commit 'v2.5.2' into stable-2.6

* commit 'v2.5.2':
  Fix RST formatting in NEWS file
  Update NEWS and bump version for release 2.5.2
  Fix boot=on flag for CDROMs
  KVM: only pass boot flag once

Conflicts:
        NEWS         (trivial, merged the entries)
        configure.ac (trivial, kept ours)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>

12 years agoFix RST formatting in NEWS file v2.5.2
Iustin Pop [Tue, 24 Jul 2012 16:02:33 +0000 (18:02 +0200)]
Fix RST formatting in NEWS file

*FileID is interpreted as a start-of-bold, without corresponding end
marker. Sorry for not catching it in the first place.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>

12 years agoUpdate NEWS and bump version for release 2.5.2
Iustin Pop [Tue, 24 Jul 2012 15:52:23 +0000 (17:52 +0200)]
Update NEWS and bump version for release 2.5.2

This is a trivial release, with just bug fixes, so a small change log.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoFix boot=on flag for CDROMs
Iustin Pop [Mon, 23 Jul 2012 12:46:08 +0000 (14:46 +0200)]
Fix boot=on flag for CDROMs

This generalises commit 4304964a to cdroms too, since they have
somewhat the same logic. We just abstract the needs_boot_flag into a
separate variable, and then reuse it in the cdrom section.

Note that the logic of what 'if=' type to pass to KVM was very
convoluted, and (I think) incorrect; I went and cleaned it to be more
consistent.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoKVM: only pass boot flag once
Iustin Pop [Mon, 23 Jul 2012 11:56:09 +0000 (13:56 +0200)]
KVM: only pass boot flag once

This addresses issue 230: passing two methods of booting to KVM can,
depending on the KVM version, confuse it.

Note that commit 4304964a introduced a partial fix for this (but only
for disks, and keyed on KVM versions). However, it didn't fix cdrom
booting, which still fails with the same error, so let's fix it more
generically; we still leave the per-disk check since that is about
-boot c versus -drive …,boot=on rather than two boot methods.

Patch is based on the one submitted by Vladimir Mencl, many thanks!

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoEnsure a stable content of the bash completion file
Iustin Pop [Fri, 20 Jul 2012 20:14:40 +0000 (22:14 +0200)]
Ensure a stable content of the bash completion file

Currently, the order of commands in the bash completion file is
random, because the sub-commands are not sorted. This makes it harder
to investigate the differences in packaged Ganeti or in installed
Ganeti, since chunks in this file will have a random order.

To fix this, we sort the subcommands based on the first subcommand in
a given group ('first' also in sorted order); this results in a stable
contents of file, as tested by building it many times and checking for
differences.

The patch also does a few other minor changes to the file
(e.g. updating copyright years, etc.).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

12 years agoRelease Ganeti 2.6.0 rc4 v2.6.0rc4
René Nussbaumer [Thu, 19 Jul 2012 12:21:53 +0000 (14:21 +0200)]
Release Ganeti 2.6.0 rc4

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoPrepare NEWS for Ganeti 2.6.0rc4
René Nussbaumer [Thu, 19 Jul 2012 11:56:59 +0000 (13:56 +0200)]
Prepare NEWS for Ganeti 2.6.0rc4

Another release candidate is coming.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd some rudimentary node group ipolicy checks
René Nussbaumer [Thu, 19 Jul 2012 08:40:46 +0000 (10:40 +0200)]
Add some rudimentary node group ipolicy checks

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix setting ipolicy on node groups
René Nussbaumer [Thu, 19 Jul 2012 08:26:13 +0000 (10:26 +0200)]
Fix setting ipolicy on node groups

On node groups we don't have the std field. However, the InstancePolicy
object always verifies that the std value is within a given range. As we
fill it up with defaults if not set (as it happens to be on node groups)
and the min value is higher than the default std value (taken from
constants.py) we fail.

We overcome this situation by simply let the function know if we want to
verify the std value at all. If we don't want to verify std, we just set
it to a compliant value (min_v) and continue.

We also slightly adapt the error message provided, as we don't have std
values on groups.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix --no-headers for the new list-drbd command
Iustin Pop [Thu, 19 Jul 2012 08:31:52 +0000 (10:31 +0200)]
Fix --no-headers for the new list-drbd command

Sorry, I forgot that with GenerateTable this needs to be handled
manually. Fixed now and tested in both ways.

(But to be honest, this should be abstracted in GenerateTable, instead
of the 'if' test in all its callers.)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd a simple QA test for gnt-node list-drbd
Iustin Pop [Wed, 18 Jul 2012 11:07:08 +0000 (13:07 +0200)]
Add a simple QA test for gnt-node list-drbd

This will be run only if 'haskell-confd' QA configuration has been
enabled.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoAdd a new gnt-node command list-drbd
Iustin Pop [Wed, 18 Jul 2012 09:44:48 +0000 (11:44 +0200)]
Add a new gnt-node command list-drbd

This uses confd to query the DRBD minors, which is very special; no
other command currently does so.

Since the backend is only implemented in the Haskell version of confd,
we have checks that 1) confd is enable, and 2) hs confd is also
enabled. If by mistake people do manage to query Python confd, the
error message will be clean:

  Query gave non-ok status '2': not implemented

So nothing breaks in an "ugly" way.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoImplement a node to drbd minors query function
Iustin Pop [Wed, 18 Jul 2012 09:35:05 +0000 (11:35 +0200)]
Implement a node to drbd minors query function

This can be queried remotely since it's a pure configuration query.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd a new unused confd query
Iustin Pop [Mon, 16 Jul 2012 13:49:04 +0000 (15:49 +0200)]
Add a new unused confd query

This is not implemented currently.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd support for computing instance all/secondary nodes
Iustin Pop [Mon, 16 Jul 2012 12:59:40 +0000 (14:59 +0200)]
Add support for computing instance all/secondary nodes

This fixes an old FIXME. Since we now how actual DRBD configuration
data, we can finally compute the instance's secondary nodes.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAdd disk logical ID support in Objects.hs
Iustin Pop [Mon, 16 Jul 2012 12:11:03 +0000 (14:11 +0200)]
Add disk logical ID support in Objects.hs

This is a complex field, so we have to do a lot of manual work for now.

The complexity arises from the fact that the contents of the field,
and the way to parse it, depends on the disk type field, so we don't
have a single, static way of parsing it. Hence we needed the
extensions to the Template Haskell code.

Since we now can both load and save the disk type, we can remove the
in-memory (duplicate) disk type from the disk objects, relying only on
the logical ID to hold the type information.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoFix a docstring in bdev's DRBD8 class
Iustin Pop [Mon, 16 Jul 2012 11:51:20 +0000 (13:51 +0200)]
Fix a docstring in bdev's DRBD8 class

It seems this was not updated since the move to static minors…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoExtend the Template Haskell loadFn model
Iustin Pop [Mon, 16 Jul 2012 11:37:09 +0000 (13:37 +0200)]
Extend the Template Haskell loadFn model

Currently, we only allow field-by-field de-serialisation. Since we
have cases where information about how to un-serialise a field is
split across two JSON fields (e.g. disk type and disk logical_id,
hypervisor and hvparams, etc.), we need to pass the entire object to
custom read functions.

Furthermore, since we will have to generate two actual fields from the
single in-memory field, we need to extend the custom save function so
that they can generate additional fields beyond the "main" field value
they currently generate.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoChange how customFields are built
Iustin Pop [Mon, 16 Jul 2012 11:31:18 +0000 (13:31 +0200)]
Change how customFields are built

Instead of passing an expression (which cannot come from the current
module), we pass a name, which is allowed to reference functions from
the module we're in. Since we currently don't have custom fields, we
don't need to modify any callers.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoImplement lookup of partial names in Config.hs
Iustin Pop [Wed, 18 Jul 2012 09:31:39 +0000 (11:31 +0200)]
Implement lookup of partial names in Config.hs

This uses the recently-moved functions to implement partial lookup of
names on getNode and getInstance, similar to the Python codebase.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoReorganise the lookup functions
Iustin Pop [Wed, 18 Jul 2012 09:03:31 +0000 (11:03 +0200)]
Reorganise the lookup functions

Currently, the LookupResult, MatchPriority and related functions are
locate in Loader.hs, since (so far) only hbal needs them in the
selection of instances. However, with the new functionality on confd
side, we need these functions there too, but we don't want to import
Loader.hs (which pulls in lots of balancing-related code). So we move
all these function to BasicTypes.hs, since that module is a leaf one,
with no other dependencies.

Unittests are slightly adjusted (but they are still tested under the
'Loader' group).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoRemove an unused function
Iustin Pop [Mon, 16 Jul 2012 11:30:04 +0000 (13:30 +0200)]
Remove an unused function

This is not used, as we need a more complex serialisation, which is
done in the saveObjectField function.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoEnsure that disk.params is always defined (and a dict)
Iustin Pop [Wed, 18 Jul 2012 12:18:12 +0000 (14:18 +0200)]
Ensure that disk.params is always defined (and a dict)

Commit cce46164 fixed upgrading from other 2.6 versions, but
accidentally broke upgrading from 2.5 (disk.params was left as None,
which breaks FillDict). The simplest way to handle params is to always
set them to an empty dict (disregarding what they currently contain).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAnother small consistency fix with if branches
René Nussbaumer [Wed, 18 Jul 2012 11:34:36 +0000 (13:34 +0200)]
Another small consistency fix with if branches

While looking at the testability of this piece of code, I found another
consistency problem. We have two if branches instead of one, with
elif's.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix inconsistency in the LUXI protocol w.r.t. args
René Nussbaumer [Wed, 18 Jul 2012 09:13:09 +0000 (11:13 +0200)]
Fix inconsistency in the LUXI protocol w.r.t. args

This inconsistency was found during rebalancing. Hbal failed because,
Ganeti couldn't load the opcode. After digging through the cause, an
inconsistency with the "args" field in the LUXI protocol was triggered
by the TemplateHaskell side where it's done uniformed.

For SubmitJob and SubmitManyJobs we treat args as one argument,
containing the job definition. In every other LUXI call args is actually
a list of arguments. This patch fixes this consistency.

This change is NOT backwards compatible.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix UpgradeConfig of Disk object regards disk params
René Nussbaumer [Tue, 17 Jul 2012 08:18:41 +0000 (10:18 +0200)]
Fix UpgradeConfig of Disk object regards disk params

This bug was found during disk parameter debugging. While looking at the
config some values seem present on the disk parameters, but that's not
expected behaviour. This patch fixes this, and also fixes the "broken"
configs automatically upon masterd restart.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoMake Ganeti 2.6.0 rc3 release v2.6.0rc3
René Nussbaumer [Fri, 13 Jul 2012 11:46:34 +0000 (13:46 +0200)]
Make Ganeti 2.6.0 rc3 release

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAllow reinstall even when secondaries are offline
René Nussbaumer [Wed, 11 Jul 2012 12:29:06 +0000 (14:29 +0200)]
Allow reinstall even when secondaries are offline

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>

12 years agoPrepare NEWS file for Ganeti 2.6.0 rc3
René Nussbaumer [Wed, 11 Jul 2012 11:38:34 +0000 (13:38 +0200)]
Prepare NEWS file for Ganeti 2.6.0 rc3

Update NEWS regarding rc3 fixes and document changes in behaviour.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoQA updated to test instance removing when sec. is offline
Agata Murawska [Mon, 9 Jul 2012 10:49:52 +0000 (12:49 +0200)]
QA updated to test instance removing when sec. is offline

Added test checking that it is possible to remove an instance with drbd
disk when non-primary node is offline.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoIgnore offline node errors when removing disks
Agata Murawska [Mon, 9 Jul 2012 09:00:53 +0000 (11:00 +0200)]
Ignore offline node errors when removing disks

When we delete DRBD disks from some instance, we do not want to get
errors due to nodes other than that instance's primary being offline.

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoAllow instance disc activation with offline secondaries
Iustin Pop [Fri, 6 Jul 2012 13:59:19 +0000 (15:59 +0200)]
Allow instance disc activation with offline secondaries

Currently, this is not allowed, so one can't run a replace-disks; this
breaks any non-invasive method of recovering the redundancy of the
instance if its disks are already stopped (but it still works if the
disks on the primary are active). So let's fix this inconsistency.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoRAPI regression beparams/memory fix
René Nussbaumer [Fri, 6 Jul 2012 09:35:24 +0000 (11:35 +0200)]
RAPI regression beparams/memory fix

For compatibility with the old Ganeti version, we want to keep the
beparams/memory field around for another release. This patch fixes this
regression.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoFix redistribution of files w.r.t. offline nodes
Iustin Pop [Wed, 4 Jul 2012 15:41:01 +0000 (17:41 +0200)]
Fix redistribution of files w.r.t. offline nodes

Currently, _RedistributeAncillaryFiles computes two lists: the list of
online nodes (for all files redistribution), and the list of
vm_capable nodes, for hypervisor-specific files. However, the
vm_capable list includes offline nodes too, leading to warning
messages:

  WARNING: Copy of file /etc/xen/xend-config.sxp to node node13.example.com failed: Node is marked offline

We fix this by trivially intersecting the vm_capable list with the
online one.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>

12 years agoFix cluster verify error on master-ip-setup script
René Nussbaumer [Wed, 4 Jul 2012 11:08:40 +0000 (13:08 +0200)]
Fix cluster verify error on master-ip-setup script

This error does not show up until we exceed the pool of master
candidates and have nodes which are not master candidates.

The background is that we check for master-ip-setup script on master
candidates and expect them not to be on the other nodes. However, we
distribute a default master-ip-script which break this assumption.
Furthermore, there's no reason why the file should just exists on the
master candidates.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

12 years agoAdd a Makefile rule to test unclean git status
Iustin Pop [Sat, 30 Jun 2012 01:25:45 +0000 (18:25 -0700)]
Add a Makefile rule to test unclean git status

This is trivial, but can be used easily from automated builds to check
that the git tree is clean: files are not modified and untracked files
are not present.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>