Statistics
| Branch: | Tag: | Revision:

root / docs / examplesdir / imageregister.rst @ 31cf20c5

History | View | Annotate | Download (16.7 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 16d7b9ff Stavros Sachtouris
id, owner, location, checksum and dates. e.g., to publish and unpublish:
307 404eb288 Stavros Sachtouris
308 404eb288 Stavros Sachtouris
.. code-block:: console
309 404eb288 Stavros Sachtouris
310 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --publish --name='Debian Base Gama'
311 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --unpublish
312 404eb288 Stavros Sachtouris
313 f6822a26 Stavros Sachtouris
The first call publishes the image (set is-public to True) and also restores
314 f6822a26 Stavros Sachtouris
the name to "Debian Base Gama". The second one unpublishes the image (set
315 404eb288 Stavros Sachtouris
is-public to False).
316 404eb288 Stavros Sachtouris
317 404eb288 Stavros Sachtouris
These operations can be used for properties with the same semantics:
318 404eb288 Stavros Sachtouris
319 404eb288 Stavros Sachtouris
.. code-block:: console
320 404eb288 Stavros Sachtouris
321 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d -p user=user
322 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
323 404eb288 Stavros Sachtouris
    ...
324 404eb288 Stavros Sachtouris
    properties:
325 278fae3f Stavros Sachtouris
            OS:     linux
326 404eb288 Stavros Sachtouris
            USER:   user
327 404eb288 Stavros Sachtouris
    ...
328 f084bdc8 Stavros Sachtouris
    kamaki
329 404eb288 Stavros Sachtouris
330 404eb288 Stavros Sachtouris
Just to test the feature, let's create a property "greet" with value
331 404eb288 Stavros Sachtouris
"hi there", and then remove it. Also, let's restore the value of USER:
332 404eb288 Stavros Sachtouris
333 404eb288 Stavros Sachtouris
.. code-block:: console
334 404eb288 Stavros Sachtouris
335 f084bdc8 Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d -p greet='Hi there' -p user=root
336 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
337 404eb288 Stavros Sachtouris
    ...
338 404eb288 Stavros Sachtouris
    properties:
339 278fae3f Stavros Sachtouris
            OS:     linux
340 404eb288 Stavros Sachtouris
            USER:   root
341 404eb288 Stavros Sachtouris
            GREET:  Hi there
342 404eb288 Stavros Sachtouris
    ...
343 bf88122d Stavros Sachtouris
    kamaki image modify 7h1rd-1m4g3-1d --property-del greet
344 f084bdc8 Stavros Sachtouris
    kamaki image info 7h1rd-1m4g3-1d
345 404eb288 Stavros Sachtouris
    ...
346 404eb288 Stavros Sachtouris
    properties:
347 278fae3f Stavros Sachtouris
            OS:     linux
348 404eb288 Stavros Sachtouris
            USER:   root
349 404eb288 Stavros Sachtouris
    ...
350 f084bdc8 Stavros Sachtouris
    kamaki
351 404eb288 Stavros Sachtouris
352 404eb288 Stavros Sachtouris
353 0b158e6b Stavros Sachtouris
Reregistration: priorities and overrides
354 0b158e6b Stavros Sachtouris
----------------------------------------
355 0b158e6b Stavros Sachtouris
356 0b158e6b Stavros Sachtouris
Let's review the examples presented above::
357 0b158e6b Stavros Sachtouris
358 0b158e6b Stavros Sachtouris
    - Register an image with name `Debian Base Gama`
359 0b158e6b Stavros Sachtouris
    - Unregister the image
360 0b158e6b Stavros Sachtouris
    - Register a new image of the uploaded image object, with custom properties
361 0b158e6b Stavros Sachtouris
    - Reregister the image with a meta file and modified properties and name
362 0b158e6b Stavros Sachtouris
363 0b158e6b Stavros Sachtouris
**The image id is related to the image object**
364 0b158e6b Stavros Sachtouris
365 0b158e6b Stavros Sachtouris
Although the image was unregistered and reregistered, the image id, that is
366 0b158e6b Stavros Sachtouris
produced automatically at the server side, was the same. This is due to the
367 0b158e6b Stavros Sachtouris
fact that image ids are 1 to 1 related to image objects uploaded to Pithos+
368 0b158e6b Stavros Sachtouris
369 f6822a26 Stavros Sachtouris
**An explicit image name overrides the metafile**
370 0b158e6b Stavros Sachtouris
371 0b158e6b Stavros Sachtouris
Each image needs a name and this is given as the first argument of the
372 0b158e6b Stavros Sachtouris
`register` command. This name overrides the name in the metafile.
373 0b158e6b Stavros Sachtouris
374 f6822a26 Stavros Sachtouris
**Reregistration is not an update, but an override**
375 0b158e6b Stavros Sachtouris
376 0b158e6b Stavros Sachtouris
The property `user: root` won over `user: someuser`, because it was set last.
377 0b158e6b Stavros Sachtouris
Actually, all properties were replaced by the new ones, when the image was
378 0b158e6b Stavros Sachtouris
reregistered, and the same holds with all customizable attributes of the image.
379 0b158e6b Stavros Sachtouris
380 0b158e6b Stavros Sachtouris
Command line wins the metafile
381 0b158e6b Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382 0b158e6b Stavros Sachtouris
383 0b158e6b Stavros Sachtouris
Let's compine the metafile with a command line attribute `user: admin`
384 0b158e6b Stavros Sachtouris
385 0b158e6b Stavros Sachtouris
.. code-block:: console
386 0b158e6b Stavros Sachtouris
387 f084bdc8 Stavros Sachtouris
    kamaki image register -f --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta
388 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
389 0b158e6b Stavros Sachtouris
    container-format: bare
390 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
391 abfaa6d9 Vangelis Koukis
    deleted-at:
392 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
393 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
394 0b158e6b Stavros Sachtouris
    is-public:        False
395 f084bdc8 Stavros Sachtouris
    location:         pithos://s0me-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
396 0b158e6b Stavros Sachtouris
    name:             Debian Base Delta
397 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
398 abfaa6d9 Vangelis Koukis
    properties:
399 278fae3f Stavros Sachtouris
            OS:     linux
400 0b158e6b Stavros Sachtouris
            USER:   root
401 0b158e6b Stavros Sachtouris
    size:             903471104
402 0b158e6b Stavros Sachtouris
    status:           available
403 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
404 f084bdc8 Stavros Sachtouris
    Metadata file uploaded as /images/debian_base3.diskdump.meta (version 1377)
405 f084bdc8 Stavros Sachtouris
    kamaki
406 0b158e6b Stavros Sachtouris
407 0b158e6b Stavros Sachtouris
Although the property `OS` was read from the metafile, the property `USER` was
408 0b158e6b Stavros Sachtouris
set by the command line property to `admin`.
409 0b158e6b Stavros Sachtouris
410 0b158e6b Stavros Sachtouris
.. note:: This feature allows the use of a metafile as a template for uploading
411 0b158e6b Stavros Sachtouris
    multiple images with many common attributes but slight modifications per
412 0b158e6b Stavros Sachtouris
    image
413 0b158e6b Stavros Sachtouris
414 0b158e6b Stavros Sachtouris
Multiple metafile versions
415 0b158e6b Stavros Sachtouris
--------------------------
416 0b158e6b Stavros Sachtouris
417 0b158e6b Stavros Sachtouris
.. warning:: Make sure your container is set to auto, otherwise, there will be
418 0b158e6b Stavros Sachtouris
    no object versions
419 0b158e6b Stavros Sachtouris
420 0b158e6b Stavros Sachtouris
    .. code-block:: console
421 0b158e6b Stavros Sachtouris
422 f084bdc8 Stavros Sachtouris
        kamaki container info images | grep versioning
423 0b158e6b Stavros Sachtouris
        x-container-policy-versioning: auto
424 0b158e6b Stavros Sachtouris
425 0b158e6b Stavros Sachtouris
    To set versioning to auto
426 0b158e6b Stavros Sachtouris
427 0b158e6b Stavros Sachtouris
    .. code-block:: console
428 0b158e6b Stavros Sachtouris
429 f084bdc8 Stavros Sachtouris
        kamaki container modify images --versioning=auto
430 0b158e6b Stavros Sachtouris
431 0b158e6b Stavros Sachtouris
In the above examples, the image was registered many times by overriding the
432 0b158e6b Stavros Sachtouris
metafile. It is possible to avoid writing a metafile, as well as accessing
433 0b158e6b Stavros Sachtouris
older versions of the file.
434 0b158e6b Stavros Sachtouris
435 0b158e6b Stavros Sachtouris
Register the image without uploading a metafile
436 0b158e6b Stavros Sachtouris
437 0b158e6b Stavros Sachtouris
.. code-block:: console
438 0b158e6b Stavros Sachtouris
439 f084bdc8 Stavros Sachtouris
    kamaki image register --name='Debian Base Delta' --location=/images/debian_base3.diskdump --metafile=debian_base3.diskdump.meta --no-metafile-upload
440 0b158e6b Stavros Sachtouris
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
441 0b158e6b Stavros Sachtouris
    container-format: bare
442 0b158e6b Stavros Sachtouris
    created-at:       2013-06-19 08:00:22
443 abfaa6d9 Vangelis Koukis
    deleted-at:
444 0b158e6b Stavros Sachtouris
    disk-format:      diskdump
445 0b158e6b Stavros Sachtouris
    id:               7h1rd-1m4g3-1d
446 0b158e6b Stavros Sachtouris
    is-public:        False
447 f084bdc8 Stavros Sachtouris
    location:         pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump
448 0b158e6b Stavros Sachtouris
    name:             Debian Base Delta
449 0b158e6b Stavros Sachtouris
    owner:            s0m3-u53r-1d
450 abfaa6d9 Vangelis Koukis
    properties:
451 278fae3f Stavros Sachtouris
            OS:     linux
452 0b158e6b Stavros Sachtouris
            USER:   root
453 0b158e6b Stavros Sachtouris
    size:             903471104
454 0b158e6b Stavros Sachtouris
    status:           available
455 0b158e6b Stavros Sachtouris
    updated-at:       2013-06-19 08:01:00
456 f084bdc8 Stavros Sachtouris
    kamaki
457 0b158e6b Stavros Sachtouris
458 0b158e6b Stavros Sachtouris
Uploaded metafiles are kept in versions, thanks to Pithos+ versioning support
459 0b158e6b Stavros Sachtouris
460 0b158e6b Stavros Sachtouris
.. code-block:: console
461 0b158e6b Stavros Sachtouris
462 f084bdc8 Stavros Sachtouris
    kamaki file info /images/debian_base3.diskdump.meta --object-versions
463 0b158e6b Stavros Sachtouris
    1352
464 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:00:22
465 0b158e6b Stavros Sachtouris
    1359
466 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:01:00
467 0b158e6b Stavros Sachtouris
    1377
468 0b158e6b Stavros Sachtouris
     created: 19-06-2013 11:34:37
469 f084bdc8 Stavros Sachtouris
    kamaki
470 0b158e6b Stavros Sachtouris
471 0b158e6b Stavros Sachtouris
Consult the first version of the metafile
472 0b158e6b Stavros Sachtouris
473 0b158e6b Stavros Sachtouris
.. code-block:: console
474 0b158e6b Stavros Sachtouris
475 f084bdc8 Stavros Sachtouris
    kamaki file cat --object-version=1352 /images/debian_base3.diskdump.meta
476 0b158e6b Stavros Sachtouris
    {
477 abfaa6d9 Vangelis Koukis
      "status": "available",
478 abfaa6d9 Vangelis Koukis
      "name": "Debian Base Gama",
479 abfaa6d9 Vangelis Koukis
      "checksum": "3cb03556ec971f...e8dd6190443b560cb7",
480 abfaa6d9 Vangelis Koukis
      "id": "7h1rd-1m4g3-1d2",
481 abfaa6d9 Vangelis Koukis
      "updated-at": "2013-06-19 08:01:00",
482 abfaa6d9 Vangelis Koukis
      "created-at": "2013-06-19 08:00:22",
483 abfaa6d9 Vangelis Koukis
      "properties": {},
484 f084bdc8 Stavros Sachtouris
      "location": "pithos://s0m3-u53r/images/s0m3-u53r-1d/images/debian_base3.diskdump",
485 abfaa6d9 Vangelis Koukis
      "is-public": "False",
486 abfaa6d9 Vangelis Koukis
      "owner": "s0m3-u53r-1d",
487 abfaa6d9 Vangelis Koukis
      "disk-format": "diskdump",
488 abfaa6d9 Vangelis Koukis
      "size": "903471104",
489 abfaa6d9 Vangelis Koukis
      "deleted-at": "",
490 0b158e6b Stavros Sachtouris
      "container-format": "bare"
491 0b158e6b Stavros Sachtouris
    }
492 0b158e6b Stavros Sachtouris
493 0b158e6b Stavros Sachtouris
Download the second version
494 0b158e6b Stavros Sachtouris
495 0b158e6b Stavros Sachtouris
.. code-block:: console
496 0b158e6b Stavros Sachtouris
497 f084bdc8 Stavros Sachtouris
    kamaki file download --object-version=1359 /images/debian_base3.diskdump.meta debian_base3.diskdump.meta.v1359
498 f084bdc8 Stavros Sachtouris
    Downloading /images/debian_base3.diskdump.meta --> /home/someuser/debian_base3.diskdump.meta.v1359
499 0b158e6b Stavros Sachtouris
    Done
500 0b158e6b Stavros Sachtouris
501 0b158e6b Stavros Sachtouris
Batch image upload
502 0b158e6b Stavros Sachtouris
------------------
503 0b158e6b Stavros Sachtouris
504 0b158e6b Stavros Sachtouris
Let a directory at /home/someuser/images with a variety of images needed to be
505 0b158e6b Stavros Sachtouris
uploaded and registered.
506 0b158e6b Stavros Sachtouris
507 0b158e6b Stavros Sachtouris
Batch-upload the images
508 0b158e6b Stavros Sachtouris
509 0b158e6b Stavros Sachtouris
.. code-block:: console
510 0b158e6b Stavros Sachtouris
511 f084bdc8 Stavros Sachtouris
    kamaki file upload -r images /images
512 f084bdc8 Stavros Sachtouris
    mkdir /images/images
513 f084bdc8 Stavros Sachtouris
    Uploading /home/someuser/images/debian.diskdump --> /images/images/debian.diskdump
514 f084bdc8 Stavros Sachtouris
    Uploading /home/someuser/images/win8.diskdump --> /images/images/win8.diskdump
515 0b158e6b Stavros Sachtouris
    ...
516 0b158e6b Stavros Sachtouris
    Done
517 0b158e6b Stavros Sachtouris
518 f084bdc8 Stavros Sachtouris
Make sure the images are uploaded to /images/images/ remote directory object
519 0b158e6b Stavros Sachtouris
520 0b158e6b Stavros Sachtouris
.. code-block:: console
521 0b158e6b Stavros Sachtouris
522 f084bdc8 Stavros Sachtouris
    kamaki file list /images/images/
523 0b158e6b Stavros Sachtouris
    D       images/
524 0b158e6b Stavros Sachtouris
    983MB   images/debian.diskdump
525 0b158e6b Stavros Sachtouris
    2.2GB   images/win8.diskdump
526 0b158e6b Stavros Sachtouris
    ...
527 f084bdc8 Stavros Sachtouris
    kamaki
528 0b158e6b Stavros Sachtouris
529 0b158e6b Stavros Sachtouris
Use the host shell capabilities to streamline the registration, so exit kamaki
530 0b158e6b Stavros Sachtouris
531 0b158e6b Stavros Sachtouris
.. code-block:: console
532 0b158e6b Stavros Sachtouris
533 f084bdc8 Stavros Sachtouris
    kamaki /exit