This file is indexed.

/usr/share/doc/ganeti/html/hooks.html is in ganeti-doc 2.16.0~rc2-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Ganeti customisation using hooks &#8212; Ganeti 2.16.0~rc2 documentation</title>
    <link rel="stylesheet" href="_static/style.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '2.16.0~rc2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Ganeti automatic instance allocation" href="iallocator.html" />
    <link rel="prev" title="Glossary" href="glossary.html" /> 
  </head>
  <body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="iallocator.html" title="Ganeti automatic instance allocation"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="glossary.html" title="Glossary"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Ganeti 2.16.0~rc2 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="ganeti-customisation-using-hooks">
<h1><a class="toc-backref" href="#id1">Ganeti customisation using hooks</a><a class="headerlink" href="#ganeti-customisation-using-hooks" title="Permalink to this headline"></a></h1>
<p>Documents Ganeti version 2.16</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#ganeti-customisation-using-hooks" id="id1">Ganeti customisation using hooks</a><ul>
<li><a class="reference internal" href="#introduction" id="id2">Introduction</a></li>
<li><a class="reference internal" href="#organisation" id="id3">Organisation</a><ul>
<li><a class="reference internal" href="#pre-scripts" id="id4"><em>pre</em> scripts</a></li>
<li><a class="reference internal" href="#post-scripts" id="id5"><em>post</em> scripts</a></li>
<li><a class="reference internal" href="#naming" id="id6">Naming</a></li>
<li><a class="reference internal" href="#order-of-execution" id="id7">Order of execution</a></li>
<li><a class="reference internal" href="#execution-environment" id="id8">Execution environment</a></li>
</ul>
</li>
<li><a class="reference internal" href="#operation-list" id="id9">Operation list</a><ul>
<li><a class="reference internal" href="#node-operations" id="id10">Node operations</a><ul>
<li><a class="reference internal" href="#op-node-add" id="id11">OP_NODE_ADD</a></li>
<li><a class="reference internal" href="#op-node-remove" id="id12">OP_NODE_REMOVE</a></li>
<li><a class="reference internal" href="#op-node-set-params" id="id13">OP_NODE_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-node-migrate" id="id14">OP_NODE_MIGRATE</a></li>
</ul>
</li>
<li><a class="reference internal" href="#node-group-operations" id="id15">Node group operations</a><ul>
<li><a class="reference internal" href="#op-group-add" id="id16">OP_GROUP_ADD</a></li>
<li><a class="reference internal" href="#op-group-set-params" id="id17">OP_GROUP_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-group-remove" id="id18">OP_GROUP_REMOVE</a></li>
<li><a class="reference internal" href="#op-group-rename" id="id19">OP_GROUP_RENAME</a></li>
<li><a class="reference internal" href="#op-group-evacuate" id="id20">OP_GROUP_EVACUATE</a></li>
</ul>
</li>
<li><a class="reference internal" href="#network-operations" id="id21">Network operations</a><ul>
<li><a class="reference internal" href="#op-network-add" id="id22">OP_NETWORK_ADD</a></li>
<li><a class="reference internal" href="#op-network-remove" id="id23">OP_NETWORK_REMOVE</a></li>
<li><a class="reference internal" href="#op-network-connect" id="id24">OP_NETWORK_CONNECT</a></li>
<li><a class="reference internal" href="#op-network-disconnect" id="id25">OP_NETWORK_DISCONNECT</a></li>
<li><a class="reference internal" href="#op-network-set-params" id="id26">OP_NETWORK_SET_PARAMS</a></li>
</ul>
</li>
<li><a class="reference internal" href="#instance-operations" id="id27">Instance operations</a><ul>
<li><a class="reference internal" href="#op-instance-create" id="id28">OP_INSTANCE_CREATE</a></li>
<li><a class="reference internal" href="#op-instance-reinstall" id="id29">OP_INSTANCE_REINSTALL</a></li>
<li><a class="reference internal" href="#op-backup-export" id="id30">OP_BACKUP_EXPORT</a></li>
<li><a class="reference internal" href="#op-instance-startup" id="id31">OP_INSTANCE_STARTUP</a></li>
<li><a class="reference internal" href="#op-instance-shutdown" id="id32">OP_INSTANCE_SHUTDOWN</a></li>
<li><a class="reference internal" href="#op-instance-reboot" id="id33">OP_INSTANCE_REBOOT</a></li>
<li><a class="reference internal" href="#op-instance-set-params" id="id34">OP_INSTANCE_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-instance-failover" id="id35">OP_INSTANCE_FAILOVER</a></li>
<li><a class="reference internal" href="#op-instance-migrate" id="id36">OP_INSTANCE_MIGRATE</a></li>
<li><a class="reference internal" href="#op-instance-remove" id="id37">OP_INSTANCE_REMOVE</a></li>
<li><a class="reference internal" href="#op-instance-grow-disk" id="id38">OP_INSTANCE_GROW_DISK</a></li>
<li><a class="reference internal" href="#op-instance-rename" id="id39">OP_INSTANCE_RENAME</a></li>
<li><a class="reference internal" href="#op-instance-move" id="id40">OP_INSTANCE_MOVE</a></li>
<li><a class="reference internal" href="#op-instance-recreate-disks" id="id41">OP_INSTANCE_RECREATE_DISKS</a></li>
<li><a class="reference internal" href="#op-instance-replace-disks" id="id42">OP_INSTANCE_REPLACE_DISKS</a></li>
<li><a class="reference internal" href="#op-instance-change-group" id="id43">OP_INSTANCE_CHANGE_GROUP</a></li>
</ul>
</li>
<li><a class="reference internal" href="#cluster-operations" id="id44">Cluster operations</a><ul>
<li><a class="reference internal" href="#op-cluster-post-init" id="id45">OP_CLUSTER_POST_INIT</a></li>
<li><a class="reference internal" href="#op-cluster-destroy" id="id46">OP_CLUSTER_DESTROY</a></li>
<li><a class="reference internal" href="#op-cluster-verify-group" id="id47">OP_CLUSTER_VERIFY_GROUP</a></li>
<li><a class="reference internal" href="#op-cluster-rename" id="id48">OP_CLUSTER_RENAME</a></li>
<li><a class="reference internal" href="#op-cluster-set-params" id="id49">OP_CLUSTER_SET_PARAMS</a></li>
<li><a class="reference internal" href="#virtual-operation-op-cluster-ip-turnup" id="id50">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNUP</span></code></a></li>
<li><a class="reference internal" href="#virtual-operation-op-cluster-ip-turndown" id="id51">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNDOWN</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#obsolete-operations" id="id52">Obsolete operations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#environment-variables" id="id53">Environment variables</a><ul>
<li><a class="reference internal" href="#common-variables" id="id54">Common variables</a></li>
<li><a class="reference internal" href="#specialised-variables" id="id55">Specialised variables</a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples" id="id56">Examples</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id2">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>In order to allow customisation of operations, Ganeti runs scripts in
sub-directories of <code class="docutils literal"><span class="pre">&#64;SYSCONFDIR&#64;/ganeti/hooks</span></code>. These sub-directories
are named <code class="docutils literal"><span class="pre">$hook-$phase.d</span></code>, where <code class="docutils literal"><span class="pre">$phase</span></code> is either <code class="docutils literal"><span class="pre">pre</span></code> or
<code class="docutils literal"><span class="pre">post</span></code> and <code class="docutils literal"><span class="pre">$hook</span></code> matches the directory name given for a hook (e.g.
<code class="docutils literal"><span class="pre">cluster-verify-post.d</span></code> or <code class="docutils literal"><span class="pre">node-add-pre.d</span></code>).</p>
<p>This is similar to the <code class="docutils literal"><span class="pre">/etc/network/</span></code> structure present in Debian
for network interface handling.</p>
</div>
<div class="section" id="organisation">
<h2><a class="toc-backref" href="#id3">Organisation</a><a class="headerlink" href="#organisation" title="Permalink to this headline"></a></h2>
<p>For every operation, two sets of scripts are run:</p>
<ul class="simple">
<li>pre phase (for authorization/checking)</li>
<li>post phase (for logging)</li>
</ul>
<p>Also, for each operation, the scripts are run on one or more nodes,
depending on the operation type.</p>
<p>Note that, even though we call them scripts, we are actually talking
about any executable.</p>
<div class="section" id="pre-scripts">
<h3><a class="toc-backref" href="#id4"><em>pre</em> scripts</a><a class="headerlink" href="#pre-scripts" title="Permalink to this headline"></a></h3>
<p>The <em>pre</em> scripts have a definite target: to check that the operation
is allowed given the site-specific constraints. You could have, for
example, a rule that says every new instance is required to exists in
a database; to implement this, you could write a script that checks
the new instance parameters against your database.</p>
<p>The objective of these scripts should be their return code (zero or
non-zero for success and failure). However, if they modify the
environment in any way, they should be idempotent, as failed
executions could be restarted and thus the script(s) run again with
exactly the same parameters.</p>
<p>Note that if a node is unreachable at the time a hooks is run, this
will not be interpreted as a deny for the execution. In other words,
only an actual error returned from a script will cause abort, and not
an unreachable node.</p>
<p>Therefore, if you want to guarantee that a hook script is run and
denies an action, it’s best to put it on the master node.</p>
</div>
<div class="section" id="post-scripts">
<h3><a class="toc-backref" href="#id5"><em>post</em> scripts</a><a class="headerlink" href="#post-scripts" title="Permalink to this headline"></a></h3>
<p>These scripts should do whatever you need as a reaction to the
completion of an operation. Their return code is not checked (but
logged), and they should not depend on the fact that the <em>pre</em> scripts
have been run.</p>
</div>
<div class="section" id="naming">
<h3><a class="toc-backref" href="#id6">Naming</a><a class="headerlink" href="#naming" title="Permalink to this headline"></a></h3>
<p>The allowed names for the scripts consist of (similar to <em>run-parts</em>)
upper and lower case, digits, underscores and hyphens. In other words,
the regexp <code class="docutils literal"><span class="pre">^[a-zA-Z0-9_-]+$</span></code>. Also, non-executable scripts will be
ignored.</p>
</div>
<div class="section" id="order-of-execution">
<h3><a class="toc-backref" href="#id7">Order of execution</a><a class="headerlink" href="#order-of-execution" title="Permalink to this headline"></a></h3>
<p>On a single node, the scripts in a directory are run in lexicographic
order (more exactly, the python string comparison order). It is
advisable to implement the usual <em>NN-name</em> convention where <em>NN</em> is a
two digit number.</p>
<p>For an operation whose hooks are run on multiple nodes, there is no
specific ordering of nodes with regard to hooks execution; you should
assume that the scripts are run in parallel on the target nodes
(keeping on each node the above specified ordering).  If you need any
kind of inter-node synchronisation, you have to implement it yourself
in the scripts.</p>
</div>
<div class="section" id="execution-environment">
<h3><a class="toc-backref" href="#id8">Execution environment</a><a class="headerlink" href="#execution-environment" title="Permalink to this headline"></a></h3>
<p>The scripts will be run as follows:</p>
<ul class="simple">
<li>no command line arguments</li>
<li>no controlling <em>tty</em></li>
<li>stdin is actually <em>/dev/null</em></li>
<li>stdout and stderr are directed to files</li>
<li>PATH is reset to <code class="docutils literal"><span class="pre">/sbin:/bin:/usr/sbin:/usr/bin</span></code></li>
<li>the environment is cleared, and only ganeti-specific variables will
be left</li>
</ul>
<p>All information about the cluster is passed using environment
variables. Different operations will have sligthly different
environments, but most of the variables are common.</p>
</div>
</div>
<div class="section" id="operation-list">
<h2><a class="toc-backref" href="#id9">Operation list</a><a class="headerlink" href="#operation-list" title="Permalink to this headline"></a></h2>
<div class="section" id="node-operations">
<h3><a class="toc-backref" href="#id10">Node operations</a><a class="headerlink" href="#node-operations" title="Permalink to this headline"></a></h3>
<div class="section" id="op-node-add">
<h4><a class="toc-backref" href="#id11">OP_NODE_ADD</a><a class="headerlink" href="#op-node-add" title="Permalink to this headline"></a></h4>
<p>Adds a node to the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">node-add</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NODE_NAME, NODE_PIP, NODE_SIP, MASTER_CAPABLE, VM_CAPABLE</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">all existing nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">all nodes plus the new node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-node-remove">
<h4><a class="toc-backref" href="#id12">OP_NODE_REMOVE</a><a class="headerlink" href="#op-node-remove" title="Permalink to this headline"></a></h4>
<p>Removes a node from the cluster. On the removed node the hooks are
called during the execution of the operation and not after its
completion.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">node-remove</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NODE_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">all existing nodes except the removed node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">all existing nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-node-set-params">
<h4><a class="toc-backref" href="#id13">OP_NODE_SET_PARAMS</a><a class="headerlink" href="#op-node-set-params" title="Permalink to this headline"></a></h4>
<p>Changes a node’s parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">node-modify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">MASTER_CANDIDATE, OFFLINE, DRAINED, MASTER_CAPABLE, VM_CAPABLE</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, the target node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, the target node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-node-migrate">
<h4><a class="toc-backref" href="#id14">OP_NODE_MIGRATE</a><a class="headerlink" href="#op-node-migrate" title="Permalink to this headline"></a></h4>
<p>Relocate secondary instances from a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">node-migrate</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NODE_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="node-group-operations">
<h3><a class="toc-backref" href="#id15">Node group operations</a><a class="headerlink" href="#node-group-operations" title="Permalink to this headline"></a></h3>
<div class="section" id="op-group-add">
<h4><a class="toc-backref" href="#id16">OP_GROUP_ADD</a><a class="headerlink" href="#op-group-add" title="Permalink to this headline"></a></h4>
<p>Adds a node group to the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">group-add</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-group-set-params">
<h4><a class="toc-backref" href="#id17">OP_GROUP_SET_PARAMS</a><a class="headerlink" href="#op-group-set-params" title="Permalink to this headline"></a></h4>
<p>Changes a node group’s parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">group-modify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME, NEW_ALLOC_POLICY</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-group-remove">
<h4><a class="toc-backref" href="#id18">OP_GROUP_REMOVE</a><a class="headerlink" href="#op-group-remove" title="Permalink to this headline"></a></h4>
<p>Removes a node group from the cluster. Since the node group must be
empty for removal to succeed, the concept of “nodes in the group” does
not exist, and the hook is only executed in the master node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">group-remove</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-group-rename">
<h4><a class="toc-backref" href="#id19">OP_GROUP_RENAME</a><a class="headerlink" href="#op-group-rename" title="Permalink to this headline"></a></h4>
<p>Renames a node group.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">group-rename</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">OLD_NAME, NEW_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node and all nodes in the group</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node and all nodes in the group</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-group-evacuate">
<h4><a class="toc-backref" href="#id20">OP_GROUP_EVACUATE</a><a class="headerlink" href="#op-group-evacuate" title="Permalink to this headline"></a></h4>
<p>Evacuates a node group.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">group-evacuate</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME, TARGET_GROUPS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node and all nodes in the group</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node and all nodes in the group</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="network-operations">
<h3><a class="toc-backref" href="#id21">Network operations</a><a class="headerlink" href="#network-operations" title="Permalink to this headline"></a></h3>
<div class="section" id="op-network-add">
<h4><a class="toc-backref" href="#id22">OP_NETWORK_ADD</a><a class="headerlink" href="#op-network-add" title="Permalink to this headline"></a></h4>
<p>Adds a network to the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">network-add</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-network-remove">
<h4><a class="toc-backref" href="#id23">OP_NETWORK_REMOVE</a><a class="headerlink" href="#op-network-remove" title="Permalink to this headline"></a></h4>
<p>Removes a network from the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">network-remove</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NETWORK_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-network-connect">
<h4><a class="toc-backref" href="#id24">OP_NETWORK_CONNECT</a><a class="headerlink" href="#op-network-connect" title="Permalink to this headline"></a></h4>
<p>Connects a network to a nodegroup.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">network-connect</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME, NETWORK_NAME,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, GROUP_NETWORK_VLAN,
NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">nodegroup nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">nodegroup nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-network-disconnect">
<h4><a class="toc-backref" href="#id25">OP_NETWORK_DISCONNECT</a><a class="headerlink" href="#op-network-disconnect" title="Permalink to this headline"></a></h4>
<p>Disconnects a network from a nodegroup.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">network-disconnect</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">GROUP_NAME, NETWORK_NAME,
GROUP_NETWORK_MODE, GROUP_NETWORK_LINK, GROUP_NETWORK_VLAN,
NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">nodegroup nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">nodegroup nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-network-set-params">
<h4><a class="toc-backref" href="#id26">OP_NETWORK_SET_PARAMS</a><a class="headerlink" href="#op-network-set-params" title="Permalink to this headline"></a></h4>
<p>Modifies a network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">network-modify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NETWORK_NAME, NETWORK_SUBNET, NETWORK_GATEWAY, NETWORK_SUBNET6,
NETWORK_GATEWAY6, NETWORK_MAC_PREFIX, NETWORK_TAGS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="instance-operations">
<h3><a class="toc-backref" href="#id27">Instance operations</a><a class="headerlink" href="#instance-operations" title="Permalink to this headline"></a></h3>
<p>All instance operations take at least the following variables:
INSTANCE_NAME, INSTANCE_PRIMARY, INSTANCE_SECONDARY,
INSTANCE_OS_TYPE, INSTANCE_DISK_TEMPLATE, INSTANCE_MEMORY,
INSTANCE_DISK_SIZES, INSTANCE_VCPUS, INSTANCE_NIC_COUNT,
INSTANCE_NICn_IP, INSTANCE_NICn_BRIDGE, INSTANCE_NICn_MAC,
INSTANCE_NICn_NETWORK,
INSTANCE_NICn_NETWORK_UUID, INSTANCE_NICn_NETWORK_SUBNET,
INSTANCE_NICn_NETWORK_GATEWAY, INSTANCE_NICn_NETWORK_SUBNET6,
INSTANCE_NICn_NETWORK_GATEWAY6, INSTANCE_NICn_NETWORK_MAC_PREFIX,
INSTANCE_DISK_COUNT, INSTANCE_DISKn_SIZE, INSTANCE_DISKn_MODE,
INSTANCE_DISKn_NAME, INSTANCE_DISKn_UUID, INSTANCE_DISKn_DEV_TYPE.</p>
<p>The INSTANCE_NICn_* and INSTANCE_DISKn_* variables represent the
properties of the <em>n</em> -th NIC and disk, and are zero-indexed.
Depending on the disk template, Ganeti exports some info related to
the logical id of the disk, that is basically its driver and id.</p>
<p>The INSTANCE_NICn_NETWORK_* variables are only passed if a NIC’s network
parameter is set (that is if the NIC is associated to a network defined
via <code class="docutils literal"><span class="pre">gnt-network</span></code>)</p>
<div class="section" id="op-instance-create">
<h4><a class="toc-backref" href="#id28">OP_INSTANCE_CREATE</a><a class="headerlink" href="#op-instance-create" title="Permalink to this headline"></a></h4>
<p>Creates a new instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-add</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">ADD_MODE, SRC_NODE, SRC_PATH, SRC_IMAGES</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-reinstall">
<h4><a class="toc-backref" href="#id29">OP_INSTANCE_REINSTALL</a><a class="headerlink" href="#op-instance-reinstall" title="Permalink to this headline"></a></h4>
<p>Reinstalls an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-reinstall</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">only the standard instance vars</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-backup-export">
<h4><a class="toc-backref" href="#id30">OP_BACKUP_EXPORT</a><a class="headerlink" href="#op-backup-export" title="Permalink to this headline"></a></h4>
<p>Exports the instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-export</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">EXPORT_MODE, EXPORT_NODE, EXPORT_DO_SHUTDOWN, REMOVE_INSTANCE</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-startup">
<h4><a class="toc-backref" href="#id31">OP_INSTANCE_STARTUP</a><a class="headerlink" href="#op-instance-startup" title="Permalink to this headline"></a></h4>
<p>Starts an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-start</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">FORCE</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-shutdown">
<h4><a class="toc-backref" href="#id32">OP_INSTANCE_SHUTDOWN</a><a class="headerlink" href="#op-instance-shutdown" title="Permalink to this headline"></a></h4>
<p>Stops an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-stop</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">TIMEOUT</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-reboot">
<h4><a class="toc-backref" href="#id33">OP_INSTANCE_REBOOT</a><a class="headerlink" href="#op-instance-reboot" title="Permalink to this headline"></a></h4>
<p>Reboots an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-reboot</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">IGNORE_SECONDARIES, REBOOT_TYPE, SHUTDOWN_TIMEOUT</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-set-params">
<h4><a class="toc-backref" href="#id34">OP_INSTANCE_SET_PARAMS</a><a class="headerlink" href="#op-instance-set-params" title="Permalink to this headline"></a></h4>
<p>Modifies the instance parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-modify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NEW_DISK_TEMPLATE, RUNTIME_MEMORY</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-failover">
<h4><a class="toc-backref" href="#id35">OP_INSTANCE_FAILOVER</a><a class="headerlink" href="#op-instance-failover" title="Permalink to this headline"></a></h4>
<p>Failovers an instance. In the post phase INSTANCE_PRIMARY and
INSTANCE_SECONDARY refer to the nodes that were repectively primary
and secondary before failover.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-failover</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">IGNORE_CONSISTENCY, SHUTDOWN_TIMEOUT, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, secondary (target) node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary (source) and secondary (target) nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-migrate">
<h4><a class="toc-backref" href="#id36">OP_INSTANCE_MIGRATE</a><a class="headerlink" href="#op-instance-migrate" title="Permalink to this headline"></a></h4>
<p>Migrates an instance. In the post phase INSTANCE_PRIMARY and
INSTANCE_SECONDARY refer to the nodes that were repectively primary
and secondary before migration.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-migrate</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary (source) and secondary (target) nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary (source) and secondary (target) nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-remove">
<h4><a class="toc-backref" href="#id37">OP_INSTANCE_REMOVE</a><a class="headerlink" href="#op-instance-remove" title="Permalink to this headline"></a></h4>
<p>Remove an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-remove</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">SHUTDOWN_TIMEOUT</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-grow-disk">
<h4><a class="toc-backref" href="#id38">OP_INSTANCE_GROW_DISK</a><a class="headerlink" href="#op-instance-grow-disk" title="Permalink to this headline"></a></h4>
<p>Grows the disk of an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">disk-grow</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">DISK, AMOUNT</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-rename">
<h4><a class="toc-backref" href="#id39">OP_INSTANCE_RENAME</a><a class="headerlink" href="#op-instance-rename" title="Permalink to this headline"></a></h4>
<p>Renames an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-rename</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">INSTANCE_NEW_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-move">
<h4><a class="toc-backref" href="#id40">OP_INSTANCE_MOVE</a><a class="headerlink" href="#op-instance-move" title="Permalink to this headline"></a></h4>
<p>Move an instance by data-copying.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-move</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">TARGET_NODE, SHUTDOWN_TIMEOUT</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and target nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and target nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-recreate-disks">
<h4><a class="toc-backref" href="#id41">OP_INSTANCE_RECREATE_DISKS</a><a class="headerlink" href="#op-instance-recreate-disks" title="Permalink to this headline"></a></h4>
<p>Recreate an instance’s missing disks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-recreate-disks</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">only the standard instance vars</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-replace-disks">
<h4><a class="toc-backref" href="#id42">OP_INSTANCE_REPLACE_DISKS</a><a class="headerlink" href="#op-instance-replace-disks" title="Permalink to this headline"></a></h4>
<p>Replace the disks of an instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">mirrors-replace</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">MODE, NEW_SECONDARY, OLD_SECONDARY</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node, primary and new secondary nodes</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node, primary and new secondary nodes</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-instance-change-group">
<h4><a class="toc-backref" href="#id43">OP_INSTANCE_CHANGE_GROUP</a><a class="headerlink" href="#op-instance-change-group" title="Permalink to this headline"></a></h4>
<p>Moves an instance to another group.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">instance-change-group</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">TARGET_GROUPS</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="cluster-operations">
<h3><a class="toc-backref" href="#id44">Cluster operations</a><a class="headerlink" href="#cluster-operations" title="Permalink to this headline"></a></h3>
<div class="section" id="op-cluster-post-init">
<h4><a class="toc-backref" href="#id45">OP_CLUSTER_POST_INIT</a><a class="headerlink" href="#op-cluster-post-init" title="Permalink to this headline"></a></h4>
<p>This hook is called via a special “empty” LU right after cluster
initialization.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">cluster-init</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">none</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">none</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-cluster-destroy">
<h4><a class="toc-backref" href="#id46">OP_CLUSTER_DESTROY</a><a class="headerlink" href="#op-cluster-destroy" title="Permalink to this headline"></a></h4>
<p>The post phase of this hook is called during the execution of destroy
operation and not after its completion.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">cluster-destroy</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">none</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">none</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-cluster-verify-group">
<h4><a class="toc-backref" href="#id47">OP_CLUSTER_VERIFY_GROUP</a><a class="headerlink" href="#op-cluster-verify-group" title="Permalink to this headline"></a></h4>
<p>Verifies all nodes in a group. This is a special LU with regard to
hooks, as the result of the opcode will be combined with the result of
post-execution hooks, in order to allow administrators to enhance the
cluster verification procedure.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">cluster-verify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">CLUSTER, MASTER, CLUSTER_TAGS, NODE_TAGS_&lt;name&gt;</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">none</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">all nodes in a group</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-cluster-rename">
<h4><a class="toc-backref" href="#id48">OP_CLUSTER_RENAME</a><a class="headerlink" href="#op-cluster-rename" title="Permalink to this headline"></a></h4>
<p>Renames the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">cluster-rename</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NEW_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master-node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master-node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="op-cluster-set-params">
<h4><a class="toc-backref" href="#id49">OP_CLUSTER_SET_PARAMS</a><a class="headerlink" href="#op-cluster-set-params" title="Permalink to this headline"></a></h4>
<p>Modifies the cluster parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">cluster-modify</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">NEW_VG_NAME</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="virtual-operation-op-cluster-ip-turnup">
<h4><a class="toc-backref" href="#id50">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNUP</span></code></a><a class="headerlink" href="#virtual-operation-op-cluster-ip-turnup" title="Permalink to this headline"></a></h4>
<p>This doesn’t correspond to an actual op-code, but it is called when the
master IP is activated.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">master-ip-turnup</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="virtual-operation-op-cluster-ip-turndown">
<h4><a class="toc-backref" href="#id51">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNDOWN</span></code></a><a class="headerlink" href="#virtual-operation-op-cluster-ip-turndown" title="Permalink to this headline"></a></h4>
<p>This doesn’t correspond to an actual op-code, but it is called when the
master IP is deactivated.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">directory:</th><td class="field-body">master-ip-turndown</td>
</tr>
<tr class="field-even field"><th class="field-name">env. vars:</th><td class="field-body">MASTER_NETDEV, MASTER_IP, MASTER_NETMASK, CLUSTER_IP_VERSION</td>
</tr>
<tr class="field-odd field"><th class="field-name">pre-execution:</th><td class="field-body">master node</td>
</tr>
<tr class="field-even field"><th class="field-name">post-execution:</th><td class="field-body">master node</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obsolete-operations">
<h3><a class="toc-backref" href="#id52">Obsolete operations</a><a class="headerlink" href="#obsolete-operations" title="Permalink to this headline"></a></h3>
<p>The following operations are no longer present or don’t execute hooks
anymore in Ganeti 2.0:</p>
<ul class="simple">
<li>OP_INIT_CLUSTER</li>
<li>OP_MASTER_FAILOVER</li>
<li>OP_INSTANCE_ADD_MDDRBD</li>
<li>OP_INSTANCE_REMOVE_MDDRBD</li>
</ul>
</div>
</div>
<div class="section" id="environment-variables">
<h2><a class="toc-backref" href="#id53">Environment variables</a><a class="headerlink" href="#environment-variables" title="Permalink to this headline"></a></h2>
<p>Note that all variables listed here are actually prefixed with <em>GANETI_</em>
in order to provide a clear namespace. In addition, post-execution
scripts receive another set of variables, prefixed with <em>GANETI_POST_</em>,
representing the status after the opcode executed.</p>
<div class="section" id="common-variables">
<h3><a class="toc-backref" href="#id54">Common variables</a><a class="headerlink" href="#common-variables" title="Permalink to this headline"></a></h3>
<p>This is the list of environment variables supported by all operations:</p>
<dl class="docutils">
<dt>HOOKS_VERSION</dt>
<dd>Documents the hooks interface version. In case this doesnt match
what the script expects, it should not run. The documents conforms
to the version 2.</dd>
<dt>HOOKS_PHASE</dt>
<dd>One of <em>PRE</em> or <em>POST</em> denoting which phase are we in.</dd>
<dt>CLUSTER</dt>
<dd>The cluster name.</dd>
<dt>MASTER</dt>
<dd>The master node.</dd>
<dt>OP_CODE</dt>
<dd>One of the <em>OP_</em> values from the list of operations.</dd>
<dt>OBJECT_TYPE</dt>
<dd>One of <code class="docutils literal"><span class="pre">INSTANCE</span></code>, <code class="docutils literal"><span class="pre">NODE</span></code>, <code class="docutils literal"><span class="pre">CLUSTER</span></code>.</dd>
<dt>DATA_DIR</dt>
<dd>The path to the Ganeti configuration directory (to read, for
example, the <em>ssconf</em> files).</dd>
</dl>
</div>
<div class="section" id="specialised-variables">
<h3><a class="toc-backref" href="#id55">Specialised variables</a><a class="headerlink" href="#specialised-variables" title="Permalink to this headline"></a></h3>
<p>This is the list of variables which are specific to one or more
operations.</p>
<dl class="docutils">
<dt>CLUSTER_IP_VERSION</dt>
<dd>IP version of the master IP (4 or 6)</dd>
<dt>INSTANCE_NAME</dt>
<dd>The name of the instance which is the target of the operation.</dd>
<dt>INSTANCE_BE_x,y,z,…</dt>
<dd>Instance BE params. There is one variable per BE param. For instance, GANETI_INSTANCE_BE_auto_balance</dd>
<dt>INSTANCE_DISK_TEMPLATE</dt>
<dd>The disk type for the instance.</dd>
<dt>NEW_DISK_TEMPLATE</dt>
<dd>The new disk type for the instance.</dd>
<dt>INSTANCE_DISK_COUNT</dt>
<dd>The number of disks for the instance.</dd>
<dt>INSTANCE_DISKn_SIZE</dt>
<dd>The size of disk <em>n</em> for the instance.</dd>
<dt>INSTANCE_DISKn_MODE</dt>
<dd>Either <em>rw</em> for a read-write disk or <em>ro</em> for a read-only one.</dd>
<dt>INSTANCE_HV_x,y,z,…</dt>
<dd>Instance hypervisor options. There is one variable per option. For instance, GANETI_INSTANCE_HV_use_bootloader</dd>
<dt>INSTANCE_HYPERVISOR</dt>
<dd>The instance hypervisor.</dd>
<dt>INSTANCE_NIC_COUNT</dt>
<dd>The number of NICs for the instance.</dd>
<dt>INSTANCE_NICn_BRIDGE</dt>
<dd>The bridge to which the <em>n</em> -th NIC of the instance is attached.</dd>
<dt>INSTANCE_NICn_IP</dt>
<dd>The IP (if any) of the <em>n</em> -th NIC of the instance.</dd>
<dt>INSTANCE_NICn_MAC</dt>
<dd>The MAC address of the <em>n</em> -th NIC of the instance.</dd>
<dt>INSTANCE_NICn_MODE</dt>
<dd>The mode of the <em>n</em> -th NIC of the instance.</dd>
<dt>INSTANCE_OS_TYPE</dt>
<dd>The name of the instance OS.</dd>
<dt>INSTANCE_PRIMARY</dt>
<dd>The name of the node which is the primary for the instance. Note that
for migrations/failovers, you shouldn’t rely on this variable since
the nodes change during the exectution, but on the
OLD_PRIMARY/NEW_PRIMARY values.</dd>
<dt>INSTANCE_SECONDARY</dt>
<dd>Space-separated list of secondary nodes for the instance. Note that
for migrations/failovers, you shouldn’t rely on this variable since
the nodes change during the exectution, but on the
OLD_SECONDARY/NEW_SECONDARY values.</dd>
<dt>INSTANCE_MEMORY</dt>
<dd>The memory size (in MiBs) of the instance.</dd>
<dt>INSTANCE_VCPUS</dt>
<dd>The number of virtual CPUs for the instance.</dd>
<dt>INSTANCE_STATUS</dt>
<dd>The run status of the instance.</dd>
<dt>MASTER_CAPABLE</dt>
<dd>Whether a node is capable of being promoted to master.</dd>
<dt>VM_CAPABLE</dt>
<dd>Whether the node can host instances.</dd>
<dt>MASTER_NETDEV</dt>
<dd>Network device of the master IP</dd>
<dt>MASTER_IP</dt>
<dd>The master IP</dd>
<dt>MASTER_NETMASK</dt>
<dd>Netmask of the master IP</dd>
<dt>INSTANCE_TAGS</dt>
<dd>A space-delimited list of the instance’s tags.</dd>
<dt>NODE_NAME</dt>
<dd>The target node of this operation (not the node on which the hook
runs).</dd>
<dt>NODE_PIP</dt>
<dd>The primary IP of the target node (the one over which inter-node
communication is done).</dd>
<dt>NODE_SIP</dt>
<dd>The secondary IP of the target node (the one over which drbd
replication is done). This can be equal to the primary ip, in case
the cluster is not dual-homed.</dd>
<dt>FORCE</dt>
<dd>This is provided by some operations when the user gave this flag.</dd>
<dt>IGNORE_CONSISTENCY</dt>
<dd>The user has specified this flag. It is used when failing over
instances in case the primary node is down.</dd>
<dt>ADD_MODE</dt>
<dd>The mode of the instance create: either <em>create</em> for create from
scratch or <em>import</em> for restoring from an exported image.</dd>
<dt>SRC_NODE, SRC_PATH, SRC_IMAGE</dt>
<dd>In case the instance has been added by import, these variables are
defined and point to the source node, source path (the directory
containing the image and the config file) and the source disk image
file.</dd>
<dt>NEW_SECONDARY</dt>
<dd>The name of the node on which the new mirror component is being
added (for replace disk). This can be the name of the current
secondary, if the new mirror is on the same secondary. For
migrations/failovers, this is the old primary node.</dd>
<dt>OLD_SECONDARY</dt>
<dd>The name of the old secondary in the replace-disks command. Note that
this can be equal to the new secondary if the secondary node hasn’t
actually changed. For migrations/failovers, this is the new primary
node.</dd>
<dt>OLD_PRIMARY, NEW_PRIMARY</dt>
<dd>For migrations/failovers, the old and respectively new primary
nodes. These two mirror the NEW_SECONDARY/OLD_SECONDARY variables</dd>
<dt>EXPORT_MODE</dt>
<dd>The instance export mode. Either “remote” or “local”.</dd>
<dt>EXPORT_NODE</dt>
<dd>The node on which the exported image of the instance was done.</dd>
<dt>EXPORT_DO_SHUTDOWN</dt>
<dd>This variable tells if the instance has been shutdown or not while
doing the export. In the “was shutdown” case, it’s likely that the
filesystem is consistent, whereas in the “did not shutdown” case,
the filesystem would need a check (journal replay or full fsck) in
order to guarantee consistency.</dd>
<dt>REMOVE_INSTANCE</dt>
<dd>Whether the instance was removed from the node.</dd>
<dt>SHUTDOWN_TIMEOUT</dt>
<dd>Amount of time to wait for the instance to shutdown.</dd>
<dt>TIMEOUT</dt>
<dd>Amount of time to wait before aborting the op.</dd>
<dt>OLD_NAME, NEW_NAME</dt>
<dd>Old/new name of the node group.</dd>
<dt>GROUP_NAME</dt>
<dd>The name of the node group.</dd>
<dt>NEW_ALLOC_POLICY</dt>
<dd>The new allocation policy for the node group.</dd>
<dt>CLUSTER_TAGS</dt>
<dd>The list of cluster tags, space separated.</dd>
<dt>NODE_TAGS_&lt;name&gt;</dt>
<dd>The list of tags for node <em>&lt;name&gt;</em>, space separated.</dd>
</dl>
</div>
</div>
<div class="section" id="examples">
<h2><a class="toc-backref" href="#id56">Examples</a><a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>The startup of an instance will pass this environment to the hook
script:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">GANETI_CLUSTER</span><span class="o">=</span><span class="n">cluster1</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">GANETI_DATA_DIR</span><span class="o">=/</span><span class="n">var</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ganeti</span>
<span class="n">GANETI_FORCE</span><span class="o">=</span><span class="kc">False</span>
<span class="n">GANETI_HOOKS_PATH</span><span class="o">=</span><span class="n">instance</span><span class="o">-</span><span class="n">start</span>
<span class="n">GANETI_HOOKS_PHASE</span><span class="o">=</span><span class="n">post</span>
<span class="n">GANETI_HOOKS_VERSION</span><span class="o">=</span><span class="mi">2</span>
<span class="n">GANETI_INSTANCE_DISK0_MODE</span><span class="o">=</span><span class="n">rw</span>
<span class="n">GANETI_INSTANCE_DISK0_SIZE</span><span class="o">=</span><span class="mi">128</span>
<span class="n">GANETI_INSTANCE_DISK_COUNT</span><span class="o">=</span><span class="mi">1</span>
<span class="n">GANETI_INSTANCE_DISK_TEMPLATE</span><span class="o">=</span><span class="n">drbd</span>
<span class="n">GANETI_INSTANCE_MEMORY</span><span class="o">=</span><span class="mi">128</span>
<span class="n">GANETI_INSTANCE_NAME</span><span class="o">=</span><span class="n">instance2</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">GANETI_INSTANCE_NIC0_BRIDGE</span><span class="o">=</span><span class="n">xen</span><span class="o">-</span><span class="n">br0</span>
<span class="n">GANETI_INSTANCE_NIC0_IP</span><span class="o">=</span>
<span class="n">GANETI_INSTANCE_NIC0_MAC</span><span class="o">=</span><span class="n">aa</span><span class="p">:</span><span class="mi">00</span><span class="p">:</span><span class="mi">00</span><span class="p">:</span><span class="n">a5</span><span class="p">:</span><span class="mi">91</span><span class="p">:</span><span class="mi">58</span>
<span class="n">GANETI_INSTANCE_NIC_COUNT</span><span class="o">=</span><span class="mi">1</span>
<span class="n">GANETI_INSTANCE_OS_TYPE</span><span class="o">=</span><span class="n">debootstrap</span>
<span class="n">GANETI_INSTANCE_PRIMARY</span><span class="o">=</span><span class="n">node3</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">GANETI_INSTANCE_SECONDARY</span><span class="o">=</span><span class="n">node5</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">GANETI_INSTANCE_STATUS</span><span class="o">=</span><span class="n">down</span>
<span class="n">GANETI_INSTANCE_VCPUS</span><span class="o">=</span><span class="mi">1</span>
<span class="n">GANETI_MASTER</span><span class="o">=</span><span class="n">node1</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">GANETI_OBJECT_TYPE</span><span class="o">=</span><span class="n">INSTANCE</span>
<span class="n">GANETI_OP_CODE</span><span class="o">=</span><span class="n">OP_INSTANCE_STARTUP</span>
<span class="n">GANETI_OP_TARGET</span><span class="o">=</span><span class="n">instance2</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Ganeti customisation using hooks</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#organisation">Organisation</a><ul>
<li><a class="reference internal" href="#pre-scripts"><em>pre</em> scripts</a></li>
<li><a class="reference internal" href="#post-scripts"><em>post</em> scripts</a></li>
<li><a class="reference internal" href="#naming">Naming</a></li>
<li><a class="reference internal" href="#order-of-execution">Order of execution</a></li>
<li><a class="reference internal" href="#execution-environment">Execution environment</a></li>
</ul>
</li>
<li><a class="reference internal" href="#operation-list">Operation list</a><ul>
<li><a class="reference internal" href="#node-operations">Node operations</a><ul>
<li><a class="reference internal" href="#op-node-add">OP_NODE_ADD</a></li>
<li><a class="reference internal" href="#op-node-remove">OP_NODE_REMOVE</a></li>
<li><a class="reference internal" href="#op-node-set-params">OP_NODE_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-node-migrate">OP_NODE_MIGRATE</a></li>
</ul>
</li>
<li><a class="reference internal" href="#node-group-operations">Node group operations</a><ul>
<li><a class="reference internal" href="#op-group-add">OP_GROUP_ADD</a></li>
<li><a class="reference internal" href="#op-group-set-params">OP_GROUP_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-group-remove">OP_GROUP_REMOVE</a></li>
<li><a class="reference internal" href="#op-group-rename">OP_GROUP_RENAME</a></li>
<li><a class="reference internal" href="#op-group-evacuate">OP_GROUP_EVACUATE</a></li>
</ul>
</li>
<li><a class="reference internal" href="#network-operations">Network operations</a><ul>
<li><a class="reference internal" href="#op-network-add">OP_NETWORK_ADD</a></li>
<li><a class="reference internal" href="#op-network-remove">OP_NETWORK_REMOVE</a></li>
<li><a class="reference internal" href="#op-network-connect">OP_NETWORK_CONNECT</a></li>
<li><a class="reference internal" href="#op-network-disconnect">OP_NETWORK_DISCONNECT</a></li>
<li><a class="reference internal" href="#op-network-set-params">OP_NETWORK_SET_PARAMS</a></li>
</ul>
</li>
<li><a class="reference internal" href="#instance-operations">Instance operations</a><ul>
<li><a class="reference internal" href="#op-instance-create">OP_INSTANCE_CREATE</a></li>
<li><a class="reference internal" href="#op-instance-reinstall">OP_INSTANCE_REINSTALL</a></li>
<li><a class="reference internal" href="#op-backup-export">OP_BACKUP_EXPORT</a></li>
<li><a class="reference internal" href="#op-instance-startup">OP_INSTANCE_STARTUP</a></li>
<li><a class="reference internal" href="#op-instance-shutdown">OP_INSTANCE_SHUTDOWN</a></li>
<li><a class="reference internal" href="#op-instance-reboot">OP_INSTANCE_REBOOT</a></li>
<li><a class="reference internal" href="#op-instance-set-params">OP_INSTANCE_SET_PARAMS</a></li>
<li><a class="reference internal" href="#op-instance-failover">OP_INSTANCE_FAILOVER</a></li>
<li><a class="reference internal" href="#op-instance-migrate">OP_INSTANCE_MIGRATE</a></li>
<li><a class="reference internal" href="#op-instance-remove">OP_INSTANCE_REMOVE</a></li>
<li><a class="reference internal" href="#op-instance-grow-disk">OP_INSTANCE_GROW_DISK</a></li>
<li><a class="reference internal" href="#op-instance-rename">OP_INSTANCE_RENAME</a></li>
<li><a class="reference internal" href="#op-instance-move">OP_INSTANCE_MOVE</a></li>
<li><a class="reference internal" href="#op-instance-recreate-disks">OP_INSTANCE_RECREATE_DISKS</a></li>
<li><a class="reference internal" href="#op-instance-replace-disks">OP_INSTANCE_REPLACE_DISKS</a></li>
<li><a class="reference internal" href="#op-instance-change-group">OP_INSTANCE_CHANGE_GROUP</a></li>
</ul>
</li>
<li><a class="reference internal" href="#cluster-operations">Cluster operations</a><ul>
<li><a class="reference internal" href="#op-cluster-post-init">OP_CLUSTER_POST_INIT</a></li>
<li><a class="reference internal" href="#op-cluster-destroy">OP_CLUSTER_DESTROY</a></li>
<li><a class="reference internal" href="#op-cluster-verify-group">OP_CLUSTER_VERIFY_GROUP</a></li>
<li><a class="reference internal" href="#op-cluster-rename">OP_CLUSTER_RENAME</a></li>
<li><a class="reference internal" href="#op-cluster-set-params">OP_CLUSTER_SET_PARAMS</a></li>
<li><a class="reference internal" href="#virtual-operation-op-cluster-ip-turnup">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNUP</span></code></a></li>
<li><a class="reference internal" href="#virtual-operation-op-cluster-ip-turndown">Virtual operation <code class="docutils literal"><span class="pre">OP_CLUSTER_IP_TURNDOWN</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#obsolete-operations">Obsolete operations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#environment-variables">Environment variables</a><ul>
<li><a class="reference internal" href="#common-variables">Common variables</a></li>
<li><a class="reference internal" href="#specialised-variables">Specialised variables</a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="glossary.html"
                        title="previous chapter">Glossary</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="iallocator.html"
                        title="next chapter">Ganeti automatic instance allocation</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/hooks.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="iallocator.html" title="Ganeti automatic instance allocation"
             >next</a></li>
        <li class="right" >
          <a href="glossary.html" title="Glossary"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Ganeti 2.16.0~rc2 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2018, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Google Inc..
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
    </div>
  </body>
</html>