Statistics
| Branch: | Tag: | Revision:

root / lib / opcodes.py @ 1338f2b4

History | View | Annotate | Download (19.1 kB)

1
#
2
#
3

    
4
# Copyright (C) 2006, 2007 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

    
21

    
22
"""OpCodes module
23

24
This module implements the data structures which define the cluster
25
operations - the so-called opcodes.
26

27
Every operation which modifies the cluster state is expressed via
28
opcodes.
29

30
"""
31

    
32
# this are practically structures, so disable the message about too
33
# few public methods:
34
# pylint: disable-msg=R0903
35

    
36

    
37
class BaseOpCode(object):
38
  """A simple serializable object.
39

40
  This object serves as a parent class for OpCode without any custom
41
  field handling.
42

43
  """
44
  __slots__ = []
45

    
46
  def __init__(self, **kwargs):
47
    """Constructor for BaseOpCode.
48

49
    The constructor takes only keyword arguments and will set
50
    attributes on this object based on the passed arguments. As such,
51
    it means that you should not pass arguments which are not in the
52
    __slots__ attribute for this class.
53

54
    """
55
    slots = self._all_slots()
56
    for key in kwargs:
57
      if key not in slots:
58
        raise TypeError("Object %s doesn't support the parameter '%s'" %
59
                        (self.__class__.__name__, key))
60
      setattr(self, key, kwargs[key])
61

    
62
  def __getstate__(self):
63
    """Generic serializer.
64

65
    This method just returns the contents of the instance as a
66
    dictionary.
67

68
    @rtype:  C{dict}
69
    @return: the instance attributes and their values
70

71
    """
72
    state = {}
73
    for name in self._all_slots():
74
      if hasattr(self, name):
75
        state[name] = getattr(self, name)
76
    return state
77

    
78
  def __setstate__(self, state):
79
    """Generic unserializer.
80

81
    This method just restores from the serialized state the attributes
82
    of the current instance.
83

84
    @param state: the serialized opcode data
85
    @type state:  C{dict}
86

87
    """
88
    if not isinstance(state, dict):
89
      raise ValueError("Invalid data to __setstate__: expected dict, got %s" %
90
                       type(state))
91

    
92
    for name in self._all_slots():
93
      if name not in state and hasattr(self, name):
94
        delattr(self, name)
95

    
96
    for name in state:
97
      setattr(self, name, state[name])
98

    
99
  @classmethod
100
  def _all_slots(cls):
101
    """Compute the list of all declared slots for a class.
102

103
    """
104
    slots = []
105
    for parent in cls.__mro__:
106
      slots.extend(getattr(parent, "__slots__", []))
107
    return slots
108

    
109

    
110
class OpCode(BaseOpCode):
111
  """Abstract OpCode.
112

113
  This is the root of the actual OpCode hierarchy. All clases derived
114
  from this class should override OP_ID.
115

116
  @cvar OP_ID: The ID of this opcode. This should be unique amongst all
117
               children of this class.
118
  @ivar dry_run: Whether the LU should be run in dry-run mode, i.e. just
119
                 the check steps
120

121
  """
122
  OP_ID = "OP_ABSTRACT"
123
  __slots__ = ["dry_run", "debug_level"]
124

    
125
  def __getstate__(self):
126
    """Specialized getstate for opcodes.
127

128
    This method adds to the state dictionary the OP_ID of the class,
129
    so that on unload we can identify the correct class for
130
    instantiating the opcode.
131

132
    @rtype:   C{dict}
133
    @return:  the state as a dictionary
134

135
    """
136
    data = BaseOpCode.__getstate__(self)
137
    data["OP_ID"] = self.OP_ID
138
    return data
139

    
140
  @classmethod
141
  def LoadOpCode(cls, data):
142
    """Generic load opcode method.
143

144
    The method identifies the correct opcode class from the dict-form
145
    by looking for a OP_ID key, if this is not found, or its value is
146
    not available in this module as a child of this class, we fail.
147

148
    @type data:  C{dict}
149
    @param data: the serialized opcode
150

151
    """
152
    if not isinstance(data, dict):
153
      raise ValueError("Invalid data to LoadOpCode (%s)" % type(data))
154
    if "OP_ID" not in data:
155
      raise ValueError("Invalid data to LoadOpcode, missing OP_ID")
