ganeti-local
15 years agoMerge branch 'next' into branch-2.1
Iustin Pop [Fri, 17 Jul 2009 13:30:56 +0000 (15:30 +0200)]
Merge branch 'next' into branch-2.1

* next:
  Optimizie OpCode loading
  Yet another fallout from the pylint fixes

15 years agoOptimizie OpCode loading
Iustin Pop [Fri, 17 Jul 2009 12:54:30 +0000 (14:54 +0200)]
Optimizie OpCode loading

This patch converts the opcode loading to a pre-built map (at import
time) instead of iteration over the globals dict at each call.

Microbenchmarks show that this should be around three times faster, and
burnin still passes.

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

15 years agoYet another fallout from the pylint fixes
Iustin Pop [Fri, 17 Jul 2009 12:39:45 +0000 (14:39 +0200)]
Yet another fallout from the pylint fixes

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoMerge branch 'next' into branch-2.1
Guido Trotter [Fri, 17 Jul 2009 11:41:21 +0000 (13:41 +0200)]
Merge branch 'next' into branch-2.1

* next:
  Fix another issue with hypervisor_name change
  Update NEWS and version for 2.0.2 release
  Improve the description of node flags in man page
  Add enabled hypervisors to TestConfigRunner
  Add a few more checks to verify config
  Make sure enabled_hypervisors list is valid
  Change default stripe count to 1
  Use full-stripe size in LVM growth
  Remove ConfigWriter.InitConfig
  RAPI: implement instance reinstall

Conflicts:

  test/ganeti.config_unittest.py
    529d13a43907dd3f5ab1814e52098f04c2a43f93 contained a small fix which
    was also present in 066f465dbc53dd8ae80442dfe2592602be1ac231

15 years agoMerge branch 'master' into next
Guido Trotter [Fri, 17 Jul 2009 11:40:17 +0000 (13:40 +0200)]
Merge branch 'master' into next

* master:
  Update NEWS and version for 2.0.2 release
  Improve the description of node flags in man page
  Change default stripe count to 1
  Use full-stripe size in LVM growth
  RAPI: implement instance reinstall

15 years agoFix another issue with hypervisor_name change
Iustin Pop [Thu, 16 Jul 2009 16:30:57 +0000 (18:30 +0200)]
Fix another issue with hypervisor_name change

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

15 years agoUpdate NEWS and version for 2.0.2 release v2.0.2
Iustin Pop [Thu, 16 Jul 2009 13:41:36 +0000 (15:41 +0200)]
Update NEWS and version for 2.0.2 release

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

15 years agoImprove the description of node flags in man page
Raiford Storey [Thu, 16 Jul 2009 16:49:18 +0000 (09:49 -0700)]
Improve the description of node flags in man page

[iustin@google.com: slightly reworded the explanation for offline and
changed the commit message]
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

15 years agoAdd enabled hypervisors to TestConfigRunner
Guido Trotter [Thu, 16 Jul 2009 13:48:53 +0000 (15:48 +0200)]
Add enabled hypervisors to TestConfigRunner

This parameter is now mandatory for the cluster config to work.

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

15 years agoAdd a few more checks to verify config
Guido Trotter [Thu, 16 Jul 2009 12:44:17 +0000 (14:44 +0200)]
Add a few more checks to verify config

- Check that the enabled hypervisors list is valid
- Check that the master node is a valid node

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

15 years agoMake sure enabled_hypervisors list is valid
Guido Trotter [Thu, 16 Jul 2009 12:02:42 +0000 (14:02 +0200)]
Make sure enabled_hypervisors list is valid

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

15 years agoGet rid of the default_hypervisor slot
Guido Trotter [Tue, 14 Jul 2009 16:37:49 +0000 (18:37 +0200)]
Get rid of the default_hypervisor slot

Currently we have both a default_hypervisor and an enabled_hypervisors
list. The former is only settable at cluster init time, while the latter
can be changed with cluster modify.

This becomes cumbersome in a few ways: at cluster init time for example
if we pass in a list of enabled hypervisors which doesn't include the
"default" xen-pvm one, we're also forced to pass a default hypervisor,
or an error will be reported. It is also currently possible to disable
the default hypervisor in cluster-modify (with unknown results).

In order to avoid this we get rid of this field altogether, and define
the "first" enabled hypervisor as the default one. This allows ease of
changing which one is the default, and at the same time maintains
coherency.

At configuration upgrade we make sure that the old default is first in
the list, so that 2.0 cluster defaults are preserved.

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

15 years agodesign-2.1: Update OS Flavours section
Guido Trotter [Tue, 14 Jul 2009 12:28:37 +0000 (14:28 +0200)]
design-2.1: Update OS Flavours section

This reflects a discussion we had, according to which the full
"parameters" implementation is too heavy weight for 2.1, and we should
have a partial version for now, and decide again later.

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

15 years agoChange default stripe count to 1
Iustin Pop [Thu, 16 Jul 2009 10:41:55 +0000 (12:41 +0200)]
Change default stripe count to 1

In order not to change the default during a stable series, we modify
configure.ac to default to one stripe, in effect keeping the status quo
(well, minus the LVM Attach() changes).

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

