Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / OpCodes.hs @ 638e0a6f

History | View | Annotate | Download (16.4 kB)

# Date Author Comment
0d57ce24 12/19/2012 01:02 pm Guido Trotter

Allow shutting down offline instance

If an instance is offline we definitely shouldn't start it up.
But shutting it down, should it be up by mistake is not "that" bad.
Still, we only allow it with --force, as it still performs an action on
an instance we shouldn't touch. This should make everybody happy....

88127c47 12/17/2012 01:38 pm Iustin Pop

Fix disk_template OpInstSetParams parameter

This is not a required field, but rather an optional one; we add a new
parameter and use it instead.

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

ad1c1e41 12/17/2012 01:29 pm Iustin Pop

Implement opcode summary support

This implements in the Haskell codebase the opcode summary. As opposed
to Python, we always use custom code for formatting, since we don't
want to use dynamic attribute lookup.

To test this properly, we need to change MetaOpCode to record-syntax,...

c298ed02 12/07/2012 03:24 pm Michael Hanselmann

htools: Add missing parameter to OpInstanceMultiAlloc

Somehow this went missing in commit 1f1188c.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Michele Tartara <>

1f1188c3 12/07/2012 02:36 pm Michael Hanselmann

cmdlib: Opportunistic locking on instance creation

Adds a new parameter to “OpInstanceCreate” and “OpInstanceMultiAlloc” to
use opportunistic locks.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Guido Trotter <>

4a826364 12/04/2012 01:44 pm Iustin Pop

Add CommonOpParams and MetaOpCode types

This patch adds the "meta" opcode type and the common op
params. Compatibility tests with Python are changed to pass Meta
opcodes.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

3929e782 12/04/2012 01:44 pm Iustin Pop

Add a function for all fields of a given OP_ID

This patch changes THH to export a new function which defines all
fields of a given OP_ID. Not very clean, since for an invalid OP_ID we
return empty list, but since it will only be used in tests it should
be good enough....

3d7e87b8 12/04/2012 01:44 pm Iustin Pop

Rework/enhance original htools opcodes

The original htools opcodes were minimalistic and not 1:1 equivalent
with the Python ones. Let's add all missing fields and, since we
changed the order, switch to more readable record syntax for building
the opcodes....

67fc4de7 12/04/2012 01:44 pm Iustin Pop

Add a few missing fields from opcodes

Due to manual conversion, a few fields were missing from the
conversion, but as they were optional our type equivalence checking
didn't detect this.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

1dbceab9 12/04/2012 01:44 pm Iustin Pop

Fix Haskell OpNetworkAdd

Commit 213076f (“Fix locking in networks”) changed Python OpNetworkAdd
without corresponding Haskell definition changes.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

f9556d33 11/30/2012 03:54 pm Iustin Pop

Replace hand-coded 'live' field of OpInstanceMigrate

This is the last inline-written field; I've done it separately from
the last patch due to changes being needed in HTools (field changed
type).

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

7d421386 11/30/2012 03:54 pm Iustin Pop

Remove remaining in-line parameters

… except one, and replace them with separately-defined ones in
OpParams.

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

3131adc7 11/30/2012 03:54 pm Iustin Pop

Abstract query common opcode definitions

It would be even better if the opcodes would actually have all the
same definitions, until then we have two sets of definitions.

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

1cd563e2 11/30/2012 03:54 pm Iustin Pop

Add two last missing opcodes

OpInstanceQuery was missing accidentally, whereas OpRestrictedCommand
was just recently added without Haskell definitions.

The patch also slightly improves the OpNodeQuery arbitrary generation.

Signed-off-by: Iustin Pop <>...

8d239fa4 11/30/2012 03:54 pm Iustin Pop

Add types, parameters and the opcodes for networks

This completes the last missing opcode group. The only difficulty was
with the ip addresses, where we used simple strings to represent them
and (for IPv4) a few helpers to generate arbitrary instances;
otherwise, the patch is trivial....

a3f02317 11/30/2012 03:54 pm Iustin Pop

Complete the Test opcodes

This adds the OpTestAllocator, OpTestJqueue and OpTestDummy
opcodes. The OpTestAllocator seems to need some cleanup (on the Python
side), for now we implement it as is. As for the other two, while not
used in production, we should have full coverage for them as well....

a451dae2 11/30/2012 03:54 pm Iustin Pop

Complete the Tag opcodes and fix OpTestDelay missing param

The regexp in OpTagsSearch is loaded as is, without testing for
validity; the rest of the patch is trivial.

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

398e9066 11/30/2012 03:54 pm Iustin Pop

Add Group, OS and Backup opcodes

This also corrects a docstring in OpBackupExport on the Python side.

Signed-off-by: Iustin Pop <>
Reviewed-by: Helga Velroyen <>

c2d3219b 11/30/2012 03:54 pm Iustin Pop

Complete the instance OpCodes and parameters

Only the original instance opcodes (used in htools) are left
non-converted to only parameter style; they'll be cleaned up later,
once the htools codebase itself migrates to safer types.

Signed-off-by: Iustin Pop <>...

6d558717 11/30/2012 03:48 pm Iustin Pop

Add types and parameters for OpInstanceCreate

This is a "big" opcode, so sending it separately.

A few types needed changing, and a few parameters were renamed to make
it more clear which are cluster-level and which are instance-level
parameters.

Signed-off-by: Iustin Pop <>...

c7d249d0 11/21/2012 04:58 pm Iustin Pop

Convert a few existing opcode parameters to safer types

