On Thu, Oct 17, 2013 at 11:26 AM, 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 | 4 ++++ > qa/qa_cluster.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 55 insertions(+) > > diff --git a/qa/qa-sample.json b/qa/qa-sample.json > index b096ec5..6b0d3c1 100644 > --- a/qa/qa-sample.json > +++ b/qa/qa-sample.json > @@ -9,6 +9,10 @@ > "# 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": "2.11", > + "other-dir-version": "2.10", > + > "# 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..43a2b78 100644 > --- a/qa/qa_cluster.py > +++ b/qa/qa_cluster.py > @@ -1133,6 +1133,57 @@ 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. > + > + """ > + instance_prefs = [ > + ("instance-add-drbd-disk", constants.DT_DRBD8, > + qa_instance.TestInstanceAddWithDrbdDisk, 2), > + ("instance-add-plain-disk", constants.DT_PLAIN, > + qa_instance.TestInstanceAddWithPlainDisk, 1), > + ("instance-add-file", constants.DT_FILE, > + qa_instance.TestInstanceAddFile, 1), > + ] > Hm, this is basically taken from the general instance loop of the QA. I think it would be better to reuse that list, because this way, if we add a new disk template people are forced to think about 'does it make sense to run this in the upgrade test as well. If you want to exclude some disk templates from the test (as you only chose a subset here), I would rather do that with another QA config element 'upgrade-enabled-disk-templates' which can be used to pick the right ones from the list. > + > + thisVersion = qa_config.get("dir-version") > + otherVersion = qa_config.get("other-dir-version") > I'd name the versions something like 'upperVersion' and 'lowerVersion' since that includes the 'hierarchy' in the wording to make it consistent with the terms upgrading and downgrading. > + if thisVersion is None or otherVersion is None: > + print qa_utils.FormatInfo("Test not run, as versions not specified") > + return > Very nice that you test that, I think checking the prerequisites of QA tests gets forgotten often. > + > + create_fn, num_nodes, instance = None, 0, None > + for (test_name, templ, cf, n) in instance_prefs: > + if (qa_config.TestEnabled(test_name) and > + qa_config.IsTemplateSupported(templ)): > + create_fn, num_nodes = cf, n > + break > + > + if create_fn is not None: > + inodes = qa_config.AcquireManyNodes(num_nodes) > I suggest to not use 'inodes' here, but take the time to spell the i out or just use 'nodes' since it has nothing to do with inodes of a harddisk. > + instance = create_fn(inodes) > + > + AssertCommand(["gnt-cluster", "upgrade", "--to", otherVersion]) > + AssertCommand(["gnt-cluster", "verify"]) > + > + if create_fn is not None: > + qa_instance.TestInstanceRemove(instance) > + instance.Release() > + instance = create_fn(inodes) > I am wondering if it would make senste to have an additional instance that does not get killed and reborn between the up and downgrade to test if an instance can survive and up- and subsequent downgrade (in addition to the one that you create/destroy/create). > + > + AssertCommand(["gnt-cluster", "upgrade", "--to", thisVersion]) > + AssertCommand(["gnt-cluster", "verify"]) > + > + if create_fn is not None: > + qa_instance.TestInstanceRemove(instance) > + instance.Release() > + > + > def _NodeQueueDrainFile(node): > """Returns path to queue drain file for a node. > > -- > 1.8.4 > > Cheers, Helga -- -- 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