156
    op_id = data["OP_ID"]
157
    op_class = None
158
    if op_id in OP_MAPPING:
159
      op_class = OP_MAPPING[op_id]
160
    else:
161
      raise ValueError("Invalid data to LoadOpCode: OP_ID %s unsupported" %
162
                       op_id)
163
    op = op_class()
164
    new_data = data.copy()
165
    del new_data["OP_ID"]
166
    op.__setstate__(new_data)
167
    return op
168

    
169
  def Summary(self):
170
    """Generates a summary description of this opcode.
171

172
    """
173
    # all OP_ID start with OP_, we remove that
174
    txt = self.OP_ID[3:]
175
    field_name = getattr(self, "OP_DSC_FIELD", None)
176
    if field_name:
177
      field_value = getattr(self, field_name, None)
178
      txt = "%s(%s)" % (txt, field_value)
179
    return txt
180

    
181

    
182
# cluster opcodes
183

    
184
class OpPostInitCluster(OpCode):
185
  """Post cluster initialization.
186

187
  This opcode does not touch the cluster at all. Its purpose is to run hooks
188
  after the cluster has been initialized.
189

190
  """
191
  OP_ID = "OP_CLUSTER_POST_INIT"
192
  __slots__ = []
193

    
194

    
195
class OpDestroyCluster(OpCode):
196
  """Destroy the cluster.
197

198
  This opcode has no other parameters. All the state is irreversibly
199
  lost after the execution of this opcode.
200

201
  """
202
  OP_ID = "OP_CLUSTER_DESTROY"
203
  __slots__ = []
204

    
205

    
206
class OpQueryClusterInfo(OpCode):
207
  """Query cluster information."""
208
  OP_ID = "OP_CLUSTER_QUERY"
209
  __slots__ = []
210

    
211

    
212
class OpVerifyCluster(OpCode):
213
  """Verify the cluster state.
214

215
  @type skip_checks: C{list}
216
  @ivar skip_checks: steps to be skipped from the verify process; this
217
                     needs to be a subset of
218
                     L{constants.VERIFY_OPTIONAL_CHECKS}; currently
219
                     only L{constants.VERIFY_NPLUSONE_MEM} can be passed
220

221
  """
222
  OP_ID = "OP_CLUSTER_VERIFY"
223
  __slots__ = ["skip_checks", "verbose", "error_codes",
224
               "debug_simulate_errors"]
225

    
226

    
227
class OpVerifyDisks(OpCode):
228
  """Verify the cluster disks.
229

230
  Parameters: none
231

232
  Result: a tuple of four elements:
233
    - list of node names with bad data returned (unreachable, etc.)
234
    - dict of node names with broken volume groups (values: error msg)
235
    - list of instances with degraded disks (that should be activated)
236
    - dict of instances with missing logical volumes (values: (node, vol)
237
      pairs with details about the missing volumes)
238

239
  In normal operation, all lists should be empty. A non-empty instance
240
  list (3rd element of the result) is still ok (errors were fixed) but
241
  non-empty node list means some node is down, and probably there are
242
  unfixable drbd errors.
243

244
  Note that only instances that are drbd-based are taken into
245
  consideration. This might need to be revisited in the future.
246

247
  """
248
  OP_ID = "OP_CLUSTER_VERIFY_DISKS"
249
  __slots__ = []
250

    
251

    
252
class OpRepairDiskSizes(OpCode):
253
  """Verify the disk sizes of the instances and fixes configuration
254
  mimatches.
255

256
  Parameters: optional instances list, in case we want to restrict the
257
  checks to only a subset of the instances.
258

259
  Result: a list of tuples, (instance, disk, new-size) for changed
260
  configurations.
261

262
  In normal operation, the list should be empty.
263

264
  @type instances: list
265
  @ivar instances: the list of instances to check, or empty for all instances
266

267
  """
268
  OP_ID = "OP_CLUSTER_REPAIR_DISK_SIZES"
269
  __slots__ = ["instances"]
270

    
271

    
272
class OpQueryConfigValues(OpCode):
273
  """Query cluster configuration values."""
274
  OP_ID = "OP_CLUSTER_CONFIG_QUERY"
275
  __slots__ = ["output_fields"]
276

    
277

    
278
class OpRenameCluster(OpCode):
279
  """Rename the cluster.
280

281
  @type name: C{str}
282
  @ivar name: The new name of the cluster. The name and/or the master IP
283
              address will be changed to match the new name and its IP
284
              address.
285

286
  """
287
  OP_ID = "OP_CLUSTER_RENAME"
288
  OP_DSC_FIELD = "name"
289
  __slots__ = ["name"]
290

    
291

    
292
class OpSetClusterParams(OpCode):
293
  """Change the parameters of the cluster.
294

295
  @type vg_name: C{str} or C{None}
296
  @ivar vg_name: The new volume group name or None to disable LVM usage.
297

298
  """
299
  OP_ID = "OP_CLUSTER_SET_PARAMS"
300
  __slots__ = [
301
    "vg_name",
302
    "enabled_hypervisors",
303
    "hvparams",
304
    "os_hvp",
305
    "beparams",
306
    "nicparams",
307
    "candidate_pool_size",
308
    "maintain_node_health",
309
    "uid_pool",
310
    ]
311

    
312

    
313
class OpRedistributeConfig(OpCode):
314
  """Force a full push of the cluster configuration.
315

316
  """
317
  OP_ID = "OP_CLUSTER_REDIST_CONF"
318
  __slots__ = []
319

    
320
# node opcodes
321

    
322
class OpRemoveNode(OpCode):
323
  """Remove a node.
324

325
  @type node_name: C{str}
326
  @ivar node_name: The name of the node to remove. If the node still has
327
                   instances on it, the operation will fail.
328

329
  """
330
  OP_ID = "OP_NODE_REMOVE"
331
  OP_DSC_FIELD = "node_name"
332
  __slots__ = ["node_name"]
333

    
334

    
335
class OpAddNode(OpCode):
336
  """Add a node to the cluster.
337

338
  @type node_name: C{str}
339
  @ivar node_name: The name of the node to add. This can be a short name,
340
                   but it will be expanded to the FQDN.
341
  @type primary_ip: IP address
342
  @ivar primary_ip: The primary IP of the node. This will be ignored when the
343
                    opcode is submitted, but will be filled during the node
344
                    add (so it will be visible in the job query).
345
  @type secondary_ip: IP address
346
  @ivar secondary_ip: The secondary IP of the node. This needs to be passed
347
                      if the cluster has been initialized in 'dual-network'
348
                      mode, otherwise it must not be given.
349
  @type readd: C{bool}
350
  @ivar readd: Whether to re-add an existing node to the cluster. If
351
               this is not passed, then the operation will abort if the node
352
               name is already in the cluster; use this parameter to 'repair'
353
               a node that had its configuration broken, or was reinstalled
354
               without removal from the cluster.
355

356
  """
357
  OP_ID = "OP_NODE_ADD"
358
  OP_DSC_FIELD = "node_name"
359
  __slots__ = ["node_name", "primary_ip", "secondary_ip", "readd"]
360

    
361

    
362
class OpQueryNodes(OpCode):
363
  """Compute the list of nodes."""
364
  OP_ID = "OP_NODE_QUERY"
365
  __slots__ = ["output_fields", "names", "use_locking"]
366

    
367

    
368
class OpQueryNodeVolumes(OpCode):
369
  """Get list of volumes on node."""
370
  OP_ID = "OP_NODE_QUERYVOLS"
371
  __slots__ = ["nodes", "output_fields"]
372

    
373

    
374
class OpQueryNodeStorage(OpCode):
375
  """Get information on storage for node(s)."""
376
  OP_ID = "OP_NODE_QUERY_STORAGE"
377
  __slots__ = [
378
    "nodes",
379
    "storage_type",
380
    "name",
381
    "output_fields",
382
    ]
383

    
384

    
385
class OpModifyNodeStorage(OpCode):
386
  """Modifies the properies of a storage unit"""
387
  OP_ID = "OP_NODE_MODIFY_STORAGE"
388
  __slots__ = [
389
    "node_name",
390
    "storage_type",
391
    "name",
392
    "changes",
393
    ]
394

    
395

    
396
class OpRepairNodeStorage(OpCode):
397
  """Repairs the volume group on a node."""
398
  OP_ID = "OP_REPAIR_NODE_STORAGE"
