#
#
-# Copyright (C) 2007 Google Inc.
+# Copyright (C) 2007, 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
import tempfile
from ganeti import constants
-from ganeti import bootstrap
from ganeti import utils
import qa_config
# Initialize cluster
cmd = ['gnt-cluster', 'init']
+ cmd.append("--primary-ip-version=%d" %
+ qa_config.get("primary_ip_version", 4))
+
if master.get('secondary', None):
cmd.append('--secondary-ip=%s' % master['secondary'])
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
+def TestClusterReservedLvs():
+ """gnt-cluster reserved lvs"""
+ master = qa_config.GetMasterNode()
+ CVERIFY = ['gnt-cluster', 'verify']
+ for rcode, cmd in [
+ (0, CVERIFY),
+ (0, ['gnt-cluster', 'modify', '--reserved-lvs', '']),
+ (0, ['lvcreate', '-L1G', '-nqa-test', 'xenvg']),
+ (1, CVERIFY),
+ (0, ['gnt-cluster', 'modify', '--reserved-lvs', 'qa-test,other-test']),
+ (0, CVERIFY),
+ (0, ['gnt-cluster', 'modify', '--reserved-lvs', 'qa-.*']),
+ (0, CVERIFY),
+ (0, ['gnt-cluster', 'modify', '--reserved-lvs', '']),
+ (1, CVERIFY),
+ (0, ['lvremove', '-f', 'xenvg/qa-test']),
+ (0, CVERIFY),
+ ]:
+ AssertEqual(StartSSH(master['primary'],
+ utils.ShellQuoteArgs(cmd)).wait(), rcode)
+
def TestClusterInfo():
"""gnt-cluster info"""
# Conflicting options
cmd = ["gnt-cluster", "renew-crypto", "--force",
- "--new-cluster-certificate", "--new-confd-hmac-key",
- "--new-rapi-certificate", "--rapi-certificate=/dev/null"]
- AssertNotEqual(StartSSH(master["primary"],
- utils.ShellQuoteArgs(cmd)).wait(), 0)
+ "--new-cluster-certificate", "--new-confd-hmac-key"]
+ conflicting = [
+ ["--new-rapi-certificate", "--rapi-certificate=/dev/null"],
+ ["--new-cluster-domain-secret", "--cluster-domain-secret=/dev/null"],
+ ]
+ for i in conflicting:
+ AssertNotEqual(StartSSH(master["primary"],
+ utils.ShellQuoteArgs(cmd + i)).wait(), 0)
# Invalid RAPI certificate
cmd = ["gnt-cluster", "renew-crypto", "--force",
# Ensure certificate doesn't cause "gnt-cluster verify" to complain
validity = constants.SSL_CERT_EXPIRATION_WARN * 3
- bootstrap.GenerateSelfSignedSslCert(fh.name, validity=validity)
+ utils.GenerateSelfSignedSslCert(fh.name, validity=validity)
tmpcert = qa_utils.UploadFile(master["primary"], fh.name)
try:
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
+ # Custom cluster domain secret
+ cds_fh = tempfile.NamedTemporaryFile()
+ cds_fh.write(utils.GenerateSecret())
+ cds_fh.write("\n")
+ cds_fh.flush()
+
+ tmpcds = qa_utils.UploadFile(master["primary"], cds_fh.name)
+ try:
+ cmd = ["gnt-cluster", "renew-crypto", "--force",
+ "--cluster-domain-secret=%s" % tmpcds]
+ AssertEqual(StartSSH(master["primary"],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+ finally:
+ cmd = ["rm", "-f", tmpcds]
+ AssertEqual(StartSSH(master["primary"],
+ utils.ShellQuoteArgs(cmd)).wait(), 0)
+
# Normal case
cmd = ["gnt-cluster", "renew-crypto", "--force",
"--new-cluster-certificate", "--new-confd-hmac-key",
- "--new-rapi-certificate"]
+ "--new-rapi-certificate", "--new-cluster-domain-secret"]
AssertEqual(StartSSH(master["primary"],
utils.ShellQuoteArgs(cmd)).wait(), 0)
parallel = options.get('burnin-in-parallel', False)
check_inst = options.get('burnin-check-instances', False)
do_rename = options.get('burnin-rename', '')
+ do_reboot = options.get('burnin-reboot', True)
+ reboot_types = options.get("reboot-types", constants.REBOOT_TYPES)
# Get as many instances as we need
instances = []
cmd.append('--http-check')
if do_rename:
cmd.append('--rename=%s' % do_rename)
+ if not do_reboot:
+ cmd.append('--no-reboot')
+ else:
+ cmd.append('--reboot-types=%s' % ",".join(reboot_types))
cmd += [inst['name'] for inst in instances]
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
def TestClusterMasterFailover():
- """gnt-cluster masterfailover"""
+ """gnt-cluster master-failover"""
master = qa_config.GetMasterNode()
failovermaster = qa_config.AcquireNode(exclude=master)
try:
- cmd = ['gnt-cluster', 'masterfailover']
+ cmd = ['gnt-cluster', 'master-failover']
AssertEqual(StartSSH(failovermaster['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
- cmd = ['gnt-cluster', 'masterfailover']
+ cmd = ['gnt-cluster', 'master-failover']
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
finally: