Statistics
| Branch: | Tag: | Revision:

root / docs / examplesdir / imageregister.rst @ 023d5ada

History | View | Annotate | Download (16.8 kB)

1 0b158e6b Stavros Sachtouris
Image registration
2 0b158e6b Stavros Sachtouris
==================
3 0b158e6b Stavros Sachtouris
4 0b158e6b Stavros Sachtouris
In Synnefo, an image is loaded as a file to the storage service (Pithos+), and
5 0b158e6b Stavros Sachtouris
then is registered to the image service (Plankton). The image location at the
6 278fae3f Stavros Sachtouris
storage server is unique in each a deployment and also a key for identifying
7 278fae3f Stavros Sachtouris
the image.
8 0b158e6b Stavros Sachtouris
9 10ea6089 Stavros Sachtouris
The image location format at user level::
10 0b158e6b Stavros Sachtouris
11 823477e2 Stavros Sachtouris
    pithos://<user_uuid>/<container>/<object path>
12 0b158e6b Stavros Sachtouris
13 823477e2 Stavros Sachtouris
    e.g., pithos://my-u53r-1d/images/debian_base3.diskdump
14 0b158e6b Stavros Sachtouris
15 823477e2 Stavros Sachtouris
In **file** and **container** contexts, users may also use the shortcut:
16 0b158e6b Stavros Sachtouris
17 823477e2 Stavros Sachtouris
    /<container>/<object path>
18 0b158e6b Stavros Sachtouris
19 823477e2 Stavros Sachtouris
    e.g., /images/debian_base3.diskdump
20 0b158e6b Stavros Sachtouris
21 10ea6089 Stavros Sachtouris
22 0b158e6b Stavros Sachtouris
Register an image
23 0b158e6b Stavros Sachtouris
-----------------
24 0b158e6b Stavros Sachtouris
25 0b158e6b Stavros Sachtouris
Let the image file `debian_base3.diskdump` be a debian image located at the
26 823477e2 Stavros Sachtouris
current local directory.
27 0b158e6b Stavros Sachtouris
28 f084bdc8 Stavros Sachtouris
Upload the image to container `images`
29 0b158e6b Stavros Sachtouris
30 0b158e6b Stavros Sachtouris
.. code-block:: console
31 0b158e6b Stavros Sachtouris
32 f084bdc8 Stavros Sachtouris
    $ kamaki file upload debian_base3.diskdump /images
33 0b158e6b Stavros Sachtouris
34 0b158e6b Stavros Sachtouris
Register the image object with the name 'Debian Base Alpha'
35 0b158e6b Stavros Sachtouris
36 0b158e6b Stavros Sachtouris
.. code-block:: console
37 0b158e6b Stavros Sachtouris
38 f084bdc8 Stavros Sachtouris
    kamaki image register --name 'Debian Base Alpha' --location=/images/debian_base3.diskdump
39 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
40 0b158e6b Stavros Sachtouris
    container-format: bare
41 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
42 abfaa6d9 Vangelis Koukis
    deleted-at:
43 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
44 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
45 0b158e6b Stavros Sachtouris
    is-public:        False
46 f084bdc8 Stavros Sachtouris
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
47 0b158e6b Stavros Sachtouris
    name:             Debian Base Alpha
48 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
49 abfaa6d9 Vangelis Koukis
    properties:
50 0b158e6b Stavros Sachtouris
    size:             903471104
51 0b158e6b Stavros Sachtouris
    status:           available
52 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
53 f084bdc8 Stavros Sachtouris
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1352)
54 0b158e6b Stavros Sachtouris
55 278fae3f Stavros Sachtouris
.. warning:: The image created by the above command will not be able to create
56 278fae3f Stavros Sachtouris
    a working virtual server, although the registration will be successful. In
57 278fae3f Stavros Sachtouris
    the synnefo universe, an image has to be registered along with some
58 278fae3f Stavros Sachtouris
    `properties <http://www.synnefo.org/docs/snf-image/latest/usage.html#image-properties>`_.
59 0b158e6b Stavros Sachtouris
60 f2ea1314 Stavros Sachtouris
.. note:: The `image register` command automatically creates a meta file and
61 0b158e6b Stavros Sachtouris
    uploads it to the same location as the image. The meta file can be
62 0b158e6b Stavros Sachtouris
    downloaded and reused for more image registrations.
63 0b158e6b Stavros Sachtouris
64 278fae3f Stavros Sachtouris
Here is another way to perform the two operations above: **/image register**
65 10ea6089 Stavros Sachtouris
with the **\- -upload-image-file** argument. This single operation will upload
66 278fae3f Stavros Sachtouris
the image file and then register it as an image, and is equivalent to
67 278fae3f Stavros Sachtouris
sequentially calling **/file upload** and **/image register**.
68 10ea6089 Stavros Sachtouris
69 9f75385a Stavros Sachtouris
<<<<<<< HEAD:docs/collection_of_examples/imageregister.rst
70 10ea6089 Stavros Sachtouris
In other words, the example that follows is equivalent to calling the two
71 10ea6089 Stavros Sachtouris
operations above.
72 9f75385a Stavros Sachtouris
=======
73 f6822a26 Stavros Sachtouris
In other words, the preceding and following command sequences are equivalent.
74 9f75385a Stavros Sachtouris
>>>>>>> release-0.11:docs/examplesdir/imageregister.rst
75 10ea6089 Stavros Sachtouris
76 10ea6089 Stavros Sachtouris
.. code-block:: console
77 10ea6089 Stavros Sachtouris
78 f084bdc8 Stavros Sachtouris
        kamaki image register --name='Debian Base Alpha'
79 f084bdc8 Stavros Sachtouris
            --location=/images/debian_base3.diskdump
80 f084bdc8 Stavros Sachtouris
            --upload-image-file=debian_base3.diskdump
81 10ea6089 Stavros Sachtouris
82 10ea6089 Stavros Sachtouris
83 0b158e6b Stavros Sachtouris
Read the metafile
84 0b158e6b Stavros Sachtouris
85 0b158e6b Stavros Sachtouris
.. code-block:: console
86 0b158e6b Stavros Sachtouris
87 f084bdc8 Stavros Sachtouris
    kamaki file cat /images/debian_base3.diskdump.meta
88 0b158e6b Stavros Sachtouris
    {
89 abfaa6d9 Vangelis Koukis
      "status": "available",
90 abfaa6d9 Vangelis Koukis
      "name": "Debian Base Gama",
91 abfaa6d9 Vangelis Koukis
      "checksum": "3cb03556ec971f...e8dd6190443b560cb7",
92 abfaa6d9 Vangelis Koukis
      "id": "7h1rd-1m4g3-1d2",
93 abfaa6d9 Vangelis Koukis
      "updated-at": "2013-06-19 08:01:00",
94 abfaa6d9 Vangelis Koukis
      "created-at": "2013-06-19 08:00:22",
95 abfaa6d9 Vangelis Koukis
      "properties": {},
96 f084bdc8 Stavros Sachtouris
      "location": "pithos://s0m3-u53r-1d/images/debian_base3.diskdump",
97 abfaa6d9 Vangelis Koukis
      "is-public": "False",
98 abfaa6d9 Vangelis Koukis
      "owner": "s0m3-u53r-1d",
99 abfaa6d9 Vangelis Koukis
      "disk-format": "diskdump",
100 abfaa6d9 Vangelis Koukis
      "size": "903471104",
101 abfaa6d9 Vangelis Koukis
      "deleted-at": "",
102 0b158e6b Stavros Sachtouris
      "container-format": "bare"
103 0b158e6b Stavros Sachtouris
    }
104 0b158e6b Stavros Sachtouris
105 0b158e6b Stavros Sachtouris
Images registered by me
106 0b158e6b Stavros Sachtouris
-----------------------
107 0b158e6b Stavros Sachtouris
108 0b158e6b Stavros Sachtouris
List all images, then list only images owned by the user with id s0m3-u53r-1d
109 0b158e6b Stavros Sachtouris
110 0b158e6b Stavros Sachtouris
.. code-block:: console
111 0b158e6b Stavros Sachtouris
112 f084bdc8 Stavros Sachtouris
    kamaki image list
113 0b158e6b Stavros Sachtouris
    f1r57-1m4g3-1d Debian Base Alpha
114 0b158e6b Stavros Sachtouris
        container_format: bare
115 0b158e6b Stavros Sachtouris
        disk_format:      diskdump
116 0b158e6b Stavros Sachtouris
        size:             474066944
117 0b158e6b Stavros Sachtouris
        status:           available
118 0b158e6b Stavros Sachtouris
    53c0nd-1m4g3-1d Beta Debian Base
119 0b158e6b Stavros Sachtouris
        container_format: bare
120 0b158e6b Stavros Sachtouris
        disk_format:      diskdump
121 0b158e6b Stavros Sachtouris
        size:             474066944
122 0b158e6b Stavros Sachtouris
        status:           available
123 0b158e6b Stavros Sachtouris
    7h1rd-1m4g3-1d Debian Base Gama
124 0b158e6b Stavros Sachtouris
        container_format: bare