399
  OP_DSC_FIELD = "node_name"
400
  __slots__ = [
401
    "node_name",
402
    "storage_type",
403
    "name",
404
    "ignore_consistency",
405
    ]
406

    
407

    
408
class OpSetNodeParams(OpCode):
409
  """Change the parameters of a node."""
410
  OP_ID = "OP_NODE_SET_PARAMS"
411
  OP_DSC_FIELD = "node_name"
412
  __slots__ = [
413
    "node_name",
414
    "force",
415
    "master_candidate",
416
    "offline",
417
    "drained",
418
    "auto_promote",
419
    ]
420

    
421

    
422
class OpPowercycleNode(OpCode):
423
  """Tries to powercycle a node."""
424
  OP_ID = "OP_NODE_POWERCYCLE"
425
  OP_DSC_FIELD = "node_name"
426
  __slots__ = [
427
    "node_name",
428
    "force",
429
    ]
430

    
431

    
432
class OpEvacuateNode(OpCode):
433
  """Relocate secondary instances from a node."""
434
  OP_ID = "OP_NODE_EVACUATE"
435
  OP_DSC_FIELD = "node_name"
436
  __slots__ = [
437
    "node_name", "remote_node", "iallocator", "early_release",
438
    ]
439

    
440

    
441
class OpMigrateNode(OpCode):
442
  """Migrate all instances from a node."""
443
  OP_ID = "OP_NODE_MIGRATE"
444
  OP_DSC_FIELD = "node_name"
445
  __slots__ = [
446
    "node_name",
447
    "live",
448
    ]
449

    
450

    
451
class OpNodeEvacuationStrategy(OpCode):
452
  """Compute the evacuation strategy for a list of nodes."""
453
  OP_ID = "OP_NODE_EVAC_STRATEGY"
454
  OP_DSC_FIELD = "nodes"
455
  __slots__ = ["nodes", "iallocator", "remote_node"]
456

    
457

    
458
# instance opcodes
459

    
460
class OpCreateInstance(OpCode):
461
  """Create an instance."""
462
  OP_ID = "OP_INSTANCE_CREATE"
463
  OP_DSC_FIELD = "instance_name"
464
  __slots__ = [
465
    "instance_name",
466
    "os_type", "force_variant", "no_install",
467
    "pnode", "disk_template", "snode", "mode",
468
    "disks", "nics",
469
    "src_node", "src_path", "start", "identify_defaults",
470
    "wait_for_sync", "ip_check", "name_check",
471
    "file_storage_dir", "file_driver",
472
    "iallocator",
473
    "hypervisor", "hvparams", "beparams",
474
    "dry_run",
475
    ]
476

    
477

    
478
class OpReinstallInstance(OpCode):
479
  """Reinstall an instance's OS."""
480
  OP_ID = "OP_INSTANCE_REINSTALL"
481
  OP_DSC_FIELD = "instance_name"
482
  __slots__ = ["instance_name", "os_type", "force_variant"]
483

    
484

    
485
class OpRemoveInstance(OpCode):
486
  """Remove an instance."""
487
  OP_ID = "OP_INSTANCE_REMOVE"
488
  OP_DSC_FIELD = "instance_name"
489
  __slots__ = [
490
    "instance_name",
491
    "ignore_failures",
492
    "shutdown_timeout",
493
    ]
494

    
495

    
496
class OpRenameInstance(OpCode):
497
  """Rename an instance."""
498
  OP_ID = "OP_INSTANCE_RENAME"
499
  __slots__ = [
500
    "instance_name", "ignore_ip", "new_name",
501
    ]
502

    
503

    
504
class OpStartupInstance(OpCode):
505
  """Startup an instance."""
506
  OP_ID = "OP_INSTANCE_STARTUP"
507
  OP_DSC_FIELD = "instance_name"
508
  __slots__ = [
509
    "instance_name", "force", "hvparams", "beparams",
510
    ]
511

    
512

    
513
class OpShutdownInstance(OpCode):
514
  """Shutdown an instance."""
515
  OP_ID = "OP_INSTANCE_SHUTDOWN"
516
  OP_DSC_FIELD = "instance_name"
517
  __slots__ = ["instance_name", "timeout"]
518

    
519

    
520
class OpRebootInstance(OpCode):
521
  """Reboot an instance."""
