Revision 098c0958

b/daemons/ganeti-noded
63 63

  
64 64
    to handle the method; subclasses of Avatar are expected to
65 65
    implement methods of this naming convention.
66
    """
67 66

  
67
    """
68 68
    args = broker.unserialize(args, self)
69 69
    kw = broker.unserialize(kw, self)
70 70
    method = getattr(self, "perspective_%s" % message)
......
346 346
def createDaemon():
347 347
  """Detach a process from the controlling terminal and run it in the
348 348
  background as a daemon.
349

  
349 350
  """
350 351
  UMASK = 077
351 352
  WORKDIR = "/"
b/daemons/ganeti-watcher
195 195

  
196 196
  Methods:
197 197
    Restart(): issue a command to restart the represented machine.
198

  
198 199
  """
199 200
  def __init__(self, name, state):
200 201
    self.name = name
b/lib/backend.py
85 85
      - adds the ssh-key
86 86
      - sets the node id
87 87
      - sets the node status to installed
88
  """
89 88

  
89
  """
90 90
  f = open("/etc/ssh/ssh_host_rsa_key", 'w')
91 91
  f.write(rsa)
92 92
  f.close()
......
159 159
    memory_dom0 is the memory allocated for domain0 in MiB
160 160
    memory_free is the currently available (free) ram in MiB
161 161
    memory_total is the total number of ram in MiB
162
  """
163 162

  
163
  """
164 164
  outputarray = {}
165 165
  vginfo = _GetVGInfo(vgname)
166 166
  outputarray['vg_size'] = vginfo['vg_size']
......
192 192
    by ssh-execution of 'hostname', result compared against name in list.
193 193

  
194 194
  """
195

  
196 195
  result = {}
197 196

  
198 197
  if 'hypervisor' in what:
......
289 288
    A list of all running instances on the current node
290 289
    - instance1.example.com
291 290
    - instance2.example.com
292
  """
293 291

  
292
  """
294 293
  try:
295 294
    names = hypervisor.GetHypervisor().ListInstances()
296 295
  except errors.HypervisorError, err:
......
313 312
    memory: memory size of instance (int)
314 313
    state: xen state of instance (string)
315 314
    time: cpu time of instance (float)
316
  """
317 315

  
316
  """
318 317
  output = {}
319 318

  
320 319
  iinfo = hypervisor.GetHypervisor().GetInstanceInfo(instance)
......
341 340
    state: xen state of instance (string)
342 341
    time: cpu time of instance (float)
343 342
    vcpus: the number of cpus
344
  """
345 343

  
344
  """
346 345
  output = {}
347 346

  
348 347
  iinfo = hypervisor.GetHypervisor().GetAllInstancesInfo()
......
471 470

  
472 471
  Args:
473 472
    instance - name of instance to start.
474
  """
475 473

  
474
  """
476 475
  running_instances = GetInstanceList()
477 476

  
478 477
  if instance.name in running_instances:
......
495 494

  
496 495
  Args:
497 496
    instance - name of instance to shutdown.
498
  """
499 497

  
498
  """
500 499
  running_instances = GetInstanceList()
501 500

  
502 501
  if instance.name not in running_instances:
......
958 957

  
959 958
  Returns:
960 959
    a config entry for the actual lvm device snapshotted.
961
  """
962 960

  
961
  """
963 962
  if disk.children:
964 963
    if len(disk.children) == 1:
965 964
      # only one child, let's recurse on it
......
993 992

  
994 993
  Returns:
995 994
    True if successful, False otherwise.
996
  """
997 995

  
996
  """
998 997
  inst_os = OSFromDisk(instance.os)
999 998
  export_script = inst_os.export_script
1000 999

  
......
1050 1049

  
1051 1050
  Returns:
1052 1051
    False in case of error, True otherwise.
1053
  """
1054 1052

  
1053
  """
1055 1054
  destdir = os.path.join(constants.EXPORT_DIR, instance.name + ".new")
1056 1055
  finaldestdir = os.path.join(constants.EXPORT_DIR, instance.name)
1057 1056

  
......
1108 1107
    A serializable config file containing the export info.
1109 1108

  
1110 1109
  """
1111

  
1112 1110
  cff = os.path.join(dest, constants.EXPORT_CONF_FILE)
1113 1111

  
1114 1112
  config = objects.SerializableConfigParser()
......
1135 1133
    False in case of error, True otherwise.
1136 1134

  
1137 1135
  """
1138

  
1139 1136
  inst_os = OSFromDisk(instance.os)
1140 1137
  import_script = inst_os.import_script
1141 1138

  
......
1195 1192

  
1196 1193
def ListExports():
1197 1194
  """Return a list of exports currently available on this machine.
1195

  
1198 1196
  """
1199 1197
  if os.path.isdir(constants.EXPORT_DIR):
1200 1198
    return os.listdir(constants.EXPORT_DIR)
......
1210 1208

  
1211 1209
  Returns:
1212 1210
    False in case of error, True otherwise.
1213
  """
1214 1211

  
1212
  """