125 0b158e6b Stavros Sachtouris
        disk_format:      diskdump
126 0b158e6b Stavros Sachtouris
        size:             474066944
127 0b158e6b Stavros Sachtouris
        status:           available
128 f084bdc8 Stavros Sachtouris
    kamaki image list --owner=s0m3-u53r-1d
129 0b158e6b Stavros Sachtouris
    7h1rd-1m4g3-1d Debian Base Gama
130 0b158e6b Stavros Sachtouris
        container_format: bare
131 0b158e6b Stavros Sachtouris
        disk_format:      diskdump
132 0b158e6b Stavros Sachtouris
        size:             474066944
133 0b158e6b Stavros Sachtouris
        status:           available
134 0b158e6b Stavros Sachtouris
135 f084bdc8 Stavros Sachtouris
.. note:: To get the current user id, use `kamaki user info`
136 0b158e6b Stavros Sachtouris
137 0b158e6b Stavros Sachtouris
Unregister an image
138 0b158e6b Stavros Sachtouris
-------------------
139 0b158e6b Stavros Sachtouris
140 0b158e6b Stavros Sachtouris
An image can be unregistered by its image id, but only if the current user is
141 0b158e6b Stavros Sachtouris
also the image owner. In this example, there is only one image owned by current
142 0b158e6b Stavros Sachtouris
user.
143 0b158e6b Stavros Sachtouris
144 abfaa6d9 Vangelis Koukis
Unregister image owned by current user
145 0b158e6b Stavros Sachtouris
146 0b158e6b Stavros Sachtouris
.. code-block:: console
147 0b158e6b Stavros Sachtouris
148 f084bdc8 Stavros Sachtouris
    kamaki image unregister 7h1rd-1m4g3-1d
149 0b158e6b Stavros Sachtouris
150 0b158e6b Stavros Sachtouris
Check if the image is deleted
151 0b158e6b Stavros Sachtouris
152 0b158e6b Stavros Sachtouris
.. code-block:: console
153 0b158e6b Stavros Sachtouris
154 f084bdc8 Stavros Sachtouris
    kamaki image list --owner=s0m3-u53r-1d
155 0b158e6b Stavros Sachtouris
156 0b158e6b Stavros Sachtouris
Attempt to unregister an image of another user
157 0b158e6b Stavros Sachtouris
158 0b158e6b Stavros Sachtouris
.. code-block:: console
159 0b158e6b Stavros Sachtouris
160 f084bdc8 Stavros Sachtouris
    kamaki image unregister f1r57-1m4g3-1d
161 0b158e6b Stavros Sachtouris
    (403) FORBIDDEN forbidden ()
162 0b158e6b Stavros Sachtouris
163 0b158e6b Stavros Sachtouris
Register with properties
164 0b158e6b Stavros Sachtouris
------------------------
165 0b158e6b Stavros Sachtouris
166 278fae3f Stavros Sachtouris
.. warning:: A succesfully registered image will not be functional, if the
167 278fae3f Stavros Sachtouris
    image properties are not defined correctly. Read the
168 278fae3f Stavros Sachtouris
    `documentation <http://www.synnefo.org/docs/snf-image/latest/usage.html#image-properties>`_
169 278fae3f Stavros Sachtouris
    for more information.
170 0b158e6b Stavros Sachtouris
171 0b158e6b Stavros Sachtouris
The image will be registered again, but with some custom properties::
172 0b158e6b Stavros Sachtouris
173 278fae3f Stavros Sachtouris
    OSFAMILY: linux
174 278fae3f Stavros Sachtouris
    USER: someuser
175 0b158e6b Stavros Sachtouris
176 f084bdc8 Stavros Sachtouris
In theory, these properties can be added freely by the user, and they are not
177 f084bdc8 Stavros Sachtouris
required by the image server. In practice, some properties are absolutely
178 f084bdc8 Stavros Sachtouris
vital for an image to be useful, although not necessary for registration.
179 f084bdc8 Stavros Sachtouris
An attempt to register an image with custom properties:
180 0b158e6b Stavros Sachtouris
181 0b158e6b Stavros Sachtouris
.. code-block:: console
182 0b158e6b Stavros Sachtouris
183 f084bdc8 Stavros Sachtouris
    kamaki image register --name='Debian Base Gama' --location=/images/debian_base3.diskdump -p OS=linux -p user=someuser
184 f084bdc8 Stavros Sachtouris
    Metadata file /images/debian_base3.diskdump.meta already exists
