Commit 098c0958 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Comment formatting updates.

Reviewed-by: iustinp
parent b2fddf63
......@@ -63,8 +63,8 @@ class ServerObject(pb.Avatar):
to handle the method; subclasses of Avatar are expected to
implement methods of this naming convention.
"""
"""
args = broker.unserialize(args, self)
kw = broker.unserialize(kw, self)
method = getattr(self, "perspective_%s" % message)
......@@ -346,6 +346,7 @@ def main():
def createDaemon():
"""Detach a process from the controlling terminal and run it in the
background as a daemon.
"""
UMASK = 077
WORKDIR = "/"
......
......@@ -195,6 +195,7 @@ class Instance(object):
Methods:
Restart(): issue a command to restart the represented machine.
"""
def __init__(self, name, state):
self.name = name
......
......@@ -85,8 +85,8 @@ def AddNode(dsa, dsapub, rsa, rsapub, ssh, sshpub):
- adds the ssh-key
- sets the node id
- sets the node status to installed
"""
"""
f = open("/etc/ssh/ssh_host_rsa_key", 'w')
f.write(rsa)
f.close()
......@@ -159,8 +159,8 @@ def GetNodeInfo(vgname):
memory_dom0 is the memory allocated for domain0 in MiB
memory_free is the currently available (free) ram in MiB
memory_total is the total number of ram in MiB
"""
"""
outputarray = {}
vginfo = _GetVGInfo(vgname)
outputarray['vg_size'] = vginfo['vg_size']
......@@ -192,7 +192,6 @@ def VerifyNode(what):
by ssh-execution of 'hostname', result compared against name in list.
"""
result = {}
if 'hypervisor' in what:
......@@ -289,8 +288,8 @@ def GetInstanceList():
A list of all running instances on the current node
- instance1.example.com
- instance2.example.com
"""
"""
try:
names = hypervisor.GetHypervisor().ListInstances()
except errors.HypervisorError, err:
......@@ -313,8 +312,8 @@ def GetInstanceInfo(instance):
memory: memory size of instance (int)
state: xen state of instance (string)
time: cpu time of instance (float)
"""
"""
output = {}
iinfo = hypervisor.GetHypervisor().GetInstanceInfo(instance)
......@@ -341,8 +340,8 @@ def GetAllInstancesInfo():
state: xen state of instance (string)
time: cpu time of instance (float)
vcpus: the number of cpus
"""
"""
output = {}
iinfo = hypervisor.GetHypervisor().GetAllInstancesInfo()
......@@ -471,8 +470,8 @@ def StartInstance(instance, extra_args):
Args:
instance - name of instance to start.
"""
"""
running_instances = GetInstanceList()
if instance.name in running_instances:
......@@ -495,8 +494,8 @@ def ShutdownInstance(instance):
Args:
instance - name of instance to shutdown.
"""
"""
running_instances = GetInstanceList()
if instance.name not in running_instances:
......@@ -958,8 +957,8 @@ def SnapshotBlockDevice(disk):
Returns:
a config entry for the actual lvm device snapshotted.
"""
"""
if disk.children:
if len(disk.children) == 1:
# only one child, let's recurse on it
......@@ -993,8 +992,8 @@ def ExportSnapshot(disk, dest_node, instance):
Returns:
True if successful, False otherwise.
"""
"""
inst_os = OSFromDisk(instance.os)
export_script = inst_os.export_script
......@@ -1050,8 +1049,8 @@ def FinalizeExport(instance, snap_disks):
Returns:
False in case of error, True otherwise.
"""
"""
destdir = os.path.join(constants.EXPORT_DIR, instance.name + ".new")
finaldestdir = os.path.join(constants.EXPORT_DIR, instance.name)
......@@ -1108,7 +1107,6 @@ def ExportInfo(dest):
A serializable config file containing the export info.
"""
cff = os.path.join(dest, constants.EXPORT_CONF_FILE)
config = objects.SerializableConfigParser()
......@@ -1135,7 +1133,6 @@ def ImportOSIntoInstance(instance, os_disk, swap_disk, src_node, src_image):
False in case of error, True otherwise.
"""
inst_os = OSFromDisk(instance.os)
import_script = inst_os.import_script
......@@ -1195,6 +1192,7 @@ def ImportOSIntoInstance(instance, os_disk, swap_disk, src_node, src_image):
def ListExports():
"""Return a list of exports currently available on this machine.
"""
if os.path.isdir(constants.EXPORT_DIR):
return os.listdir(constants.EXPORT_DIR)
......@@ -1210,8 +1208,8 @@ def RemoveExport(export):
Returns:
False in case of error, True otherwise.
"""
"""
target = os.path.join(constants.EXPORT_DIR, export)
shutil.rmtree(target)
......
......@@ -80,7 +80,6 @@ class BlockDev(object):
after assembly we'll have our correct major/minor.
"""
STATUS_UNKNOWN = 0
STATUS_EXISTING = 1
STATUS_STANDBY = 2
......@@ -321,6 +320,7 @@ class LogicalVolume(BlockDev):
Returns:
list of (free_space, name) with free_space in mebibytes
"""
command = ["pvs", "--noheadings", "--nosuffix", "--units=m",
"-opv_name,vg_name,pv_free,pv_attr", "--unbuffered",
......@@ -451,7 +451,6 @@ class LogicalVolume(BlockDev):
"""Create a snapshot copy of an lvm block device.
"""
snap_name = self._lv_name + ".snap"
# remove existing snapshot if found
......
......@@ -107,6 +107,7 @@ def _ParseArgs(argv, commands):
commands: dictionary with special contents, see the design doc for
cmdline handling
"""
if len(argv) == 0:
binary = "<command>"
......
......@@ -466,7 +466,6 @@ class LUInitCluster(LogicalUnit):
ourselves in the post-run node list.
"""
env = {"CLUSTER": self.op.cluster_name,
"MASTER": self.hostname['hostname_full']}
return env, [], [self.hostname['hostname_full']]
......@@ -623,6 +622,7 @@ class LUVerifyCluster(NoHooksLU):
node: name of the node to check
file_list: required list of files
local_cksum: dictionary of local files and their checksums
"""
# compares ganeti version
local_version = constants.PROTOCOL_VERSION
......@@ -913,7 +913,6 @@ def _CheckDiskConsistency(cfgw, dev, node, on_primary):
"""Check that mirrors are not degraded.
"""
cfgw.SetDiskID(dev, node)
result = True
......@@ -986,7 +985,6 @@ class LURemoveNode(LogicalUnit):
Any errors are signalled by raising errors.OpPrereqError.
"""
node = self.cfg.GetNodeInfo(self.cfg.ExpandNodeName(self.op.node_name))
if node is None:
logger.Error("Error: Node '%s' is unknown." % self.op.node_name)
......@@ -1441,7 +1439,6 @@ class LUMasterFailover(LogicalUnit):
master.
"""
#TODO: do not rely on gethostname returning the FQDN
logger.Info("setting master to %s, old master: %s" %
(self.new_master, self.old_master))
......@@ -1924,7 +1921,6 @@ class LUQueryInstances(NoHooksLU):
"""Computes the list of nodes and their attributes.
"""
instance_names = utils.NiceSort(self.cfg.GetInstanceList())
instance_list = [self.cfg.GetInstanceInfo(iname) for iname
in instance_names]
......@@ -2132,7 +2128,6 @@ def _CreateBlockDevOnPrimary(cfg, node, device):
This always creates all devices.
"""
if device.children:
for child in device.children:
if not _CreateBlockDevOnPrimary(cfg, node, child):
......@@ -3044,7 +3039,6 @@ class LUQueryInstanceData(NoHooksLU):
def Exec(self, feedback_fn):
"""Gather and return data"""
result = {}
for instance in self.wanted_instances:
remote_info = rpc.call_instance_info(instance.primary_node,
......@@ -3096,7 +3090,6 @@ class LUQueryNodeData(NoHooksLU):
"""Compute and return the list of nodes.
"""
ilist = [self.cfg.GetInstanceInfo(iname) for iname
in self.cfg.GetInstanceList()]
result = []
......
......@@ -48,8 +48,9 @@ from ganeti import objects
class ConfigWriter:
"""The interface to the cluster configuration"""
"""The interface to the cluster configuration.
"""
def __init__(self, cfg_file=None, offline=False):
self._config_data = None
self._config_time = None
......@@ -267,7 +268,6 @@ class ConfigWriter:
"""Mark the status of an instance to down in the configuration.
"""
self._OpenConfig()
if instance_name not in self._config_data.instances:
......
......@@ -129,11 +129,13 @@ class OpPrereqError(GenericError):
"""
class OpExecError(GenericError):
"""Error during OpCode execution.
"""
class OpCodeUnknown(GenericError):
"""Unknown opcode submitted.
......@@ -142,6 +144,7 @@ class OpCodeUnknown(GenericError):
"""
class HooksFailure(GenericError):
"""A generic hook failure.
......@@ -149,6 +152,7 @@ class HooksFailure(GenericError):
"""
class HooksAbort(HooksFailure):
"""A required hook has failed.
......@@ -159,6 +163,7 @@ class HooksAbort(HooksFailure):
"""
class UnitParseError(GenericError):
"""Unable to parse size unit.
......
......@@ -130,7 +130,6 @@ class XenHypervisor(BaseHypervisor):
"""Create a Xen 3.0 config file.
"""
config = StringIO()
config.write("# this is autogenerated by Ganeti, please do not edit\n#\n")
config.write("kernel = '/boot/vmlinuz-2.6-xenU'\n")
......@@ -334,7 +333,6 @@ class FakeHypervisor(BaseHypervisor):
a real virtualisation software installed.
"""
_ROOT_DIR = "/var/run/ganeti-fake-hypervisor"
def __init__(self):
......
......@@ -285,7 +285,6 @@ class Instance(ConfigObject):
Otherwise, { 'nodename' : ['volume1', 'volume2', ...], ... }
"""
if node == None:
node = self.primary_node
......
......@@ -30,8 +30,9 @@ import os
from twisted.internet.pollreactor import PollReactor
class ReReactor(PollReactor):
"""A re-startable Reactor implementation"""
"""A re-startable Reactor implementation.
"""
def run(self, installSignalHandlers=1):
"""Custom run method.
......
......@@ -45,7 +45,6 @@ def SSHCall(hostname, user, command, batch=True, ask_key=False):
`utils.RunResult` as for `utils.RunCmd()`
"""
argv = ["ssh", "-q", "-oEscapeChar=none"]
if batch:
argv.append("-oBatchMode=yes")
......
......@@ -156,8 +156,9 @@ def Lock(name, max_retries=None, debug=False):
def Unlock(name):
"""Unlock a given subsystem."""
"""Unlock a given subsystem.
"""
lockfile = _GetLockFile(name)
try:
......@@ -182,8 +183,9 @@ def Unlock(name):
def LockCleanup():
"""Remove all locks."""
"""Remove all locks.
"""
for lock in _locksheld:
Unlock(lock)
......@@ -401,8 +403,8 @@ def LookupHostname(hostname):
- ip: IP addr
- hostname_full: hostname fully qualified
- hostname: hostname fully qualified (historic artifact)
"""
"""
try:
(fqdn, dummy, ipaddrs) = socket.gethostbyname_ex(hostname)
ipaddr = ipaddrs[0]
......@@ -452,7 +454,6 @@ def BridgeExists(bridge):
True if it does, false otherwise.
"""
return os.path.isdir("/sys/class/net/%s/bridge" % bridge)
......
......@@ -38,7 +38,6 @@ def PrintExportList(opts, args):
nothing
"""
op = opcodes.OpQueryExports(nodes=opts.nodes)
exports = SubmitOpCode(op)
for node in exports:
......@@ -83,14 +82,14 @@ def ImportInstance(opts, args):
1 in case of error, 0 otherwise
"""
instance = args[0]
op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem,
disk_size=opts.size, swap_size=opts.swap,
disk_template=opts.disk_template,
mode=constants.INSTANCE_IMPORT, pnode=opts.node,
snode=opts.snode, vcpus=opts.vcpus,
mode=constants.INSTANCE_IMPORT,
pnode=opts.node, snode=opts.snode,
vcpus=opts.vcpus,
ip=opts.ip, bridge=opts.bridge, start=False,
src_node=opts.src_node, src_path=opts.src_dir,
wait_for_sync=opts.wait_for_sync)
......@@ -136,7 +135,6 @@ import_opts = [
metavar="<dir>"),
]
commands = {
'list': (PrintExportList, ARGS_NONE,
[DEBUG_OPT,
......
......@@ -51,6 +51,7 @@ def DestroyCluster(opts, args):
Args:
opts - class with options as members
"""
if not opts.yes_do_it:
print ("Destroying a cluster is irreversibly. If you really want destroy"
......
......@@ -82,7 +82,6 @@ def AddInstance(opts, args):
node - node to run new instance on
"""
instance = args[0]
op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem,
......@@ -333,7 +332,6 @@ def ShowInstanceConfig(opts, args):
"""Compute instance run-time status.
"""
retcode = 0
op = opcodes.OpQueryInstanceData(instances=args)
result = SubmitOpCode(op)
......@@ -435,7 +433,6 @@ add_opts = [
default=None, metavar="<bridge>")
]
commands = {
'add': (AddInstance, ARGS_ONE, add_opts,
"[opts...] <name>",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment