On Sat, Jan 15, 2011 at 4:59 PM, Iustin Pop <[email protected]> wrote:
> From: Iustin Pop <[email protected]>
>
> Currently, we have two different namespaces for opcodes: the class
> name one and the OP_ID one. This has two downsides:
>
> - internally, people have to choose manually both an appropriate OP_ID
>  and a class name; sometimes these are equal (6 cases), in other
>  cases not (55 times): a big proportion are just exchanged word
>  (OpAaBb becomes OP_BB_AA), and some other times they are just
>  different
>
> - clients of Ganeti see both namespaces, without any method to
>  match them: one submits an OpVerifyCluster, then does a job poll for
>  that, and the job data has OP_ID: OP_CLUSTER_VERIFY
>
> - exposing the opcode interface over RAPI, or implementing another
>  language binding to ganeti, would have to either duplicate both
>  namespaces, or use different opcode names than in Ganeti proper,
>  which both are bad options
>
> In order to improve the situation, we move to a single, unified name
> space. Since the OP_ID is that all clients of Ganeti see (via job
> query), and the class name is only visible to the ones using the
> actual opcode.py module, we standardise on the OP_ID.
>
> The conversion is done as follows:
>
> 1. Rename all classes to the new name computed from OP_ID as follows:
>  re.sub("_[a-z]", lambda m: m.group(0)[1:].upper(), opid.capitalize())
>
> 2. Add an assert that the names and IDs are consistent
>
> 3. Drop the names, and drop the above assert
>
> Notes:
>
> - passed all make check/lint tests
> - passed a Xen burning test on 2 nodes
> - passed a quick QA
> - I also renamed opcodes in the old design docs; the rationale is that
>  people reading them now, even if they are old, would rather see the
>  correct names, rather than trying to find out where OpVerifyCluster
>  went
>
>
> Iustin Pop (58):
>  Fix the OP_ID of OpAssignGroupNodes
>  Rename OpExportInstance and LUExportInstance
>  Rename OpPrepareExport and LUPrepareExport
>  Rename OpQueryExports and LUQueryExports
>  Rename OpRemoveExport and LURemoveExport
>  Rename OpQueryConfigValues and LUQueryConfigValues
>  Rename OpDestroyCluster and LUDestroyCluster
>  Rename OpPostInitCluster and LUPostInitCluster
>  Rename OpQueryClusterInfo and LUQueryClusterInfo
>  Rename OpRedistributeConfig and LURedistributeConfig
>  Rename OpRenameCluster and LURenameCluster
>  Rename OpRepairDiskSizes and LURepairDiskSizes
>  Rename OpSetClusterParams and LUSetClusterParams
>  Rename OpVerifyCluster and LUVerifyCluster
>  Rename OpVerifyDisks and LUVerifyDisks
>  Rename OpAddGroup and LUAddGroup
>  Rename OpAssignGroupNodes and LUAssignGroupNodes
>  Rename OpQueryGroups and LUQueryGroups
>  Rename OpRemoveGroup and LURemoveGroup
>  Rename OpRenameGroup and LURenameGroup
>  Rename OpSetGroupParams and LUSetGroupParams
>  Rename OpActivateInstanceDisks and LUActivateInstanceDisks
>  Rename OpConnectConsole and LUConnectConsole
>  Rename OpCreateInstance and LUCreateInstance
>  Rename OpDeactivateInstanceDisks and LUDeactivateInstanceDisks
>  Rename OpFailoverInstance and LUFailoverInstance
>  Rename OpGrowDisk and LUGrowDisk
>  Rename OpMigrateInstance and LUMigrateInstance
>  Rename OpMoveInstance and LUMoveInstance
>  Rename OpQueryInstances and LUQueryInstances
>  Rename OpQueryInstanceData and LUQueryInstanceData
>  Rename OpRebootInstance and LURebootInstance
>  Rename OpRecreateInstanceDisks and LURecreateInstanceDisks
>  Rename OpReinstallInstance and LUReinstallInstance
>  Rename OpRemoveInstance and LURemoveInstance
>  Rename OpRenameInstance and LURenameInstance
>  Rename OpReplaceDisks and LUReplaceDisks
>  Rename OpSetInstanceParams and LUSetInstanceParams
>  Rename OpShutdownInstance and LUShutdownInstance
>  Rename OpStartupInstance and LUStartupInstance
>  Rename OpAddNode and LUAddNode
>  Rename OpNodeEvacuationStrategy and LUNodeEvacuationStrategy
>  Rename OpMigrateNode and LUMigrateNode
>  Rename OpModifyNodeStorage and LUModifyNodeStorage
>  Rename OpPowercycleNode and LUPowercycleNode
>  Rename OpQueryNodes and LUQueryNodes
>  Rename OpQueryNodeVolumes and LUQueryNodeVolumes
>  Rename OpQueryNodeStorage and LUQueryNodeStorage
>  Rename OpRemoveNode and LURemoveNode
>  Rename OpSetNodeParams and LUSetNodeParams
>  Rename OpDiagnoseOS and LUDiagnoseOS
>  Rename OpDelTags and LUDelTags
>  Rename OpGetTags and LUGetTags
>  Rename OpSearchTags and LUSearchTags
>  Rename OpAddTags and LUAddTags
>  Rename OpTestJobqueue and LUTestJobqueue
>  Check consistency of the class names and OP_ID
>  Remove hard-coded OP_ID definitions
>
>  NEWS                                  |    4 +-
>  doc/design-2.0.rst                    |    4 +-
>  doc/design-2.1.rst                    |    4 +-
>  doc/design-2.2.rst                    |   14 +-
>  doc/design-2.3.rst                    |    4 +-
>  lib/cli.py                            |    6 +-
>  lib/client/gnt_backup.py              |   16 ++--
>  lib/client/gnt_cluster.py             |   22 ++--
>  lib/client/gnt_debug.py               |   34 +++---
>  lib/client/gnt_group.py               |   10 +-
>  lib/client/gnt_instance.py            |   53 ++++----
>  lib/client/gnt_node.py                |   36 +++---
>  lib/client/gnt_os.py                  |    8 +-
>  lib/cmdlib.py                         |  124 +++++++++---------
>  lib/opcodes.py                        |  218 
> ++++++++++++++-------------------
>  lib/rapi/baserlib.py                  |    4 +-
>  lib/rapi/rlib2.py                     |  118 +++++++++---------
>  lib/server/masterd.py                 |   20 ++--
>  lib/utils/x509.py                     |    2 +-
>  lib/watcher/__init__.py               |   18 ++--
>  qa/qa_rapi.py                         |    2 +-
>  test/ganeti.cmdlib_unittest.py        |   23 ++--
>  test/ganeti.jqueue_unittest.py        |    6 +-
>  test/ganeti.opcodes_unittest.py       |   41 +++----
>  test/ganeti.rapi.baserlib_unittest.py |   31 +++---
>  test/ganeti.rapi.rlib2_unittest.py    |   28 ++--
>  tools/burnin                          |   87 +++++++-------
>  27 files changed, 451 insertions(+), 486 deletions(-)
>
> --
> 1.7.2.3

LGTM, thanks

>

Reply via email to