185 0b158e6b Stavros Sachtouris
186 f6822a26 Stavros Sachtouris
It's true that a metafile with this name is already there, but we can override
187 f6822a26 Stavros Sachtouris
it (**-f**)
188 0b158e6b Stavros Sachtouris
189 0b158e6b Stavros Sachtouris
.. code-block:: console
190 0b158e6b Stavros Sachtouris
191 f084bdc8 Stavros Sachtouris
    kamaki image register -f --name='Debian Base Gama' --location=/images/debian_base3.diskdump -p OS=linux -p user=someuser
192 0b158e6b Stavros Sachtouris
193 0b158e6b Stavros Sachtouris
Register with a meta file
194 0b158e6b Stavros Sachtouris
-------------------------
195 0b158e6b Stavros Sachtouris
196 0b158e6b Stavros Sachtouris
Download the meta file of the image (it was uploaded recently)
197 0b158e6b Stavros Sachtouris
198 0b158e6b Stavros Sachtouris
.. code-block:: console
199 0b158e6b Stavros Sachtouris
200 f084bdc8 Stavros Sachtouris
    kamaki file download /images/debian_base3.diskdump.meta
201 f084bdc8 Stavros Sachtouris
    Downloading /images/debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta
202 0b158e6b Stavros Sachtouris
    Done
203 0b158e6b Stavros Sachtouris
204 f6822a26 Stavros Sachtouris
The metadata file can be edited. Let's edit the file to add these properties::
205 0b158e6b Stavros Sachtouris
206 278fae3f Stavros Sachtouris
    OS: linux
207 278fae3f Stavros Sachtouris
    USER: root
208 0b158e6b Stavros Sachtouris
209 0b158e6b Stavros Sachtouris
The resulting file will look like this:
210 0b158e6b Stavros Sachtouris
211 0b158e6b Stavros Sachtouris
.. code-block:: javascript
212 0b158e6b Stavros Sachtouris
213 0b158e6b Stavros Sachtouris
    {
214 abfaa6d9 Vangelis Koukis
      "status": "available",
215 abfaa6d9 Vangelis Koukis
      "name": "Debian Base Gama",
216 abfaa6d9 Vangelis Koukis
      "checksum": "3cb03556ec971f...e8dd6190443b560cb7",
217 abfaa6d9 Vangelis Koukis
      "id": "7h1rd-1m4g3-1d2",
218 abfaa6d9 Vangelis Koukis
      "updated-at": "2013-06-19 08:01:00",
219 abfaa6d9 Vangelis Koukis
      "created-at": "2013-06-19 08:00:22",
220 0b158e6b Stavros Sachtouris
      "properties": {
221 278fae3f Stavros Sachtouris
        "OS": "linux",
222 0b158e6b Stavros Sachtouris
        "USER": "root"
223 abfaa6d9 Vangelis Koukis
      },
224 f084bdc8 Stavros Sachtouris
      "location": "pithos://s0m3-u53r-1d/images/debian_base3.diskdump",
225 abfaa6d9 Vangelis Koukis
      "is-public": "False",
226 abfaa6d9 Vangelis Koukis
      "owner": "s0m3-u53r-1d",
227 abfaa6d9 Vangelis Koukis
      "disk-format": "diskdump",
228 abfaa6d9 Vangelis Koukis
      "size": "903471104",
229 abfaa6d9 Vangelis Koukis
      "deleted-at": "",
230 0b158e6b Stavros Sachtouris
      "container-format": "bare"
231 0b158e6b Stavros Sachtouris
    }
232 0b158e6b Stavros Sachtouris
233 0b158e6b Stavros Sachtouris
.. warning:: make sure the file is in a valid json format, otherwise image
234 0b158e6b Stavros Sachtouris
    register will fail
235 0b158e6b Stavros Sachtouris
236 278fae3f Stavros Sachtouris
In the following registration, the image name will change to a new one.
237 0b158e6b Stavros Sachtouris
238 0b158e6b Stavros Sachtouris
Register the image (don't forget the -f parameter, to override the metafile).
239 0b158e6b Stavros Sachtouris
240 0b158e6b Stavros Sachtouris
.. code-block:: console
241 0b158e6b Stavros Sachtouris
242 f084bdc8 Stavros Sachtouris
    kamaki image register -f --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta
243 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
244 0b158e6b Stavros Sachtouris
    container-format: bare
245 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
246 abfaa6d9 Vangelis Koukis
    deleted-at:
247 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
248 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
249 0b158e6b Stavros Sachtouris
    is-public:        False
250 f084bdc8 Stavros Sachtouris
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
251 0b158e6b Stavros Sachtouris
    name:             Debian Base Delta
252 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
253 abfaa6d9 Vangelis Koukis
    properties:
254 278fae3f Stavros Sachtouris
            OS:     linux
255 0b158e6b Stavros Sachtouris
            USER:   root
256 0b158e6b Stavros Sachtouris
    size:             903471104
257 0b158e6b Stavros Sachtouris
    status:           available
258 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
259 f084bdc8 Stavros Sachtouris
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1359)
260 0b158e6b Stavros Sachtouris
261 404eb288 Stavros Sachtouris
Metadata and Property modification
262 404eb288 Stavros Sachtouris
----------------------------------
263 404eb288 Stavros Sachtouris
264 f084bdc8 Stavros Sachtouris
According to the OpenStack terminology, the terms **metadata** and
265 f084bdc8 Stavros Sachtouris
**properties** are two different thinks, if we talk about images. **Metadata**
266 f084bdc8 Stavros Sachtouris
are all kinds of named metadata on an image. Some of them are assigned by the
267 f084bdc8 Stavros Sachtouris
system, some others are custom and set by the users who register the image.
268 f084bdc8 Stavros Sachtouris
These custom **metadata** are called **properties**.
269 f084bdc8 Stavros Sachtouris
270 f084bdc8 Stavros Sachtouris
Image **metadata** and custom **properties** can be modified even after the
271 f084bdc8 Stavros Sachtouris
image is registered. Metadata are fixed image attributes, like name, disk
272 f084bdc8 Stavros Sachtouris
format etc. while custom properties are set by the image owner and, usually,
273 f084bdc8 Stavros Sachtouris
refer to attributes of the images OS.
274 404eb288 Stavros Sachtouris
275 404eb288 Stavros Sachtouris
Let's rename the image:
276 404eb288 Stavros Sachtouris
277 404eb288 Stavros Sachtouris
.. code-block:: console
278 404eb288 Stavros Sachtouris
279 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --name='Changed Name'
280 404eb288 Stavros Sachtouris
281 f6822a26 Stavros Sachtouris
A look at the image metadata reveals that the name is changed:
282 404eb288 Stavros Sachtouris
283 404eb288 Stavros Sachtouris
.. code-block:: console
284 404eb288 Stavros Sachtouris
285 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
286 404eb288 Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
287 404eb288 Stavros Sachtouris
    container-format: bare
288 404eb288 Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
289 abfaa6d9 Vangelis Koukis
    deleted-at:
290 404eb288 Stavros Sachtouris
    disk-format:      diskdump
291 404eb288 Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
292 404eb288 Stavros Sachtouris
    is-public:        False
293 f084bdc8 Stavros Sachtouris
    location:         pithos://s0m3-u53r-1d/images/debian_base3.diskdump
294 404eb288 Stavros Sachtouris
    name:             Changed Name
295 404eb288 Stavros Sachtouris
    owner:            s0m3-u53r-1d
296 abfaa6d9 Vangelis Koukis
    properties:
297 278fae3f Stavros Sachtouris
            OS:     linux
298 404eb288 Stavros Sachtouris
            USER:   root
299 404eb288 Stavros Sachtouris
    size:             903471104
300 404eb288 Stavros Sachtouris
    status:           available
301 404eb288 Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
302 f084bdc8 Stavros Sachtouris
    kamaki
303 404eb288 Stavros Sachtouris
304 404eb288 Stavros Sachtouris
We can use the same idea to change the values of other metadata like disk
305 404eb288 Stavros Sachtouris
format, container format or status. On the other hand, we cannot modify the
306 023d5ada Stavros Sachtouris
id, owner, location, checksum and dates. e.g., to make an image public or
307 023d5ada Stavros Sachtouris
private:
308 404eb288 Stavros Sachtouris
309 404eb288 Stavros Sachtouris
.. code-block:: console
310 404eb288 Stavros Sachtouris
311 023d5ada Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --public --name='Debian Base Gama'
312 023d5ada Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --private
313 404eb288 Stavros Sachtouris
314 f6822a26 Stavros Sachtouris
The first call publishes the image (set is-public to True) and also restores
315 f6822a26 Stavros Sachtouris
the name to "Debian Base Gama". The second one unpublishes the image (set
316 404eb288 Stavros Sachtouris
is-public to False).
317 404eb288 Stavros Sachtouris
318 404eb288 Stavros Sachtouris
These operations can be used for properties with the same semantics:
319 404eb288 Stavros Sachtouris
320 404eb288 Stavros Sachtouris
.. code-block:: console
321 404eb288 Stavros Sachtouris
322 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d -p user=user
323 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
324 404eb288 Stavros Sachtouris
    ...
325 404eb288 Stavros Sachtouris
    properties:
326 278fae3f Stavros Sachtouris
            OS:     linux
327 404eb288 Stavros Sachtouris
            USER:   user
328 404eb288 Stavros Sachtouris
    ...
329 f084bdc8 Stavros Sachtouris
    kamaki
330 404eb288 Stavros Sachtouris
331 404eb288 Stavros Sachtouris
Just to test the feature, let's create a property "greet" with value
332 404eb288 Stavros Sachtouris
"hi there", and then remove it. Also, let's restore the value of USER:
333 404eb288 Stavros Sachtouris
334 404eb288 Stavros Sachtouris
.. code-block:: console
335 404eb288 Stavros Sachtouris
336 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d -p greet='Hi there' -p user=root
337 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
338 404eb288 Stavros Sachtouris
    ...
339 404eb288 Stavros Sachtouris
    properties:
340 278fae3f Stavros Sachtouris
            OS:     linux
341 404eb288 Stavros Sachtouris
            USER:   root
342 404eb288 Stavros Sachtouris
            GREET:  Hi there
343 404eb288 Stavros Sachtouris
    ...
344 c83cb9d9 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --property-del greet
345 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
346 404eb288 Stavros Sachtouris
    ...
347 404eb288 Stavros Sachtouris
    properties:
348 278fae3f Stavros Sachtouris
            OS:     linux
349 404eb288 Stavros Sachtouris
            USER:   root
350 404eb288 Stavros Sachtouris
    ...
351 f084bdc8 Stavros Sachtouris
    kamaki
352 404eb288 Stavros Sachtouris
353 404eb288 Stavros Sachtouris
354 0b158e6b Stavros Sachtouris
Reregistration: priorities and overrides
355 0b158e6b Stavros Sachtouris
----------------------------------------
356 0b158e6b Stavros Sachtouris
357 0b158e6b Stavros Sachtouris
Let's review the examples presented above::
358 0b158e6b Stavros Sachtouris
359 0b158e6b Stavros Sachtouris
    - Register an image with name `Debian Base Gama`
360 0b158e6b Stavros Sachtouris
    - Unregister the image
361 0b158e6b Stavros Sachtouris
    - Register a new image of the uploaded image object, with custom properties
362 0b158e6b Stavros Sachtouris
    - Reregister the image with a meta file and modified properties and name
363 0b158e6b Stavros Sachtouris
364 0b158e6b Stavros Sachtouris
**The image id is related to the image object**
365 0b158e6b Stavros Sachtouris
366 0b158e6b Stavros Sachtouris
Although the image was unregistered and reregistered, the image id, that is
367 0b158e6b Stavros Sachtouris
produced automatically at the server side, was the same. This is due to the
368 0b158e6b Stavros Sachtouris
fact that image ids are 1 to 1 related to image objects uploaded to Pithos+
369 0b158e6b Stavros Sachtouris
370 f6822a26 Stavros Sachtouris
**An explicit image name overrides the metafile**
371 0b158e6b Stavros Sachtouris
372 0b158e6b Stavros Sachtouris
Each image needs a name and this is given as the first argument of the
373 0b158e6b Stavros Sachtouris
`register` command. This name overrides the name in the metafile.
374 0b158e6b Stavros Sachtouris
375 f6822a26 Stavros Sachtouris
**Reregistration is not an update, but an override**
376 0b158e6b Stavros Sachtouris
377 0b158e6b Stavros Sachtouris
The property `user: root` won over `user: someuser`, because it was set last.
378 0b158e6b Stavros Sachtouris
Actually, all properties were replaced by the new ones, when the image was
379 0b158e6b Stavros Sachtouris
reregistered, and the same holds with all customizable attributes of the image.
380 0b158e6b Stavros Sachtouris
381 0b158e6b Stavros Sachtouris
Command line wins the metafile
382 0b158e6b Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
383 0b158e6b Stavros Sachtouris
384 0b158e6b Stavros Sachtouris
Let's compine the metafile with a command line attribute `user: admin`
385 0b158e6b Stavros Sachtouris
386 0b158e6b Stavros Sachtouris
.. code-block:: console
387 0b158e6b Stavros Sachtouris
388 f084bdc8 Stavros Sachtouris
    kamaki image register -f --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta
389 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
390 0b158e6b Stavros Sachtouris
    container-format: bare
391 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
392 abfaa6d9 Vangelis Koukis
    deleted-at:
393 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
394 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
395 0b158e6b Stavros Sachtouris
    is-public:        False
396 f084bdc8 Stavros Sachtouris
    location:         pithos://s0me-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
397 0b158e6b Stavros Sachtouris
    name:             Debian Base Delta