15 years agocmdlib: Use dict.fromkeys instead of custom loop
Michael Hanselmann [Tue, 14 Jul 2009 12:35:34 +0000 (14:35 +0200)]
cmdlib: Use dict.fromkeys instead of custom loop

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

15 years agoSimplify InitConfig and remove SimpleConfigWriter
Guido Trotter [Tue, 14 Jul 2009 15:56:48 +0000 (17:56 +0200)]
Simplify InitConfig and remove SimpleConfigWriter

InitConfig currently creates the cluster config_data, then puts it into
a dict, passes it to SimpleConfigWriter to load it from a dict (which
just reuses the dict value) and then saves it. The SimpleConfigWriter is
then returned, but ignored. With this patch we just write out the
config_data at InitConfig time, and thus can remove SimpleConfigWriter
altogether. The now unused SimpleConfigReader.FromDict is also gone.

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

15 years agoInitCluster, don't use SimpleConfigWriter
Guido Trotter [Tue, 14 Jul 2009 15:52:59 +0000 (17:52 +0200)]
InitCluster, don't use SimpleConfigWriter

InitConfig returns a SimpleConfigWriter to InitCluster, which then
passes it on to ssh.WriteKnownHostsFile, which extracts a couple of
values from it. One line later the full ConfigWriter is initialized.

By initializing it one line before we can pass the full writer to
ssh.WriteKnownHostsFile, and thus we don't need to care anymore for the
InitConfig returned SimpleConfigWriter

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

15 years agoFix python 2.4 compatibility
Guido Trotter [Thu, 16 Jul 2009 10:43:56 +0000 (12:43 +0200)]
Fix python 2.4 compatibility

I got overexcited and forgot we have to remain compatible with python
2.4. With this patch we move from sha256 to sha1 for hmac authenticated
serialized messages, and we handle both newer and older python, by
importing the right module for each.

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

15 years agoUse full-stripe size in LVM growth
Iustin Pop [Mon, 13 Jul 2009 12:52:50 +0000 (14:52 +0200)]
Use full-stripe size in LVM growth

LVM has issues when growing stripped volumes, so it's best to specify
the growth in exact multiples of the full stripe size (as precise as
possible). For this we need to do a couple of changes:
  - in LVM Attach(), we query additionally the VG extent size and the LV
    stripe count; since this makes lvs return a (possibly) multi-line
    output, we now split it into lines and only take the last one
  - in LVM Grow(), we round up the increase in multiples of the full
    stripe size

The patch also sets the correct target size in DRBD growth.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoRemove ConfigWriter.InitConfig
Guido Trotter [Tue, 14 Jul 2009 15:47:03 +0000 (17:47 +0200)]
Remove ConfigWriter.InitConfig

It's been replaced by a simpler bootstrap.InitConfig function, which
does the same job, and is currently unused.

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

15 years agoMerge branch 'next' into branch-2.1
Guido Trotter [Tue, 14 Jul 2009 15:15:43 +0000 (17:15 +0200)]
Merge branch 'next' into branch-2.1

* next:
  Remove SimpleConfigWriter.SetMasterNode
  _GenerateDiskTemplate: use base_index in the name
  ganeti-masterd: avoid SimpleConfigReader
  cmdlib: Fix typo in LUQueryClusterInfo

Conflicts:

daemons/ganeti-masterd
  RPC related conflict

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoRemove SimpleConfigWriter.SetMasterNode
Guido Trotter [Tue, 14 Jul 2009 15:05:34 +0000 (17:05 +0200)]
Remove SimpleConfigWriter.SetMasterNode

This function is not used.

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

15 years ago_GenerateDiskTemplate: use base_index in the name
Guido Trotter [Tue, 14 Jul 2009 13:42:58 +0000 (15:42 +0200)]
_GenerateDiskTemplate: use base_index in the name

Currently if a disk is added later the base_index is not considered, and
all the disks are called disk0. This patch fixes it.

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

15 years agoganeti-masterd: avoid SimpleConfigReader
Guido Trotter [Tue, 14 Jul 2009 12:09:21 +0000 (14:09 +0200)]
ganeti-masterd: avoid SimpleConfigReader

SimpleStore is a lot less heavyweight than SimpleConfigReader, and to
just get the master name we can use that. This is the only usage of
SimpleConfigReader currently, but we're not going to delete the class,
as new usages will come in for ganeti-confd (in 2.1). Using it there,
though, will make the class even more heavy to load, so it makes sense
for this simple usage to be converted.

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoHMAC authenticated json messages
Guido Trotter [Mon, 13 Jul 2009 13:40:06 +0000 (15:40 +0200)]
HMAC authenticated json messages

This patch includes HMAC authenticated json messages to the serializer.
The new interface works on any json-encodable data type, and can sign it
with a private key and an optional salt. The same private key must be
used upon message loading to verify the message.

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

15 years agorapi: Implement /2/nodes/[node_name]/role resource
Michael Hanselmann [Mon, 13 Jul 2009 13:48:29 +0000 (15:48 +0200)]
rapi: Implement /2/nodes/[node_name]/role resource

This resource can be used to retrieve and set the role of a node.

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

15 years agorapi: Add generic “force” parameter
Michael Hanselmann [Mon, 13 Jul 2009 13:47:41 +0000 (15:47 +0200)]
rapi: Add generic “force” parameter

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

15 years agocmdlib: Fix typo in LUQueryClusterInfo
Michael Hanselmann [Mon, 13 Jul 2009 13:55:56 +0000 (15:55 +0200)]
cmdlib: Fix typo in LUQueryClusterInfo

This was broken by my pylint fixes patch.

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

15 years agoRAPI: implement instance reinstall
Iustin Pop [Mon, 13 Jul 2009 09:11:41 +0000 (11:11 +0200)]
RAPI: implement instance reinstall

This patch adds instance reinstall to RAPI, with two optional parameters:
  - ‘os', in order to change the OS on reinstall
  - ‘nostartup’, in order to leave the instance down after reinstall

The call will first shutdown the instance, the reinstall it, and unless
‘nostartup’ has been passed and is equal to 1, it will be started
automatically.

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

15 years agoExtend call_node_start_master rpc with no_voting
Guido Trotter [Tue, 7 Jul 2009 13:35:05 +0000 (15:35 +0200)]
Extend call_node_start_master rpc with no_voting

When the parameter is set to True and start_daemons is also True,
ganeti-masterd will be started with the new --no-voting --yes-do-it
options.

This new option is set to True only on masterfailover, when no_voting is
used. This changed the behavior from 2.0, where we didn't start the
master daemon at all, when this option was used.

The manpage is also updated to remove the 2.0 only change.

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

15 years agoMerge branch 'next' into branch-2.1
Guido Trotter [Wed, 8 Jul 2009 09:28:37 +0000 (11:28 +0200)]
Merge branch 'next' into branch-2.1

* next:
  Create a new --no-voting option for masterfailover
  ganeti-masterd: allow non-interactive --no-voting
  Fix pylint warnings
  Add custom pylintrc
  bootstrap: Don't leak file descriptor when generating SSL certificate
  Fix problem with EAGAIN on socket connection in clients
  Fix some typos
  Increase maximum accepted size for a DRBD meta dev
  Cleanup config data when draining nodes
  Fix node readd issues
  backend.DemoteFromMC: don't fail for missing files
  Allow GetMasterCandidateStats to ignore some nodes
  Fix error message for extra files on non MC nodes

Conflicts:

lib/backend.py
          Most of the conflicts where in the new rpcs VS pylint fixes
          and usually the new rpcs fixed the pylint problems as well
lib/bootstrap.py
          Small conflict between masterfailover --no-voting and new rpcs
lib/cmdlib.py
          Net parameters conflicted here, kept that version
lib/objects.py
          Same problem fixed in two different ways. 'next' version kept

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoMerge branch 'master' into next
Guido Trotter [Wed, 8 Jul 2009 09:27:52 +0000 (11:27 +0200)]
Merge branch 'master' into next

* master:
  Create a new --no-voting option for masterfailover
  ganeti-masterd: allow non-interactive --no-voting

15 years agoCreate a new --no-voting option for masterfailover
Guido Trotter [Wed, 8 Jul 2009 08:34:11 +0000 (10:34 +0200)]
Create a new --no-voting option for masterfailover

This allows failing over in certain corner cases, such as a 2 node
cluster with one node down. The man page is also updated to document
this dangerous option and how to recover from this situation.

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

15 years agoganeti-masterd: allow non-interactive --no-voting
Guido Trotter [Tue, 7 Jul 2009 13:23:38 +0000 (15:23 +0200)]
ganeti-masterd: allow non-interactive --no-voting

This will be used by ganeti-noded to start ganeti-masterd in a
--no-voting masterfailover.

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

15 years agoFix pylint warnings
Michael Hanselmann [Fri, 3 Jul 2009 20:42:23 +0000 (22:42 +0200)]
Fix pylint warnings

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

15 years agoAdd custom pylintrc
Michael Hanselmann [Fri, 3 Jul 2009 20:41:01 +0000 (22:41 +0200)]
Add custom pylintrc

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

15 years agobootstrap: Don't leak file descriptor when generating SSL certificate
Michael Hanselmann [Fri, 3 Jul 2009 19:54:08 +0000 (21:54 +0200)]
bootstrap: Don't leak file descriptor when generating SSL certificate

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

15 years agoFix problem with EAGAIN on socket connection in clients
Michael Hanselmann [Thu, 2 Jul 2009 20:39:20 +0000 (22:39 +0200)]
Fix problem with EAGAIN on socket connection in clients

If a user used ^Z to stop the program, poll() in socket.recv would return
EAGAIN due to SIGSTOP. This patch changes luxi.Transport.Recv to ignore EAGAIN.

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

15 years agoFix some typos
Michael Hanselmann [Wed, 1 Jul 2009 21:28:35 +0000 (23:28 +0200)]
Fix some typos

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

15 years agoIncrease maximum accepted size for a DRBD meta dev
Iustin Pop [Wed, 1 Jul 2009 09:08:13 +0000 (11:08 +0200)]
Increase maximum accepted size for a DRBD meta dev