This does a partial conversion of existing opcodes to the new
non-empty string type, which is needed so that we don't add even more
opcodes without this safety net (and to have consistent "target_node",...

c66f09f5 11/21/2012 04:58 pm Iustin Pop

Bulk add of remaining cluster/node opcodes

These are tested for equivalence with the Python code using existing
tests. These tests are not perfect - for many "TDict" we simply send
empty dicts, as we don't have a way to generate proper data, but the
tests did catch many trivial errors during writing of this patch...

92f51573 11/20/2012 11:16 am Iustin Pop

Split OpCode.hs and add module for opcode parameters

Due to TemplateHaskell stage restrictions, we can't define parameters
in the same module as we're using them for TH, so we have to define
all module parameters in a separate module.

This patch therefore splits OpCodes.hs in two, adding that module and...

32a569fe 11/15/2012 12:20 pm Iustin Pop

Cleanup THH function use from built module namespace

Currently, THH.hs "injects" into the built code names of library
functions like Text.JSON.makeObj, Ganeti.JSON.fromObj, etc. built
directly from strings, via (e.g.)

varE (mkName "makeObj")

This means that the "makeObj" name must exist in the target module,...

d8e7c45e 11/12/2012 12:00 pm Iustin Pop

Convert tag objects to a safer type

Currently, we keep information about the "target" of a tag operation
in a data type similar to (TagKind, Maybe String). This is unsafe, as
nothing (at the type level) prevents us from accidentally having
(TagCluster, Just "instance1.example.com"), or (TagInstance, Nothing)....

3bebda52 11/08/2012 12:31 pm Dato Simó

OpCodes.hs: add OpTagsSet and OpTagsDel

Also, adjust comment to $(genOpCode) block to avoid repetition of
"only".

Signed-off-by: Dato Simó <>
Reviewed-by: Iustin Pop <>

367c4241 11/08/2012 12:31 pm Dato Simó

htools: move TagObject from Luxi.hs to OpCodes.hs

In addition to ReqQueryTags in Luxi.hs, the TagObject ADT is also
required for the "kind" attribute of OpTagsSet and OpTagsDel, which
are coming to OpCodes.hs next. Hence, we move TagObject there, and
adjust imports accordingly....

f3baf5ef 09/04/2012 04:51 pm Iustin Pop

Move JSON.hs and Compat.hs out from under HTools/

These two files are not htools-specific, so let's move them out of the
HTools subdirectory/module hierarchy and directly under Ganeti.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

4a1dc2bf 08/28/2012 06:04 pm Iustin Pop

Create a custom type for disk indices

While (again) trying to test Python/Haskell encoding interoperability,
I found another bug: the disk index is declared in Python as
ht.TPositiveInt, but in Haskell just as Int, so it can take negative
values too. Clearly we can do better, so let's add a wrapper type that...

a583ec5d 08/28/2012 06:03 pm Iustin Pop

OpCodes: build and export a list of all opcodes

This can be used for cross-checking with the Python code for
consistency on defined opcodes.

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>

b69be409 01/13/2012 03:16 pm Iustin Pop

Stop exporting JSON functionality from Utils.hs

This completes the Utils/JSON split started in commit f047f90f. The
import graph should be cleaner now.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

a1505857 12/07/2011 12:00 pm Iustin Pop

Convert opcode TH code to the use of Field type

This makes more explicit the field behaviour - previously an optional
field was detected via a "Maybe" constructor, and an optional one via
a "Just defval" one. With this, field behaviour become more explicit...

ebf38064 11/17/2011 03:49 pm Iustin Pop

htools: reindent the rest of the files

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

12c19659 10/03/2011 12:17 pm Iustin Pop

Use TemplateHaskell to generate opcode serialisation

This replaces the hand-coded opcode serialisation code with
auto-generation based on TemplateHaskell.

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>

6111e296 10/03/2011 12:17 pm Iustin Pop

Use TemplateHaskell to build the opID function

This replaces the hand-coded opID with one automatically generated
from the constructor names, similar to the way Python does it, except
it's done at compilation time as opposed to runtime.

Again, the code line delta does not favour this patch, but this...

e9aaa3c6 10/03/2011 12:17 pm Iustin Pop

Use TemplateHaskell instead of hand-coded instances

This patch replaces the current hard-coded JSON instances (all alike,
just manual conversion to/from string) with auto-generated code based
on Template Haskell
(http://www.haskell.org/haskellwiki/Template_Haskell)....

bbe9758d 07/22/2011 01:53 pm Iustin Pop

htools: add target_node member to migrate opcode

… and failover too. Not many changes otherwise except for
serialisation and unittests.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

525bfb36 07/13/2011 01:01 pm Iustin Pop

htools: docstring fixes and improvements

No code changes (except one definition being moved around in QC.hs)
are contained in this patch.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

10028866 04/07/2011 01:56 pm René Nussbaumer

htools: Make opcode naming consistent with Ganeti codebase

This patch just cleans up the htools codebase to make it more consistent
with the naming of the Ganeti codebase.

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

9470b6ee 04/07/2011 12:36 pm Iustin Pop

OpCodes.hs: make allow_failover optional

And default to False, like in the Python codebase.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

8d66f58a 04/06/2011 08:01 pm René Nussbaumer

htools: Use OpMigrateInstance with allow_failover option

Before hbal decided on the fly if an instance is migratable or not. As
we implemented failover fallback in commit d5cafd31456 we can start to
use that.

Signed-off-by: René Nussbaumer <>...

dc384cf0 03/17/2011 06:04 pm Iustin Pop

Merge remote branch 'htools/master'

  • htools/master: (605 commits)
    Update NEWS file for version 0.3.1
    Update copyright years in the man pages
    Remove obsolete env vars from the manpages
    Fix dist archive generation
    luxi backend: show attribute names in errors...