398 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
399 abfaa6d9 Vangelis Koukis
    properties:
400 278fae3f Stavros Sachtouris
            OS:     linux
401 0b158e6b Stavros Sachtouris
            USER:   root
402 0b158e6b Stavros Sachtouris
    size:             903471104
403 0b158e6b Stavros Sachtouris
    status:           available
404 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
405 f084bdc8 Stavros Sachtouris
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1377)
406 f084bdc8 Stavros Sachtouris
    kamaki
407 0b158e6b Stavros Sachtouris
408 0b158e6b Stavros Sachtouris
Although the property `OS` was read from the metafile, the property `USER` was
409 0b158e6b Stavros Sachtouris
set by the command line property to `admin`.
410 0b158e6b Stavros Sachtouris
411 0b158e6b Stavros Sachtouris
.. note:: This feature allows the use of a metafile as a template for uploading
412 0b158e6b Stavros Sachtouris
    multiple images with many common attributes but slight modifications per
413 0b158e6b Stavros Sachtouris
    image
414 0b158e6b Stavros Sachtouris
415 0b158e6b Stavros Sachtouris
Multiple metafile versions
416 0b158e6b Stavros Sachtouris
--------------------------
417 0b158e6b Stavros Sachtouris
418 0b158e6b Stavros Sachtouris
.. warning:: Make sure your container is set to auto, otherwise, there will be
419 0b158e6b Stavros Sachtouris
    no object versions
420 0b158e6b Stavros Sachtouris
421 0b158e6b Stavros Sachtouris
    .. code-block:: console
422 0b158e6b Stavros Sachtouris
423 f084bdc8 Stavros Sachtouris
        kamaki container info images | grep versioning
424 0b158e6b Stavros Sachtouris
        x-container-policy-versioning: auto
425 0b158e6b Stavros Sachtouris
426 0b158e6b Stavros Sachtouris
    To set versioning to auto
427 0b158e6b Stavros Sachtouris
428 0b158e6b Stavros Sachtouris
    .. code-block:: console
429 0b158e6b Stavros Sachtouris
430 f084bdc8 Stavros Sachtouris
        kamaki container modify images --versioning=auto
431 0b158e6b Stavros Sachtouris
432 0b158e6b Stavros Sachtouris
In the above examples, the image was registered many times by overriding the
433 0b158e6b Stavros Sachtouris
metafile. It is possible to avoid writing a metafile, as well as accessing
434 0b158e6b Stavros Sachtouris
older versions of the file.
435 0b158e6b Stavros Sachtouris
436 0b158e6b Stavros Sachtouris
Register the image without uploading a metafile
437 0b158e6b Stavros Sachtouris
438 0b158e6b Stavros Sachtouris
.. code-block:: console
439 0b158e6b Stavros Sachtouris
440 f084bdc8 Stavros Sachtouris
    kamaki image register --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta --no-metafile-upload
441 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
442 0b158e6b Stavros Sachtouris
    container-format: bare
443 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
444 abfaa6d9 Vangelis Koukis
    deleted-at:
445 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
446 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
447 0b158e6b Stavros Sachtouris
    is-public:        False
448 f084bdc8 Stavros Sachtouris
    location:         pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
449 0b158e6b Stavros Sachtouris
    name:             Debian Base Delta
450 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
451 abfaa6d9 Vangelis Koukis
    properties:
452 278fae3f Stavros Sachtouris
            OS:     linux
453 0b158e6b Stavros Sachtouris
            USER:   root
454 0b158e6b Stavros Sachtouris
    size:             903471104
455 0b158e6b Stavros Sachtouris
    status:           available
456 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
457 f084bdc8 Stavros Sachtouris
    kamaki
458 0b158e6b Stavros Sachtouris
459 0b158e6b Stavros Sachtouris
Uploaded metafiles are kept in versions, thanks to Pithos+ versioning support
460 0b158e6b Stavros Sachtouris
461 0b158e6b Stavros Sachtouris
.. code-block:: console
462 0b158e6b Stavros Sachtouris
463 f084bdc8 Stavros Sachtouris
    kamaki file info /images/debian_base3.diskdump.meta --object-versions
464 0b158e6b Stavros Sachtouris
    1352
465 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:00:22
466 0b158e6b Stavros Sachtouris
    1359
467 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:01:00
468 0b158e6b Stavros Sachtouris
    1377
469 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:34:37
470 f084bdc8 Stavros Sachtouris
    kamaki