With the change to stripped LVs, the actual size of a meta device (which
is small) can be more than we expected (for non-stripped LVs). This
patch increases from 160MB to 1GB the accepted size, and updates the
comment with the rationale behind this change.

Note that we do want even meta devices stripped, since it can increase
metadata update.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoCleanup config data when draining nodes
Iustin Pop [Tue, 30 Jun 2009 16:10:16 +0000 (18:10 +0200)]
Cleanup config data when draining nodes

Currently, when draining nodes we reset their master candidate flag, but
we don't instruct them to demote themselves. This leads to “ERROR: file
'/var/lib/ganeti/config.data' should not exist on non master candidates
(and the file is outdated)”.

This patch simply adds a call to node_demote_from_mc in this case.

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

15 years agoFix node readd issues
Iustin Pop [Tue, 30 Jun 2009 15:51:26 +0000 (17:51 +0200)]
Fix node readd issues

This patch fixes a few node readd issues.

Currently, the node readd consists of two opcodes:
  - OpSetNodeParms, which resets the offline/drained flags
  - OpAddNode (with readd=True), which reconfigures the node

The problem is that between these two, the configuration is inconsistent
for certain cluster configurations. Thus, this patch removes the first
opcode and modified the LUAddNode to deal with this case too.

The patch also modifies the computation of the intended master_candidate
status, and actually sets the readded node to master candidate if
needed. Previously, we didn't modify the existing node at all.

Finally, the patch modifies the bottom of the Exec() function for this
LU to:
  - trigger a node update, which in turn redistributes the ssconf files
    to all nodes (and thus the new node too)
  - if the new node is not a master candidate, then call the
    node_demote_from_mc RPC so that old master files are cleared

My testing shows this behaves correctly for various cases.

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

15 years agobackend.DemoteFromMC: don't fail for missing files
Iustin Pop [Tue, 30 Jun 2009 15:59:29 +0000 (17:59 +0200)]
backend.DemoteFromMC: don't fail for missing files

If the config file is missing when the DemoteFromMC() function is
called, it will raise a ProgrammerError. Instead of changing the
utils.CreateBackup() file which is called from multiple places, for now
we only change the DemoteFromMC() function to not call it if the file is
not existing (we rely on the master to prevent race conditions here).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoAllow GetMasterCandidateStats to ignore some nodes
Iustin Pop [Tue, 30 Jun 2009 13:09:00 +0000 (15:09 +0200)]
Allow GetMasterCandidateStats to ignore some nodes

This patch modifies ConfigWriter.GetMasterCandidateStats to allow it to
ignore some nodes in the calculation, so that we can use it to predict
cluster state without some nodes (which we know we will modify, and thus
we should not rely on their state).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoFix error message for extra files on non MC nodes
Iustin Pop [Tue, 30 Jun 2009 07:49:57 +0000 (09:49 +0200)]
Fix error message for extra files on non MC nodes

Currently the message for extraneous files on non master candidates is
confusing, to say the least. This makes it hopefully more clear.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

15 years agoMerge branch 'master' into branch-2.1
Guido Trotter [Mon, 29 Jun 2009 14:41:43 +0000 (15:41 +0100)]
Merge branch 'master' into branch-2.1

* master:
  Fix adjustement of candidates in cluster modify
  Add a new node list field
  Fix HTTP server library handling of credentials
  Fix a typo in backend.InstanceReboot docstring
  Fix handling of 'vcpus' in instance list
  Fix checking for valid OS in instance create
  Show disk size in instance info

Conflicts:
  lib/backend.py
    docstring update, mixed version kept
  lib/cmdlib.py
    OS validity checking, branch-2.1 version kept, since the new rpc
    included all the error checking

15 years agoRename the volume_list RPC call to lv_list
Iustin Pop [Mon, 29 Jun 2009 14:25:57 +0000 (16:25 +0200)]
Rename the volume_list RPC call to lv_list

There are volume-related rpc calls. This patch renames the ‘volume_list’
call to ‘lv_list’ to make more clear its purpose.

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

15 years agoGenericMain, handle ParameterError from _ParseArgs
Guido Trotter [Mon, 29 Jun 2009 13:59:41 +0000 (14:59 +0100)]
GenericMain, handle ParameterError from _ParseArgs

Before this case was not covered, and printed a stack trace.

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

15 years agocheck_ident_key_val, handle no_ and - prefixes
Guido Trotter [Fri, 26 Jun 2009 16:45:32 +0000 (17:45 +0100)]
check_ident_key_val, handle no_ and - prefixes

If an ident member of an IdentKeyVal relationship starts with no_ or -,
handle it the same way we do for a key. Some unittests are added to
check that check_ident_key_val behaves as expected.

This patch also changes ForceDictType to, for now, fail on such an
entry, and the same to happen when creating an instance or modifying its
nics or disks.

This behavior will be used later on to allow deletion of os entries in
os parameters.

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

15 years ago_SplitKeyVal with no data return an empty dict
Guido Trotter [Fri, 26 Jun 2009 16:33:10 +0000 (17:33 +0100)]
_SplitKeyVal with no data return an empty dict

