Revision 60dd1473 lib/opcodes.py
b/lib/opcodes.py | ||
---|---|---|
158 | 158 |
op.__setstate__(new_data) |
159 | 159 |
return op |
160 | 160 |
|
161 |
def Summary(self): |
|
162 |
"""Generates a summary description of this opcode. |
|
163 |
|
|
164 |
""" |
|
165 |
# all OP_ID start with OP_, we remove that |
|
166 |
txt = self.OP_ID[3:] |
|
167 |
field_name = getattr(self, "OP_DSC_FIELD", None) |
|
168 |
if field_name: |
|
169 |
field_value = getattr(self, field_name, None) |
|
170 |
txt = "%s(%s)" % (txt, field_value) |
|
171 |
return txt |
|
172 |
|
|
161 | 173 |
|
162 | 174 |
class OpDestroyCluster(OpCode): |
163 | 175 |
"""Destroy the cluster. |
... | ... | |
231 | 243 |
|
232 | 244 |
""" |
233 | 245 |
OP_ID = "OP_CLUSTER_RENAME" |
246 |
OP_DSC_FIELD = "name" |
|
234 | 247 |
__slots__ = ["name"] |
235 | 248 |
|
236 | 249 |
|
... | ... | |
256 | 269 |
|
257 | 270 |
""" |
258 | 271 |
OP_ID = "OP_NODE_REMOVE" |
272 |
OP_DSC_FIELD = "node_name" |
|
259 | 273 |
__slots__ = ["node_name"] |
260 | 274 |
|
261 | 275 |
|
... | ... | |
282 | 296 |
|
283 | 297 |
""" |
284 | 298 |
OP_ID = "OP_NODE_ADD" |
299 |
OP_DSC_FIELD = "node_name" |
|
285 | 300 |
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd"] |
286 | 301 |
|
287 | 302 |
|
... | ... | |
302 | 317 |
class OpCreateInstance(OpCode): |
303 | 318 |
"""Create an instance.""" |
304 | 319 |
OP_ID = "OP_INSTANCE_CREATE" |
320 |
OP_DSC_FIELD = "instance_name" |
|
305 | 321 |
__slots__ = [ |
306 | 322 |
"instance_name", "mem_size", "disk_size", "os_type", "pnode", |
307 | 323 |
"disk_template", "snode", "swap_size", "mode", |
... | ... | |
317 | 333 |
class OpReinstallInstance(OpCode): |
318 | 334 |
"""Reinstall an instance's OS.""" |
319 | 335 |
OP_ID = "OP_INSTANCE_REINSTALL" |
336 |
OP_DSC_FIELD = "instance_name" |
|
320 | 337 |
__slots__ = ["instance_name", "os_type"] |
321 | 338 |
|
322 | 339 |
|
323 | 340 |
class OpRemoveInstance(OpCode): |
324 | 341 |
"""Remove an instance.""" |
325 | 342 |
OP_ID = "OP_INSTANCE_REMOVE" |
343 |
OP_DSC_FIELD = "instance_name" |
|
326 | 344 |
__slots__ = ["instance_name", "ignore_failures"] |
327 | 345 |
|
328 | 346 |
|
... | ... | |
335 | 353 |
class OpStartupInstance(OpCode): |
336 | 354 |
"""Startup an instance.""" |
337 | 355 |
OP_ID = "OP_INSTANCE_STARTUP" |
356 |
OP_DSC_FIELD = "instance_name" |
|
338 | 357 |
__slots__ = ["instance_name", "force", "extra_args"] |
339 | 358 |
|
340 | 359 |
|
341 | 360 |
class OpShutdownInstance(OpCode): |
342 | 361 |
"""Shutdown an instance.""" |
343 | 362 |
OP_ID = "OP_INSTANCE_SHUTDOWN" |
363 |
OP_DSC_FIELD = "instance_name" |
|
344 | 364 |
__slots__ = ["instance_name"] |
345 | 365 |
|
346 | 366 |
|
347 | 367 |
class OpRebootInstance(OpCode): |
348 | 368 |
"""Reboot an instance.""" |
349 | 369 |
OP_ID = "OP_INSTANCE_REBOOT" |
370 |
OP_DSC_FIELD = "instance_name" |
|
350 | 371 |
__slots__ = ["instance_name", "reboot_type", "extra_args", |
351 | 372 |
"ignore_secondaries" ] |
352 | 373 |
|
... | ... | |
354 | 375 |
class OpReplaceDisks(OpCode): |
355 | 376 |
"""Replace the disks of an instance.""" |
356 | 377 |
OP_ID = "OP_INSTANCE_REPLACE_DISKS" |
378 |
OP_DSC_FIELD = "instance_name" |
|
357 | 379 |
__slots__ = ["instance_name", "remote_node", "mode", "disks", "iallocator"] |
358 | 380 |
|
359 | 381 |
|
360 | 382 |
class OpFailoverInstance(OpCode): |
361 | 383 |
"""Failover an instance.""" |
362 | 384 |
OP_ID = "OP_INSTANCE_FAILOVER" |
385 |
OP_DSC_FIELD = "instance_name" |
|
363 | 386 |
__slots__ = ["instance_name", "ignore_consistency"] |
364 | 387 |
|
365 | 388 |
|
366 | 389 |
class OpConnectConsole(OpCode): |
367 | 390 |
"""Connect to an instance's console.""" |
368 | 391 |
OP_ID = "OP_INSTANCE_CONSOLE" |
392 |
OP_DSC_FIELD = "instance_name" |
|
369 | 393 |
__slots__ = ["instance_name"] |
370 | 394 |
|
371 | 395 |
|
372 | 396 |
class OpActivateInstanceDisks(OpCode): |
373 | 397 |
"""Activate an instance's disks.""" |
374 | 398 |
OP_ID = "OP_INSTANCE_ACTIVATE_DISKS" |
399 |
OP_DSC_FIELD = "instance_name" |
|
375 | 400 |
__slots__ = ["instance_name"] |
376 | 401 |
|
377 | 402 |
|
378 | 403 |
class OpDeactivateInstanceDisks(OpCode): |
379 | 404 |
"""Deactivate an instance's disks.""" |
380 | 405 |
OP_ID = "OP_INSTANCE_DEACTIVATE_DISKS" |
406 |
OP_DSC_FIELD = "instance_name" |
|
381 | 407 |
__slots__ = ["instance_name"] |
382 | 408 |
|
383 | 409 |
|
... | ... | |
396 | 422 |
class OpSetInstanceParams(OpCode): |
397 | 423 |
"""Change the parameters of an instance.""" |
398 | 424 |
OP_ID = "OP_INSTANCE_SET_PARAMS" |
425 |
OP_DSC_FIELD = "instance_name" |
|
399 | 426 |
__slots__ = [ |
400 | 427 |
"instance_name", "mem", "vcpus", "ip", "bridge", "mac", |
401 | 428 |
"kernel_path", "initrd_path", "hvm_boot_order", "hvm_acpi", |
... | ... | |
407 | 434 |
class OpGrowDisk(OpCode): |
408 | 435 |
"""Grow a disk of an instance.""" |
409 | 436 |
OP_ID = "OP_INSTANCE_GROW_DISK" |
437 |
OP_DSC_FIELD = "instance_name" |
|
410 | 438 |
__slots__ = ["instance_name", "disk", "amount"] |
411 | 439 |
|
412 | 440 |
|
... | ... | |
427 | 455 |
class OpExportInstance(OpCode): |
428 | 456 |
"""Export an instance.""" |
429 | 457 |
OP_ID = "OP_BACKUP_EXPORT" |
458 |
OP_DSC_FIELD = "instance_name" |
|
430 | 459 |
__slots__ = ["instance_name", "target_node", "shutdown"] |
431 | 460 |
|
432 | 461 |
|
433 | 462 |
class OpRemoveExport(OpCode): |
434 | 463 |
"""Remove an instance's export.""" |
435 | 464 |
OP_ID = "OP_BACKUP_REMOVE" |
465 |
OP_DSC_FIELD = "instance_name" |
|
436 | 466 |
__slots__ = ["instance_name"] |
437 | 467 |
|
438 | 468 |
|
... | ... | |
440 | 470 |
class OpGetTags(OpCode): |
441 | 471 |
"""Returns the tags of the given object.""" |
442 | 472 |
OP_ID = "OP_TAGS_GET" |
473 |
OP_DSC_FIELD = "name" |
|
443 | 474 |
__slots__ = ["kind", "name"] |
444 | 475 |
|
445 | 476 |
|
446 | 477 |
class OpSearchTags(OpCode): |
447 | 478 |
"""Searches the tags in the cluster for a given pattern.""" |
448 | 479 |
OP_ID = "OP_TAGS_SEARCH" |
480 |
OP_DSC_FIELD = "pattern" |
|
449 | 481 |
__slots__ = ["pattern"] |
450 | 482 |
|
451 | 483 |
|
... | ... | |
484 | 516 |
|
485 | 517 |
""" |
486 | 518 |
OP_ID = "OP_TEST_DELAY" |
519 |
OP_DSC_FIELD = "duration" |
|
487 | 520 |
__slots__ = ["duration", "on_master", "on_nodes"] |
488 | 521 |
|
489 | 522 |
|
... | ... | |
499 | 532 |
|
500 | 533 |
""" |
501 | 534 |
OP_ID = "OP_TEST_ALLOCATOR" |
535 |
OP_DSC_FIELD = "allocator" |
|
502 | 536 |
__slots__ = [ |
503 | 537 |
"direction", "mode", "allocator", "name", |
504 | 538 |
"mem_size", "disks", "disk_template", |
Also available in: Unified diff