LGTM, thanks!
On Thu, Oct 17, 2013 at 2:01 PM, Klaus Aehlig <[email protected]> wrote: > The subtle points of upgrading a cluster can only be found in > QA, so add a method to do so. A prerequisite is, that both > versions are installed on the test cluster. To have a realistic > scenario, instances are created on both versions. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > qa/qa-sample.json | 9 +++++++++ > qa/qa_cluster.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) > > diff --git a/qa/qa-sample.json b/qa/qa-sample.json > index b096ec5..bb0f561 100644 > --- a/qa/qa-sample.json > +++ b/qa/qa-sample.json > @@ -9,6 +9,15 @@ > "# Name used for renaming cluster": null, > "rename": "xen-test-rename", > > + "# Directory versions of the two installed versions of ganeti, for > upgrade testing." : null, > + "# dir-version is the version installed at the beginning, and the > majority of tests" : null, > + "# run in; the other-dir-version, which mus the adjacent, is the > version a detour" : null, > + "# is made through." : null, > + "dir-version": "2.11", > + "other-dir-version": "2.10", > + "# instances of the following types are to remain over upgrades." : > null, > + "upgrade-instances": ["drbd", "plain"], > + > "# Virtual cluster": null, > "#vcluster-master": "xen-vcluster", > "#vcluster-basedir": "/srv/ganeti/vcluster", > diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py > index 8ec20a1..744b081 100644 > --- a/qa/qa_cluster.py > +++ b/qa/qa_cluster.py > @@ -1133,6 +1133,53 @@ def TestClusterMasterFailover(): > failovermaster.Release() > > > +def TestUpgrade(): > + """Test gnt-cluster upgrade. > + > + This tests the 'gnt-cluster upgrade' command by flipping > + between the current and a different version of Ganeti. > + To also recover subtile points in the configuration up/down > + grades, instances are left over both upgrades. > + > + """ > + this_version = qa_config.get("dir-version") > + other_version = qa_config.get("other-dir-version") > + if this_version is None or other_version is None: > + print qa_utils.FormatInfo("Test not run, as versions not specified") > + return > + > + inst_creates = [] > + upgrade_instances = qa_config.get("upgrade-instances", []) > + live_instances = [] > + for (test_name, templ, cf, n) in qa_instance.available_instance_tests: > + if (qa_config.TestEnabled(test_name) and > + qa_config.IsTemplateSupported(templ) and > + templ in upgrade_instances): > + inst_creates.append((cf, n)) > + break > + > + for (cf, n) in inst_creates: > + nodes = qa_config.AcquireManyNodes(n) > + live_instances.append(cf(nodes)) > + > + AssertCommand(["gnt-cluster", "upgrade", "--to", other_version]) > + AssertCommand(["gnt-cluster", "verify"]) > + > + for instance in live_instances: > + qa_instance.TestInstanceRemove(instance) > + instance.Release() > + live_instances = [] > + for (cf, n) in inst_creates: > + nodes = qa_config.AcquireManyNodes(n) > + live_instances.append(cf(nodes)) > + > + AssertCommand(["gnt-cluster", "upgrade", "--to", this_version]) > + AssertCommand(["gnt-cluster", "verify"]) > + > + for instance in live_instances: > + qa_instance.TestInstanceRemove(instance) > + instance.Release() > + > def _NodeQueueDrainFile(node): > """Returns path to queue drain file for a node. > > -- > 1.8.4 > > -- -- Helga Velroyen | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