471 0b158e6b Stavros Sachtouris
472 0b158e6b Stavros Sachtouris
Consult the first version of the metafile
473 0b158e6b Stavros Sachtouris
474 0b158e6b Stavros Sachtouris
.. code-block:: console
475 0b158e6b Stavros Sachtouris
476 f084bdc8 Stavros Sachtouris
    kamaki file cat --object-version=1352 /images/debian_base3.diskdump.meta
477 0b158e6b Stavros Sachtouris
    {
478 abfaa6d9 Vangelis Koukis
      "status": "available",
479 abfaa6d9 Vangelis Koukis
      "name": "Debian Base Gama",
480 abfaa6d9 Vangelis Koukis
      "checksum": "3cb03556ec971f...e8dd6190443b560cb7",
481 abfaa6d9 Vangelis Koukis
      "id": "7h1rd-1m4g3-1d2",
482 abfaa6d9 Vangelis Koukis
      "updated-at": "2013-06-19 08:01:00",
483 abfaa6d9 Vangelis Koukis
      "created-at": "2013-06-19 08:00:22",
484 abfaa6d9 Vangelis Koukis
      "properties": {},
485 f084bdc8 Stavros Sachtouris
      "location": "pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump",
486 abfaa6d9 Vangelis Koukis
      "is-public": "False",
487 abfaa6d9 Vangelis Koukis
      "owner": "s0m3-u53r-1d",
488 abfaa6d9 Vangelis Koukis
      "disk-format": "diskdump",
489 abfaa6d9 Vangelis Koukis
      "size": "903471104",
490 abfaa6d9 Vangelis Koukis
      "deleted-at": "",
491 0b158e6b Stavros Sachtouris
      "container-format": "bare"
492 0b158e6b Stavros Sachtouris
    }
493 0b158e6b Stavros Sachtouris
494 0b158e6b Stavros Sachtouris
Download the second version
495 0b158e6b Stavros Sachtouris
496 0b158e6b Stavros Sachtouris
.. code-block:: console
497 0b158e6b Stavros Sachtouris
498 f084bdc8 Stavros Sachtouris
    kamaki file download --object-version=1359 /images/debian_base3.diskdump.meta debian_base3.diskdump.meta.v1359
499 f084bdc8 Stavros Sachtouris
    Downloading /images/debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta.v1359
500 0b158e6b Stavros Sachtouris
    Done
501 0b158e6b Stavros Sachtouris
502 0b158e6b Stavros Sachtouris
Batch image upload
503 0b158e6b Stavros Sachtouris
------------------
504 0b158e6b Stavros Sachtouris
505 0b158e6b Stavros Sachtouris
Let a directory at /home/someuser/images with a variety of images needed to be
506 0b158e6b Stavros Sachtouris
uploaded and registered.
507 0b158e6b Stavros Sachtouris
508 0b158e6b Stavros Sachtouris
Batch-upload the images
509 0b158e6b Stavros Sachtouris
510 0b158e6b Stavros Sachtouris
.. code-block:: console
511 0b158e6b Stavros Sachtouris
512 f084bdc8 Stavros Sachtouris
    kamaki file upload -r images /images
513 f084bdc8 Stavros Sachtouris
    mkdir /images/images
514 f084bdc8 Stavros Sachtouris
    Uploading /home/someuser/images/debian.diskdump --> /images/images/debian.diskdump
515 f084bdc8 Stavros Sachtouris
    Uploading /home/someuser/images/win8.diskdump --> /images/images/win8.diskdump
516 0b158e6b Stavros Sachtouris
    ...
517 0b158e6b Stavros Sachtouris
    Done
518 0b158e6b Stavros Sachtouris
519 f084bdc8 Stavros Sachtouris
Make sure the images are uploaded to /images/images/ remote directory object
520 0b158e6b Stavros Sachtouris
521 0b158e6b Stavros Sachtouris
.. code-block:: console
522 0b158e6b Stavros Sachtouris
523 f084bdc8 Stavros Sachtouris
    kamaki file list /images/images/
524 0b158e6b Stavros Sachtouris
    D       images/
525 0b158e6b Stavros Sachtouris
    983MB   images/debian.diskdump
526 0b158e6b Stavros Sachtouris
    2.2GB   images/win8.diskdump
527 0b158e6b Stavros Sachtouris
    ...
528 f084bdc8 Stavros Sachtouris
    kamaki
529 0b158e6b Stavros Sachtouris
530 0b158e6b Stavros Sachtouris
Use the host shell capabilities to streamline the registration, so exit kamaki
531 0b158e6b Stavros Sachtouris
532 0b158e6b Stavros Sachtouris
.. code-block:: console
533 0b158e6b Stavros Sachtouris
534 f084bdc8 Stavros Sachtouris
    kamaki /exit