Ejemplo n.º 1
0
def TestClusterOob():
    """out-of-band framework"""
    oob_path_exists = "/tmp/ganeti-qa-oob-does-exist-%s" % utils.NewUUID()

    AssertCommand(_CLUSTER_VERIFY)
    AssertCommand([
        "gnt-cluster", "modify", "--node-parameters",
        "oob_program=/tmp/ganeti-qa-oob-does-not-exist-%s" % utils.NewUUID()
    ])

    AssertCommand(_CLUSTER_VERIFY, fail=True)

    AssertCommand(["touch", oob_path_exists])
    AssertCommand(["chmod", "0400", oob_path_exists])
    AssertCommand(["gnt-cluster", "copyfile", oob_path_exists])

    try:
        AssertCommand([
            "gnt-cluster", "modify", "--node-parameters",
            "oob_program=%s" % oob_path_exists
        ])

        AssertCommand(_CLUSTER_VERIFY, fail=True)

        AssertCommand(["chmod", "0500", oob_path_exists])
        AssertCommand(["gnt-cluster", "copyfile", oob_path_exists])

        AssertCommand(_CLUSTER_VERIFY)
    finally:
        AssertCommand(["gnt-cluster", "command", "rm", oob_path_exists])

    AssertCommand(
        ["gnt-cluster", "modify", "--node-parameters", "oob_program="])
Ejemplo n.º 2
0
def TestClusterCommand():
    """gnt-cluster command"""
    uniqueid = utils.NewUUID()
    rfile = "/tmp/gnt%s" % utils.NewUUID()
    rcmd = utils.ShellQuoteArgs(["echo", "-n", uniqueid])
    cmd = utils.ShellQuoteArgs(
        ["gnt-cluster", "command",
         "%s >%s" % (rcmd, rfile)])

    try:
        AssertCommand(cmd)
        _CheckFileOnAllNodes(rfile, uniqueid)
    finally:
        _RemoveFileFromAllNodes(rfile)
Ejemplo n.º 3
0
 def __init__(self, **kwargs):
     objects.ConfdRequest.__init__(self, **kwargs)
     if not self.rsalt:
         self.rsalt = utils.NewUUID()
     if not self.protocol:
         self.protocol = constants.CONFD_PROTOCOL_VERSION
     if self.type not in constants.CONFD_REQS:
         raise errors.ConfdClientError("Invalid request type")
Ejemplo n.º 4
0
def TestClusterCopyfile():
    """gnt-cluster copyfile"""
    master = qa_config.GetMasterNode()

    uniqueid = utils.NewUUID()

    # Create temporary file
    f = tempfile.NamedTemporaryFile()
    f.write(uniqueid)
    f.flush()
    f.seek(0)

    # Upload file to master node
    testname = qa_utils.UploadFile(master.primary, f.name)
    try:
        # Copy file to all nodes
        AssertCommand(["gnt-cluster", "copyfile", testname])
        _CheckFileOnAllNodes(testname, uniqueid)
    finally:
        _RemoveFileFromAllNodes(testname)
Ejemplo n.º 5
0
from ganeti import compat
from ganeti import constants
from ganeti import ht
from ganeti import pathutils
from ganeti import vcluster

import colors
import qa_config
import qa_error

from qa_logging import FormatInfo

_MULTIPLEXERS = {}

#: Unique ID per QA run
_RUN_UUID = utils.NewUUID()

#: Path to the QA query output log file
_QA_OUTPUT = pathutils.GetLogFilename("qa-output")

(INST_DOWN, INST_UP) = range(500, 502)

(FIRST_ARG, RETURN_VALUE) = range(1000, 1002)


def _RaiseWithInfo(msg, error_desc):
    """Raises a QA error with the given content, and adds a message if present.

  """
    if msg:
        output = "%s: %s" % (msg, error_desc)
Ejemplo n.º 6
0
 def runTest(self):
     self.failUnless(utils.UUID_RE.match(utils.NewUUID()))
Ejemplo n.º 7
0
 def runTest(self):
     self.assertTrue(utils.UUID_RE.match(utils.NewUUID()))