If an empty string is passed to _SplitKeyVal, we should return {},
rather than {'': True}. Also test for the correct behavior.

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

15 years agoIntroduce OS api version 15
Guido Trotter [Mon, 22 Jun 2009 14:31:15 +0000 (15:31 +0100)]
Introduce OS api version 15

Also, since Ganeti 2.1 will be compatible with both 10 and 15, change
the OS_API_VERSION constant to be an OS_API_VERSIONS set, and update the
places in the code that used that constat to use something else.

In particular:
  - in the qa for now we just create a fake version 10 OS
  - in the os environment we use the highest common version
    (which means we need to pass in the os to OSEnvironment)
  - when loading an OS any common version will do

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

15 years ago_OSOndiskAPIVersion: save a loop
Guido Trotter [Fri, 26 Jun 2009 14:58:38 +0000 (15:58 +0100)]
_OSOndiskAPIVersion: save a loop

The api_versions list is first stripped and then converted to integer.
Combining the two operations.

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

15 years agoFix adjustement of candidates in cluster modify
Iustin Pop [Mon, 29 Jun 2009 11:02:03 +0000 (13:02 +0200)]
Fix adjustement of candidates in cluster modify

The code for adjusting the candidate pool size was done after the config
update, and this means we triggered the save of the config file without
fixing the candidate pool, which aborts with an error.

The patch just moves it above. The old comment was valid, but we anyway
save the config file in MaintainCandidatePool, so this should be safe.

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

15 years agoAdd a new node list field
Iustin Pop [Mon, 29 Jun 2009 08:57:27 +0000 (10:57 +0200)]
Add a new node list field

This patch adds a ‘role’ node list field, which shows a one-character
node status. This is a simpler way to see the node status than selecting
all the flags individually.

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

15 years agoUse ReadFile.splitlines() rather than readlines
Guido Trotter [Fri, 26 Jun 2009 11:17:10 +0000 (12:17 +0100)]
Use ReadFile.splitlines() rather than readlines

A few places in the code open a file "manually" rather than using our
wrapper function, because they need an array with the lines. Combining
the result of utils.ReadFile with splitlines() we get rid of the
exceptions.

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

15 years agoRename _OSOndiskVersion to _OSOndiskAPIVersion
Guido Trotter [Wed, 24 Jun 2009 15:14:10 +0000 (16:14 +0100)]
Rename _OSOndiskVersion to _OSOndiskAPIVersion

This makes what versions we're talking about clearer.

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

15 years agoConvert ssconf._ReadFile to utils.ReadFile
Guido Trotter [Wed, 24 Jun 2009 15:12:46 +0000 (16:12 +0100)]
Convert ssconf._ReadFile to utils.ReadFile

Making ssconf._ReadFile a wrapper over utils.ReadFile

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agobackend.StartMaster: fix variable name
Iustin Pop [Tue, 23 Jun 2009 15:22:50 +0000 (17:22 +0200)]
backend.StartMaster: fix variable name

As per comments for patch “Convert node_start_master to new style
result”, the ‘payload’ variable is renamed to ‘err_msgs’.

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

15 years agoFix HTTP server library handling of credentials
Iustin Pop [Tue, 23 Jun 2009 11:38:35 +0000 (13:38 +0200)]
Fix HTTP server library handling of credentials

Currently the http library only checks credentials when authentication
is required. This means that any credentials are accepted on the root
resource, for example, which makes problems hard to diagnose - the
user/pw works for all queries, until one tries to do a modification at
which point fails.

This patch changes the PreHandleRequest() function to not ignore
credentials when passed, even if we don't require authentication. This
makes the behavior of RAPI more predictable.

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

15 years agoFix a typo in backend.InstanceReboot docstring
Iustin Pop [Tue, 23 Jun 2009 11:07:58 +0000 (13:07 +0200)]
Fix a typo in backend.InstanceReboot docstring

The documentation for the reboot was wrong. This patch fixes it and
updates the docstring with more details.

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

15 years agoUpdate RAPI docs for the dry-run mode
Iustin Pop [Fri, 19 Jun 2009 13:20:30 +0000 (15:20 +0200)]
Update RAPI docs for the dry-run mode

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

15 years agorapi: implement dry-run mode
Iustin Pop [Fri, 19 Jun 2009 13:01:12 +0000 (15:01 +0200)]
rapi: implement dry-run mode

This patch implements dry-run mode for the operations which modify the
state of the cluster. Dry-run mode is enabled by passing a 'dry-run'
query argument with positive integer value.

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

15 years agoLUCreateInstance: the node list as return value
Iustin Pop [Fri, 19 Jun 2009 12:27:44 +0000 (14:27 +0200)]
LUCreateInstance: the node list as return value

Currently LUCreateInstance has no result; this patch changes it so that
both the normal result and the dry-run result is the node list of the
selected instance.

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

15 years agoImplement dry-run mode at cli level (partially)
Iustin Pop [Fri, 19 Jun 2009 12:24:42 +0000 (14:24 +0200)]
Implement dry-run mode at cli level (partially)

This patch adds support for the dry-run mode for all command line
operations, and also makes use of this for commands using the
SubmitOrSend function. For the ones not using it, the flag has no
effect (future patches).

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

15 years agoLU execution: implement dry-run framework
Iustin Pop [Fri, 19 Jun 2009 12:09:19 +0000 (14:09 +0200)]
LU execution: implement dry-run framework

This patch adds a new (global) opcode flag 'dry_run' which, when True,
causes early exit from the LU workflow, returning a special value from
the LU object (initialized in the parent LogicalUnit class, and which if
not overriden from child LUs will be None).

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

15 years agoIntroduce __slots__ deriving in opcodes.py
Iustin Pop [Fri, 19 Jun 2009 11:58:38 +0000 (13:58 +0200)]
Introduce __slots__ deriving in opcodes.py

This simple patch adds to all opcodes extension of the base opcode
__slots__. This way we can add slots across all opcodes, for example
'dry-run'.

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

15 years agoFix some small epydoc warnings
Iustin Pop [Fri, 19 Jun 2009 10:36:18 +0000 (12:36 +0200)]
Fix some small epydoc warnings

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

15 years agognt-instance(8) one more batch-create update
Guido Trotter [Thu, 18 Jun 2009 13:34:51 +0000 (14:34 +0100)]
gnt-instance(8) one more batch-create update

Document the new nics list, as an alternative to the one nick which you
can create with the old mac, ip, mode, link/bridge keys.

Also specify that 'bridge' is still accepted as well.

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

15 years agoUpdate gnt-instance batch-create for NIC params
Guido Trotter [Tue, 16 Jun 2009 16:57:21 +0000 (17:57 +0100)]
Update gnt-instance batch-create for NIC params

This is compatible with the previous version, but also allows specifying
more than one nic, by giving a "nics" list of dicts. The two methods
(individual fields for the first nic, and list of all nics) are
incompatible with each other.

The default remains one nick with no parameters specified.

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

15 years agoFix various pylint warnings
Iustin Pop [Thu, 18 Jun 2009 10:11:10 +0000 (12:11 +0200)]
Fix various pylint warnings

There were multiple issues:
  - copy-paste resulted in wrong indentation
  - wrong function name
  - missing spaces around assignment
  - overriding built-in names (type, dir) or already defines ones
    (errors, hypervisor)

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

15 years agoDocument iallocator proposed improvements
Iustin Pop [Thu, 18 Jun 2009 09:41:08 +0000 (11:41 +0200)]
Document iallocator proposed improvements

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

15 years agoFix handling of 'vcpus' in instance list
Iustin Pop [Wed, 17 Jun 2009 13:42:09 +0000 (15:42 +0200)]
Fix handling of 'vcpus' in instance list

Currently running “gnt-instance list -o+vcpus” fails with a cryptic message:
  Unhandled Ganeti error: vcpus

This is due to multiple issues:
  - in some corner cases cmdlib.py raises an errors.ParameterError but
    this is not handled by cli.py
  - LUQueryInstances declares ‘vcpu’ as a supported field, but doesn't handle
    it, so instead of failing with unknown parameter, e.g.:
      Failure: prerequisites not met for this operation:
      Unknown output fields selected: vcpuscd
    it raises the ParameteError message

This patch:
  - adds handling of 'vcpus' to LUQueryInstances
  - adds handling of the ParameterError exception to cli.py
  - changes the 'else: raise errors.ParameterError' in the field handling of
    LUQueryInstance to an assert, since it's a programmer error if we reached
    this step

With this, a future unhandled parameter will show:
  gnt-instance list -o+vcpus
  Unhandled protocol error while talking to the master daemon:
  Caught exception: Declared but unhandled parameter 'vcpus'

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

15 years agoRAPI: move to nic parameters
Guido Trotter [Tue, 16 Jun 2009 14:40:22 +0000 (15:40 +0100)]
RAPI: move to nic parameters

In query we ask for nic.links, rather than nic.bridges
In create we accept both "link" and "bridge" and let the opcode deal
with it. Note that we still can create only one nic per instance.

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

15 years agoUpdate manpages for NIC parameters
Guido Trotter [Tue, 16 Jun 2009 10:42:47 +0000 (11:42 +0100)]
Update manpages for NIC parameters

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

15 years agoUpdate a forgot docstring for nic parameters
Guido Trotter [Tue, 16 Jun 2009 16:43:21 +0000 (17:43 +0100)]
Update a forgot docstring for nic parameters

Properly document the expected nic format.

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

15 years agoFix QueryInstanceData for nic parameters
Guido Trotter [Tue, 16 Jun 2009 16:44:31 +0000 (17:44 +0100)]
Fix QueryInstanceData for nic parameters

This CL updates QueryInstanceData to return NICs in the new format (mac,
ip, mode, link) and fixes gnt-instance info to properly display them.

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

15 years agoUpdate instance query for NIC parameters
Guido Trotter [Tue, 16 Jun 2009 14:23:32 +0000 (15:23 +0100)]
Update instance query for NIC parameters

Compatibility with the old parameters is maintained, by allowing to
query for "bridge" "nic.bridges" and "nic.bridge/N", but None is
returned in that case for routed nics.

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

15 years agoRename _PreBuildNICHooksList to _NICListToTuple
Guido Trotter [Wed, 17 Jun 2009 10:59:09 +0000 (11:59 +0100)]
Rename _PreBuildNICHooksList to _NICListToTuple

We're going to use this helper function for more than just hooks, so
we'll give it a more generic name.

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

15 years agoFix checking for valid OS in instance create
Iustin Pop [Wed, 17 Jun 2009 11:01:46 +0000 (13:01 +0200)]
Fix checking for valid OS in instance create

The current check in LUCreateInstance.CheckPrereq() is wrong - it only checks
if we got an OS, but not if we got a valid OS. This patch fixes it.

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

15 years agoShow disk size in instance info
Iustin Pop [Wed, 17 Jun 2009 10:50:39 +0000 (12:50 +0200)]
Show disk size in instance info

The size of the instance's disk was not shown in “gnt-instance info”.
This patch adds it and formats it nicely if possible.

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

15 years agoMerge branch 'next' into branch-2.1
Guido Trotter [Tue, 16 Jun 2009 15:25:56 +0000 (16:25 +0100)]
Merge branch 'next' into branch-2.1

* next:
  gnt-cluster(8) fix --backend-parameters opt name
  LUQueryInstances: fix querying for nic data
  Specify the object type in two docstring

15 years agognt-cluster(8) fix --backend-parameters opt name
Guido Trotter [Tue, 16 Jun 2009 15:23:27 +0000 (16:23 +0100)]
gnt-cluster(8) fix --backend-parameters opt name

It was mistakenly called --backend

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

15 years agoLUQueryInstances: fix querying for nic data
Guido Trotter [Tue, 16 Jun 2009 14:47:25 +0000 (15:47 +0100)]
LUQueryInstances: fix querying for nic data

Currently we support querying for "mac" "ip" or "bridge", meaning "the
one of the first nic. We are not checking that there is a first nic,
though, and thus could incur in errors. This patch fixes it by returning
"None" should there be no such nic, as it's done when explicitely asking
for a nic via nic.<field>/<N>

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

15 years agoSpecify the object type in two docstring
Guido Trotter [Tue, 16 Jun 2009 14:22:23 +0000 (15:22 +0100)]
Specify the object type in two docstring

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

15 years agoKVMHypervisor, fix a bug in MigrateInstance
Guido Trotter [Tue, 16 Jun 2009 12:35:41 +0000 (13:35 +0100)]
KVMHypervisor, fix a bug in MigrateInstance

This was introduced as a typo in commit
7e66c35b5685525538dd65dd3dff75b5346d30d7 while removing duplicate code
from the KVM hypervisor.

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoFix backend.{Start,Stop}Master
Guido Trotter [Tue, 16 Jun 2009 12:27:29 +0000 (13:27 +0100)]
Fix backend.{Start,Stop}Master

Commit c26a6bd21c17641f718369caed88ae16947fa774 changed GetMasterInfo
not to return a tuple anymore, but didn't update its two callers in
backend.py, which were trying to extract the values from the second
tuple element. This causes a stack trace in node-daemon.log.

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoMerge branch 'next' into branch-2.1
Guido Trotter [Tue, 16 Jun 2009 11:28:25 +0000 (12:28 +0100)]
Merge branch 'next' into branch-2.1

* next: (22 commits)
  Update NEWS and version for 2.0.1 release
  gnt-{instance,backup}(8) --nic is actually --net
  Fix a wrong function name in backend.DrbdAttachNet
  GNT-CLUSTER(8) fix search-tags example
  Enable stripped LVs
  Add a lvm stripecount configure parameter
  Add more constants for DRBD and change sync tests
  Wait for a while in failed resyncs
  Assemble DRBD using the known size
  Fix two issues with exports and snapshot errors
  Set the size on new DRBDs in replace secondary
  Change the bdev init signatures
  Release 2.0.0 final
  watcher: automatically restart noded/rapi
  watcher: handle full and drained queue cases
  rapi: rework error handling
  Fix backend.OSEnvironment be/hv parameters
  rapi: make tags query not use jobs
  Change failover instance when instance is stopped
  Export more instance information in hooks
  ...

Conflicts:

lib/cmdlib.py
test/ganeti.utils_unittest.py

Signed-off-by: Guido Trotter <ultrotter@google.com>

15 years agoMerge branch 'master' into next
Guido Trotter [Tue, 16 Jun 2009 11:25:35 +0000 (12:25 +0100)]
Merge branch 'master' into next

* master:
  Update NEWS and version for 2.0.1 release
  gnt-{instance,backup}(8) --nic is actually --net
  Fix a wrong function name in backend.DrbdAttachNet
  GNT-CLUSTER(8) fix search-tags example

15 years agoUpdate NEWS and version for 2.0.1 release v2.0.1
Iustin Pop [Tue, 16 Jun 2009 09:14:55 +0000 (11:14 +0200)]
Update NEWS and version for 2.0.1 release

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

