Revision 386b57af

b/lib/backend.py
812 812
    utils.RemoveFile(new_name)
813 813
  return True
814 814

  
815

  
815 816
def _ErrnoOrStr(err):
816 817
  """Format an EnvironmentError exception.
817 818

  
......
871 872

  
872 873
  return api_version
873 874

  
875

  
874 876
def DiagnoseOS(top_dir=None):
875 877
  """Compute the validity for all OSes.
876 878

  
......
922 924
                           % (api_version, constants.OS_API_VERSION))
923 925

  
924 926
  # OS Scripts dictionary, we will populate it with the actual script names
925
  os_scripts = {'create': '', 'export': '', 'import': ''}
927
  os_scripts = {'create': '', 'export': '', 'import': '', 'rename': ''}
926 928

  
927 929
  for script in os_scripts:
928 930
    os_scripts[script] = os.path.sep.join([os_dir, script])
......
944 946
                    create_script=os_scripts['create'],
945 947
                    export_script=os_scripts['export'],
946 948
                    import_script=os_scripts['import'],
949
                    rename_script=os_scripts['rename'],
947 950
                    api_version=api_version)
948 951

  
949 952

  
b/lib/constants.py
27 27
CONFIG_VERSION = 3
28 28
PROTOCOL_VERSION = 2
29 29
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
30
OS_API_VERSION = 4
30
OS_API_VERSION = 5
31 31
EXPORT_VERSION = 0
32 32

  
33 33

  
b/lib/objects.py
400 400
    "api_version",
401 401
    "create_script",
402 402
    "export_script",
403
    "import_script"
403
    "import_script",
404
    "rename_script",
404 405
    ]
405 406

  
406 407

  
b/man/ganeti-os-interface.sgml
53 53
    <title>REFERENCE</title>
54 54

  
55 55
    <para>
56
      There are four required files: <filename>create</filename>,
57
      <filename>import</filename>, <filename>export</filename>
58
      (executables) and <filename>ganeti_api_version</filename> (text
59
      file).
56
      There are five required files: <filename>create</filename>,
57
      <filename>import</filename>, <filename>export</filename>,
58
      <filename>rename</filename> (executables) and
59
      <filename>ganeti_api_version</filename> (text file).
60 60
    </para>
61 61

  
62 62
    <refsect2>
......
81 81
      denote the block devices which will be visible in the instance
82 82
      as <emphasis>sda</emphasis> and <emphasis>sdb</emphasis>. The
83 83
      <emphasis>sda</emphasis> block device should be used for the
84
      root disk (and will be passed as the root device for linux
84
      root disk (and will be passed as the root device for Linux
85 85
      kernels). The <emphasis>sdb</emphasis> device should be setup
86 86
      for swap usage.</para>
87 87

  
......
132 132
    </refsect2>
133 133

  
134 134
    <refsect2>
135
      <title>rename</title>
136
      <cmdsynopsis>
137
        <command>rename</command>
138
        <arg choice="req">-o <replaceable>old_name</replaceable></arg>
139
        <arg choice="req">-n <replaceable>new_name</replaceable></arg>
140
        <arg choice="req">-b <replaceable>blockdev_sda</replaceable></arg>
141
        <arg choice="req">-s <replaceable>blockdev_sdb</replaceable></arg>
142
      </cmdsynopsis>
143

  
144
      <para>
145
        This command is used in order to perform a rename at the
146
        instance OS level, after the instance has been renamed in
147
        Ganeti. The command should do whatever steps are required to
148
        ensure that the instance is updated to use the new name, if
149
        the operating system supports it.
150
      </para>
151

  
152
      <para>
153
        Note that it is acceptable for the rename script to do nothing
154
        at all, however be warned that in this case, there will be a
155
        desynchronization between what <computeroutput>gnt-instance
156
        list</computeroutput> shows you and the actual hostname of the
157
        instance.
158
      </para>
159

  
160
      <para>
161
        A very simple rename script should at least change the
162
        hostname and IP address of the instance, leaving the
163
        administrator to update the other services.
164
        </screen>
165
      </para>
166
    </refsect2>
167

  
168
    <refsect2>
135 169
      <title>ganeti_api_version</title>
136 170
      <para>
137 171
        The <filename>ganeti_api_version</filename> file is a plain
138 172
        text file containing the version of the guest OS api that this
139 173
        OS definition complies with. The version documented by this
140
        man page is 4, so this file must contain 4 followed by a
141
        newline.
174
        man page is 5, so this file must contain the number 5 followed
175
        by a newline.
142 176
      </para>
143 177
    </refsect2>
144 178

  
......
154 188

  
155 189
    </refsect2>
156 190

  
191
    <refsect2>
192
      <title>Upgrading from old versions</title>
193
      <refsect3>
194
        <title>Version 4 to 5</title>
195
        <para>
196
          The <filename>rename</filename> script has been added. If
197
          you don't want to do any changes on the instances after a
198
          rename, you can migrate the OS definition to version 5 by
199
          creating the <filename>rename</filename> script simply as:
200
          <screen>
201
#!/bin/sh
202

  
203
exit 0
204
          </screen>
205
        </para>
206

  
207
        <para>Note that the script must be executable.</para>
208
      </refsect3>
209
    </refsect2>
210

  
157 211
    <!--
158 212
    <refsect2>
159 213

  
160 214
      <title>Export/import format</title>
161 215

  
162
      <para>It is up to the export and import scripts to define the format they use. It is only required for these two to work together. It is not recommended that </para>
216
      <para>
217
        It is up to the export and import scripts to define the format
218
        they use. It is only required for these two to work
219
        together. It is not recommended that
220
      </para>
163 221

  
164 222
    </refsect2>
165 223
    -->

Also available in: Unified diff