1215 1213
  target = os.path.join(constants.EXPORT_DIR, export)
1216 1214

  
1217 1215
  shutil.rmtree(target)
b/lib/bdev.py
80 80
  after assembly we'll have our correct major/minor.
81 81

  
82 82
  """
83

  
84 83
  STATUS_UNKNOWN = 0
85 84
  STATUS_EXISTING = 1
86 85
  STATUS_STANDBY = 2
......
321 320

  
322 321
    Returns:
323 322
      list of (free_space, name) with free_space in mebibytes
323

  
324 324
    """
325 325
    command = ["pvs", "--noheadings", "--nosuffix", "--units=m",
326 326
               "-opv_name,vg_name,pv_free,pv_attr", "--unbuffered",
......
451 451
    """Create a snapshot copy of an lvm block device.
452 452

  
453 453
    """
454

  
455 454
    snap_name = self._lv_name + ".snap"
456 455

  
457 456
    # remove existing snapshot if found
b/lib/cli.py
107 107

  
108 108
    commands: dictionary with special contents, see the design doc for
109 109
    cmdline handling
110

  
110 111
  """
111 112
  if len(argv) == 0:
112 113
    binary = "<command>"
b/lib/cmdlib.py
466 466
    ourselves in the post-run node list.
467 467

  
468 468
    """
469

  
470 469
    env = {"CLUSTER": self.op.cluster_name,
471 470
           "MASTER": self.hostname['hostname_full']}
472 471
    return env, [], [self.hostname['hostname_full']]
......
623 622
      node: name of the node to check
624 623
      file_list: required list of files
625 624
      local_cksum: dictionary of local files and their checksums
625

  
626 626
    """
627 627
    # compares ganeti version
628 628
    local_version = constants.PROTOCOL_VERSION
......
913 913
  """Check that mirrors are not degraded.
914 914

  
915 915
  """
916

  
917 916
  cfgw.SetDiskID(dev, node)
918 917

  
919 918
  result = True
......
986 985
    Any errors are signalled by raising errors.OpPrereqError.
987 986

  
988 987
    """
989

  
990 988
    node = self.cfg.GetNodeInfo(self.cfg.ExpandNodeName(self.op.node_name))
991 989
    if node is None:
992 990
      logger.Error("Error: Node '%s' is unknown." % self.op.node_name)
......
1441 1439
    master.
1442 1440

  
1443 1441
    """
1444

  
1445 1442
    #TODO: do not rely on gethostname returning the FQDN
1446 1443
    logger.Info("setting master to %s, old master: %s" %
1447 1444
                (self.new_master, self.old_master))
......
1924 1921
    """Computes the list of nodes and their attributes.
1925 1922

  
1926 1923
    """
1927

  
1928 1924
    instance_names = utils.NiceSort(self.cfg.GetInstanceList())
1929 1925
    instance_list = [self.cfg.GetInstanceInfo(iname) for iname
1930 1926
                     in instance_names]
......
2132 2128
  This always creates all devices.
2133 2129

  
2134 2130
  """
2135

  
2136 2131
  if device.children:
2137 2132
    for child in device.children:
2138 2133
      if not _CreateBlockDevOnPrimary(cfg, node, child):
......
3044 3039

  
3045 3040
  def Exec(self, feedback_fn):
3046 3041
    """Gather and return data"""
3047

  
3048 3042
    result = {}
3049 3043
    for instance in self.wanted_instances:
3050 3044
      remote_info = rpc.call_instance_info(instance.primary_node,
......
3096 3090
    """Compute and return the list of nodes.
3097 3091

  
3098 3092
    """
3099

  
3100 3093
    ilist = [self.cfg.GetInstanceInfo(iname) for iname
3101 3094
             in self.cfg.GetInstanceList()]
3102 3095
    result = []
b/lib/config.py
48 48

  
49 49

  
50 50
class ConfigWriter:
51
  """The interface to the cluster configuration"""
51
  """The interface to the cluster configuration.
52 52

  
53
  """
53 54
  def __init__(self, cfg_file=None, offline=False):
54 55
    self._config_data = None
55 56
    self._config_time = None
......
267 268
    """Mark the status of an instance to down in the configuration.
268 269

  
269 270
    """
270

  
271 271
    self._OpenConfig()
272 272

  
273 273
    if instance_name not in self._config_data.instances:
b/lib/errors.py
129 129

  
130 130
  """
131 131

  
132

  
132 133
class OpExecError(GenericError):
133 134
  """Error during OpCode execution.
134 135

  
135 136
  """
136 137

  
138

  
137 139
class OpCodeUnknown(GenericError):
138 140
  """Unknown opcode submitted.
139 141

  
......
142 144

  
143 145
  """
144 146

  
147

  
145 148
class HooksFailure(GenericError):
146 149
  """A generic hook failure.
147 150

  
......
149 152

  
150 153
  """
151 154

  
155

  
152 156
class HooksAbort(HooksFailure):
153 157
  """A required hook has failed.
154 158

  
......
159 163

  
160 164
  """
161 165

  
166

  
162 167
class UnitParseError(GenericError):
163 168
  """Unable to parse size unit.
164 169

  
b/lib/hypervisor.py
130 130
    """Create a Xen 3.0 config file.
131 131

  
132 132
    """
133

  
134 133
    config = StringIO()
135 134
    config.write("# this is autogenerated by Ganeti, please do not edit\n#\n")
136 135
    config.write("kernel = '/boot/vmlinuz-2.6-xenU'\n")
......
334 333
  a real virtualisation software installed.
335 334

  
336 335
  """
337

  
338 336
  _ROOT_DIR = "/var/run/ganeti-fake-hypervisor"
339 337

  
340 338
  def __init__(self):
b/lib/objects.py
285 285
      Otherwise, { 'nodename' : ['volume1', 'volume2', ...], ... }
286 286

  
287 287
    """
288

  
289 288
    if node == None:
290 289
      node = self.primary_node
291 290

  
b/lib/rpc.py
30 30
from twisted.internet.pollreactor import PollReactor
31 31

  
32 32
class ReReactor(PollReactor):
33
  """A re-startable Reactor implementation"""
33
  """A re-startable Reactor implementation.
34 34

  
35
  """
35 36
  def run(self, installSignalHandlers=1):
36 37
    """Custom run method.
37 38

  
b/lib/ssh.py
45 45
    `utils.RunResult` as for `utils.RunCmd()`
46 46

  
47 47
  """
48

  
49 48
  argv = ["ssh", "-q", "-oEscapeChar=none"]
50 49
  if batch:
51 50
    argv.append("-oBatchMode=yes")
b/lib/utils.py
156 156

  
157 157

  
158 158
def Unlock(name):
159
  """Unlock a given subsystem."""
159
  """Unlock a given subsystem.
160 160

  
161
  """
161 162
  lockfile = _GetLockFile(name)
162 163

  
163 164
  try:
......
182 183

  
183 184

  
184 185
def LockCleanup():
185
  """Remove all locks."""
186
  """Remove all locks.
186 187

  
188
  """
187 189
  for lock in _locksheld:
188 190
    Unlock(lock)
189 191

  
......
401 403
    - ip: IP addr
402 404
    - hostname_full: hostname fully qualified
403 405
    - hostname: hostname fully qualified (historic artifact)
404
  """
405 406

  
407
  """
406 408
  try:
407 409
    (fqdn, dummy, ipaddrs) = socket.gethostbyname_ex(hostname)
408 410
    ipaddr = ipaddrs[0]
......
452 454
     True if it does, false otherwise.
453 455

  
454 456
  """
455

  
456 457
  return os.path.isdir("/sys/class/net/%s/bridge" % bridge)
457 458

  
458 459

  
b/scripts/gnt-backup
38 38
    nothing
39 39

  
40 40
  """
41

  
42 41
  op = opcodes.OpQueryExports(nodes=opts.nodes)
43 42
  exports = SubmitOpCode(op)
44 43
  for node in exports:
......
83 82
    1 in case of error, 0 otherwise
84 83

  
85 84
  """
86

  
87 85
  instance = args[0]
88 86

  
89 87
  op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem,
90 88
                                disk_size=opts.size, swap_size=opts.swap,
91 89
                                disk_template=opts.disk_template,
92
                                mode=constants.INSTANCE_IMPORT, pnode=opts.node,
93
                                snode=opts.snode, vcpus=opts.vcpus,
90
                                mode=constants.INSTANCE_IMPORT,
91
                                pnode=opts.node, snode=opts.snode,
92
                                vcpus=opts.vcpus,
94 93
                                ip=opts.ip, bridge=opts.bridge, start=False,
95 94
                                src_node=opts.src_node, src_path=opts.src_dir,
96 95
                                wait_for_sync=opts.wait_for_sync)
......
136 135
              metavar="<dir>"),
137 136
  ]
138 137

  
139

  
140 138
commands = {
141 139
  'list': (PrintExportList, ARGS_NONE,
142 140
           [DEBUG_OPT,
b/scripts/gnt-cluster
51 51

  
52 52
  Args:
53 53
    opts - class with options as members
54

  
54 55
  """
55 56
  if not opts.yes_do_it:
56 57
    print ("Destroying a cluster is irreversibly. If you really want destroy"
b/scripts/gnt-instance
82 82
    node - node to run new instance on
83 83

  
84 84
  """
85

  
86 85
  instance = args[0]
87 86

  
88 87
  op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem,
......
333 332
  """Compute instance run-time status.
334 333

  
335 334
  """
336

  
337 335
  retcode = 0
338 336
  op = opcodes.OpQueryInstanceData(instances=args)
339 337
  result = SubmitOpCode(op)
......
435 433
              default=None, metavar="<bridge>")
436 434
  ]
437 435

  
438

  
439 436
commands = {
440 437
  'add': (AddInstance, ARGS_ONE, add_opts,
441 438
          "[opts...] <name>",

Also available in: Unified diff