15 years agognt-{instance,backup}(8) --nic is actually --net
Guido Trotter [Tue, 16 Jun 2009 10:44:34 +0000 (11:44 +0100)]
gnt-{instance,backup}(8) --nic is actually --net

Fix a typo in the man pages that used the wrong option name.

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

15 years agoFix hooks unittests after RPC result changes
Iustin Pop [Mon, 15 Jun 2009 17:25:29 +0000 (19:25 +0200)]
Fix hooks unittests after RPC result changes

Patch "Simplify the RPC result framework in backend.py" changed all
RPCs, and thus the hooks results where also changed. This needs changes
to the hooks unittests too.

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

15 years agoSmall whitespace change
Iustin Pop [Thu, 11 Jun 2009 14:32:16 +0000 (16:32 +0200)]
Small whitespace change

Some indentation was wrong, and pylint rightfully complained.

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

15 years agoSimplify RPC call result check in cmdlib.py
Iustin Pop [Thu, 11 Jun 2009 14:14:45 +0000 (16:14 +0200)]
Simplify RPC call result check in cmdlib.py

Now that all results are the same, we can even more simplify the
handling in cmdlib more. Almost all if result.RemoteFailMsg()…
constructs are similar, and we resurect the RpcResult.Raise() function
to take a message argument, which it will process and raise an
appropriate exception.

This means a significant reduce in boilerplate code. Only the cases
which handle the error specially (e.g. by warning only) need to touch
directly the failure message, which was renamed on the RpcResult object
for more clarity.

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

15 years agoSimplify the RPC result framework in backend.py
Iustin Pop [Thu, 11 Jun 2009 13:18:44 +0000 (15:18 +0200)]
Simplify the RPC result framework in backend.py

Since now all functions fail via _Fail, the return True, … is redundant
as all normal return paths have it, and thus the True value can be added
in the ganeti-noded handler.

This means that all functions can now forget about the special result
type, and instead return normally, but signal all failures via _Fail().

Only a few functions must be handled specially (the recursive ones).

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

15 years agoConvert all backend function to exception
Iustin Pop [Thu, 11 Jun 2009 12:39:11 +0000 (14:39 +0200)]
Convert all backend function to exception

Instead of returning (False, msg) from rpc endpoints, we raise always
exceptions (the non-endpoint, internal functions can remain as is). This
means that the error paths are agnostic to how the failure is signalled
(i.e. by False, msg) and instead use only this method (exceptions) to
signal failures.

The patch also adds a log=False argument to _Fail so that trivial cases are not
logged (but usually it's a good idea to log all failures, for the record).

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

15 years agoSimplify usage of backend._FindDisks
Iustin Pop [Thu, 11 Jun 2009 12:37:47 +0000 (14:37 +0200)]
Simplify usage of backend._FindDisks

Since all users of _FindDisks now return new-style results, we can
simply make it raise an exception and not deal with the status field.

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

15 years agoPre-compute error status in RpcResult
Iustin Pop [Thu, 11 Jun 2009 12:24:26 +0000 (14:24 +0200)]
Pre-compute error status in RpcResult

Since now all RPCs have the new style result type, we can pre-compute
the error message at RpcResult() init time and not wait until it's
requested.

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

15 years agoImplement result-type restriction in ganeti-noded
Iustin Pop [Thu, 11 Jun 2009 09:59:57 +0000 (11:59 +0200)]
Implement result-type restriction in ganeti-noded

Since all rpc calls were converted, we can now:
  - enforce result type to (status, data)
  - convert all unhandled exceptions to (False, str(err))

This makes sure that all unhandled errors are reported to rpc users.

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

15 years agoRemove old invalid-os related functionality
Iustin Pop [Thu, 11 Jun 2009 09:55:22 +0000 (11:55 +0200)]
Remove old invalid-os related functionality

We no longer need OS objects to be able to represent invalid OSes. This
cleans up the code handling those cases.

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

15 years agoBig rewrite of the OS-related functions
Iustin Pop [Thu, 11 Jun 2009 09:46:39 +0000 (11:46 +0200)]
Big rewrite of the OS-related functions

Currently the OSes have a special, customized error handling: the OS
object can represent either a valid OS, or an invalid OS. The associated
function, instead of raising other exception or failing, create custom
OS objects representing failed OSes.

While this was good when no other RPC had failure handling, it's
extremely different from how other function in backend.py expect
failures to be signalled.

This patch reworks this completely:
  - the OS object always represents valid OSes (the next patch will
    remove the valid/invalid field and associated constants)
  - the call_os_diagnose returns instead of a list of OS objects, a list
    of (name, path, status, diagnose_msg); the status is then used in
    cmdlib to determine validity and the status and diagnose_msg values
    are used in gnt-os for display
  - call_os_get returns either a valid OS or a RPC remote failure (with
    the error message)
  - the other functions in backend.py now just call backend.OSFromDisk()
    which will return either a valid OS object or raise an exception
  - the bulk of the OSFromDisk was moved to _TryOSFromDisk which returns
    status, value for the functions which don't want an exception raised

The gnt-os list and diagnose commands still work after this patch.

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