522
  OP_ID = "OP_INSTANCE_REBOOT"
523
  OP_DSC_FIELD = "instance_name"
524
  __slots__ = [
525
    "instance_name", "reboot_type", "ignore_secondaries", "shutdown_timeout",
526
    ]
527

    
528

    
529
class OpReplaceDisks(OpCode):
530
  """Replace the disks of an instance."""
531
  OP_ID = "OP_INSTANCE_REPLACE_DISKS"
532
  OP_DSC_FIELD = "instance_name"
533
  __slots__ = [
534
    "instance_name", "remote_node", "mode", "disks", "iallocator",
535
    "early_release",
536
    ]
537

    
538

    
539
class OpFailoverInstance(OpCode):
540
  """Failover an instance."""
541
  OP_ID = "OP_INSTANCE_FAILOVER"
542
  OP_DSC_FIELD = "instance_name"
543
  __slots__ = [
544
    "instance_name", "ignore_consistency", "shutdown_timeout",
545
    ]
546

    
547

    
548
class OpMigrateInstance(OpCode):
549
  """Migrate an instance.
550

551
  This migrates (without shutting down an instance) to its secondary
552
  node.
553

554
  @ivar instance_name: the name of the instance
555

556
  """
557
  OP_ID = "OP_INSTANCE_MIGRATE"
558
  OP_DSC_FIELD = "instance_name"
559
  __slots__ = ["instance_name", "live", "cleanup"]
560

    
561

    
562
class OpMoveInstance(OpCode):
563
  """Move an instance.
564

565
  This move (with shutting down an instance and data copying) to an
566
  arbitrary node.
567

568
  @ivar instance_name: the name of the instance
569
  @ivar target_node: the destination node
570

571
  """
572
  OP_ID = "OP_INSTANCE_MOVE"
573
  OP_DSC_FIELD = "instance_name"
574
  __slots__ = [
575
    "instance_name", "target_node", "shutdown_timeout",
576
    ]
577

    
578

    
579
class OpConnectConsole(OpCode):
580
  """Connect to an instance's console."""
581
  OP_ID = "OP_INSTANCE_CONSOLE"
582
  OP_DSC_FIELD = "instance_name"
583
  __slots__ = ["instance_name"]
584

    
585

    
586
class OpActivateInstanceDisks(OpCode):
587
  """Activate an instance's disks."""
588
  OP_ID = "OP_INSTANCE_ACTIVATE_DISKS"
589
  OP_DSC_FIELD = "instance_name"
590
  __slots__ = ["instance_name", "ignore_size"]
591

    
592

    
593
class OpDeactivateInstanceDisks(OpCode):
594
  """Deactivate an instance's disks."""
595
  OP_ID = "OP_INSTANCE_DEACTIVATE_DISKS"
596
  OP_DSC_FIELD = "instance_name"
597
  __slots__ = ["instance_name"]
598

    
599

    
600
class OpRecreateInstanceDisks(OpCode):
601
  """Deactivate an instance's disks."""
602
  OP_ID = "OP_INSTANCE_RECREATE_DISKS"
603
  OP_DSC_FIELD = "instance_name"
604
  __slots__ = ["instance_name", "disks"]
605

    
606

    
607
class OpQueryInstances(OpCode):
608
  """Compute the list of instances."""
609
  OP_ID = "OP_INSTANCE_QUERY"
610
  __slots__ = ["output_fields", "names", "use_locking"]
611

    
612

    
613
class OpQueryInstanceData(OpCode):
614
  """Compute the run-time status of instances."""
615
  OP_ID = "OP_INSTANCE_QUERY_DATA"
616
  __slots__ = ["instances", "static"]
617

    
618

    
619
class OpSetInstanceParams(OpCode):
620
  """Change the parameters of an instance."""
621
  OP_ID = "OP_INSTANCE_SET_PARAMS"
622
  OP_DSC_FIELD = "instance_name"
623
  __slots__ = [
624
    "instance_name",
625
    "hvparams", "beparams", "force",
626
    "nics", "disks", "disk_template",
627
    "remote_node", "os_name", "force_variant",
628
    ]
629

    
630

    
631
class OpGrowDisk(OpCode):
632
  """Grow a disk of an instance."""
