- Jun 23, 2010
-
-
Iustin Pop authored
For the type system, we want a slightly relaxed rule for constant naming, so we update the pylint rule. But the old _TPInt and _TNEString were not clear enough, so we expand them. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Currently, we have one structual validation for opcode attributes: the _OP_REQP, which checks that a given attribute is not 'None', and the rest of the checks are done at runtime. This means our type system has two types: None versus Not-None. We have been hit many times by small, trivial bugs in this area, and only a huge amount of unittest and/or hand-written checks would ensure that we cover all possibilities. This patch attempts to redress the needs for manual checks by introducing a micro-type system for the validation of the opcode attributes. What we lose, from the start, are the custom error messages (e.g. "Invalid reboot mode, choose one of …", or "The disk index must be a positive integer"). What we gain is the ability to express easily things as: - this parameter must be None or an int - this parameter must be a non-empty list - this parameter must be either none or a list of dictionaries with keys from the list of valid hypervisors and the values dictionaries with keys strings and values either None or strings; furthermore, the list must be non-empty These examples show that we have a composable (as opposed to just a few static types) system, and that we can nest it a few times (just for sanity; we could nest it up to stack depth). We also gain lots of ))))))), which is not that nice :) The current patch moves the existing _OP_REQP to the new framework, but if accepted, a lot more validations should move to it. In the end, we definitely should declare a type for all the opcode parameters (eventually moving _OP_REQP directly to opcodes.py and validating in the load/init case, and build __slots__ from it). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
For a few LUs, a few tests in, or even the whole CheckPrereq, can be moved to CheckArguments, as they don't touch state and only do a 'type' validation. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Currently, the base class LogicalUnit's CheckPrereq will raise NotImplementedError, which means that the child LUs have to implement it. However, many LUs don't actually have a need for this function (hence the many "pass" statements as the only body). By changing the base class behaviour, we can simplify many LUs. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
All code has been switched to the new-style LU… time for cleanup. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This patch removes the last use of the old-style OpEvacuateNode. It also fixes the dry-run mode for this RAPI resource - the dry-run parameter was not used at all before. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
The export mode is checked in two places with the exact same code… Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
When LogicalUnit.CheckArguments was introduced, not all code dealing with static argument checking was moved to it; many of these checks were left in ExpandNames. With time, most of them migrated, and this patch does the final cleanups. The patch is straightforward, with the exception of LURebootInstance, where an old style ParameterError exception is converted to the new OpPrereqError with ECODE_INVAL. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
LUExportInstance had two opcode fields set to default via both _CheckBooleanOpField and getattr(…, False). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
For this, we needed to extend the NodeImage class with a few extra variables, and we do a trick in the node verification where we pick the first node that returned valid OS data as the reference node, and then we compare all other nodes against it. The checks added are: - consistency of DiagnoseOS responses - multiple paths for an OS - inconsistent OS between a reference node and the current node Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Currently, we always list the api/variants, even if these are empty. This patch changes so that we make clear distiction for empty values ("[no variants]" versus "[variants: ]"), and we only list variants and parameters when the OS API indicates they should be supported. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This can be used to show the actual OS parameters and supported variants, in a global manner (rather than per-node as gnt-os diagnose). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This patch exports all the way from backend a new field ‘api_version’ which holds the list of support API versions, and exposes the (already computed) ‘parameters’ field. The patch also reworks (again) the field calculation in its Exec() method. All callers of LUDiagnoseOS pass in the 'valid' and 'variants' parameters, thus having the special casing of whether to compute or not the validity seems overkill. We move to a model where we always compute these across-nodes arguments, in order to simplify the code, and we also change the parameters set to be intersection of all node's values (which means a change in description will drop the parameter from the list of parameters). Additionally, we update scripts/gnt-os, which was broken for multi-dir OSes since the introduction of variants… Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Nothing special here, just copy/adjust the beparams code. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
We move the instance OS rename checks earlier, as we need to run the validation against the new OS, if it has changed. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
We use _GetUpdatedParams in order to support removal too, and then validate the OS parameters if the OS exists. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This patch adds controls for whether we recognize constants.VALUE_DEFAULT or not as a default value, and also adds dash-prefixes as another way for parameter removal. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
This is not yet complete, as it lacks proper support for instance import. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
The patch also modifies the instance RPC calls to fill the osparameters correctly with the cluster defaults, and exports the OS parameters in the instance/OS environment. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
While we only support the 'parameters' check today, the RPC call is generic enough that will be able to support other checks in the future. The backend function will both validate the parameters list (so as to make sure we don't pass in extra parameters that the OS validation doesn't care about) and the parameter values, via the OS verify script. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
The patch also modifies the internal methods in LUDiagnoseOS and gnt-os to deal with the format change of call_os_diagnose. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
The OS parameters code will bump the number of lines over 10K, and thus we need to silence this (no, we don't want any other module to become this big…, so we use a targeted silence only). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Guido Trotter authored
We don't need it anymore, since nobody waits on it. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
As for QueryJobs we rely on file updates rather than condition notification to acquire job changes. In order to do that we use the pyinotify module to watch files. This might make the client a bit slower (pending planned improvements, such as subscription-based WaitForJobChanges) but detaches it from the job execution. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
This is needed to convert waitforjobchanges to use inotify and the on-disk version and decouple it from the job queue lock. No replication to remote nodes is done, to keep the operation fast. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
We move from querying the in-memory version to loading all jobs from the disk. Since the jobs are written/deleted on disk in an atomic manner, we don't need to lock at all. Also, since we're just looking at the contents of a directory, we don't need to check that the job queue is "open". If some jobs are removed between when we listed them and us loading them, we need to be able to cope: if we were asked to load those jobs specifically, we must report the failure, but if we were just asked to "load all" we shall just not consider them as part of the "all" set, since they were deleted. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
This will be used to read a job file without having to deal with exceptions from _LoadJobFromDisk. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
Currently _LoadJobFromDisk archives job files it finds corrupted. Since we want to use it to load files without holding locks, this could cause a conflict: we just move the feature to _LoadJobUnlocked which is always called with the lock held. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Guido Trotter authored
If the repetition count is not passed or is passed as 0 we sleep exactly one time, otherwise we sleep "repeat" times and log in between. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jun 22, 2010
-
-
Iustin Pop authored
* devel-2.1: Add "adopt" to the allowed disk parameters Improve pylintrc for pylint 0.21+ Fix warnings with Python 2.6 Fix a small bug introduced in cf26a87a Fix the type of 'valid' attribute in LUDiagnoseOS Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Apollon Oikonomopoulos authored
"adopt" was missing from bd061c35, thus breaking disk adoption. Signed-off-by:
Apollon Oikonomopoulos <apollon@noc.grnet.gr> Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Iustin Pop authored
While we'll need to update the source files too, at least this change makes pylint 0.21 not fail on the current source tree. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
'format' is a new built-in function, and 'bytes' is a new builtin type. We rename this to make pylint happy (and remove potential bugs). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
Commit cf26a87a added a tiny typo, which would break non-FQDN arguments to modify node storage. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Iustin Pop authored
The update of the valid status in LUDiagnoseOS says: valid = valid and osl and osl[0][1] However, in Python, “True and []” (which '[]' we get for an invalid OS) will result in “[]”, and thus the valid field for an OS will be either True or an empty list. Which is not what we want… Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Jun 21, 2010
-
-
Apollon Oikonomopoulos authored
"adopt" was missing from bd061c35, thus breaking disk adoption. Signed-off-by:
Apollon Oikonomopoulos <apollon@noc.grnet.gr> Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-