633
  OP_ID = "OP_INSTANCE_GROW_DISK"
634
  OP_DSC_FIELD = "instance_name"
635
  __slots__ = [
636
    "instance_name", "disk", "amount", "wait_for_sync",
637
    ]
638

    
639

    
640
# OS opcodes
641
class OpDiagnoseOS(OpCode):
642
  """Compute the list of guest operating systems."""
643
  OP_ID = "OP_OS_DIAGNOSE"
644
  __slots__ = ["output_fields", "names"]
645

    
646

    
647
# Exports opcodes
648
class OpQueryExports(OpCode):
649
  """Compute the list of exported images."""
650
  OP_ID = "OP_BACKUP_QUERY"
651
  __slots__ = ["nodes", "use_locking"]
652

    
653

    
654
class OpExportInstance(OpCode):
655
  """Export an instance."""
656
  OP_ID = "OP_BACKUP_EXPORT"
657
  OP_DSC_FIELD = "instance_name"
658
  __slots__ = [
659
    "instance_name", "target_node", "shutdown", "shutdown_timeout",
660
    ]
661

    
662

    
663
class OpRemoveExport(OpCode):
664
  """Remove an instance's export."""
665
  OP_ID = "OP_BACKUP_REMOVE"
666
  OP_DSC_FIELD = "instance_name"
667
  __slots__ = ["instance_name"]
668

    
669

    
670
# Tags opcodes
671
class OpGetTags(OpCode):
672
  """Returns the tags of the given object."""
673
  OP_ID = "OP_TAGS_GET"
674
  OP_DSC_FIELD = "name"
675
  __slots__ = ["kind", "name"]
676

    
677

    
678
class OpSearchTags(OpCode):
679
  """Searches the tags in the cluster for a given pattern."""
680
  OP_ID = "OP_TAGS_SEARCH"
681
  OP_DSC_FIELD = "pattern"
682
  __slots__ = ["pattern"]
683

    
684

    
685
class OpAddTags(OpCode):
686
  """Add a list of tags on a given object."""
687
  OP_ID = "OP_TAGS_SET"
688
  __slots__ = ["kind", "name", "tags"]
689

    
690

    
691
class OpDelTags(OpCode):
692
  """Remove a list of tags from a given object."""
693
  OP_ID = "OP_TAGS_DEL"
694
  __slots__ = ["kind", "name", "tags"]
695

    
696

    
697
# Test opcodes
698
class OpTestDelay(OpCode):
699
  """Sleeps for a configured amount of time.
700

701
  This is used just for debugging and testing.
702

703
  Parameters:
704
    - duration: the time to sleep
705
    - on_master: if true, sleep on the master
706
    - on_nodes: list of nodes in which to sleep
707

708
  If the on_master parameter is true, it will execute a sleep on the
709
  master (before any node sleep).
710

711
  If the on_nodes list is not empty, it will sleep on those nodes
712
  (after the sleep on the master, if that is enabled).
713

714
  As an additional feature, the case of duration < 0 will be reported
715
  as an execution error, so this opcode can be used as a failure
716
  generator. The case of duration == 0 will not be treated specially.
717

718
  """
719
  OP_ID = "OP_TEST_DELAY"
720
  OP_DSC_FIELD = "duration"
721
  __slots__ = ["duration", "on_master", "on_nodes"]
722

    
723

    
724
class OpTestAllocator(OpCode):
725
  """Allocator framework testing.
726

727
  This opcode has two modes:
728
    - gather and return allocator input for a given mode (allocate new
729
      or replace secondary) and a given instance definition (direction
730
      'in')
731
    - run a selected allocator for a given operation (as above) and
732
      return the allocator output (direction 'out')
733

734
  """
735
  OP_ID = "OP_TEST_ALLOCATOR"
736
  OP_DSC_FIELD = "allocator"
737
  __slots__ = [
738
    "direction", "mode", "allocator", "name",
739
    "mem_size", "disks", "disk_template",
740
    "os", "tags", "nics", "vcpus", "hypervisor",
741
    "evac_nodes",
742
    ]
743

    
744

    
745
OP_MAPPING = dict([(v.OP_ID, v) for v in globals().values()
746
                   if (isinstance(v, type) and issubclass(v, OpCode) and
747
                       hasattr(v, "OP_ID"))])