Revision 404eb288 docs/collection_of_examples/imageregister.rst

b/docs/collection_of_examples/imageregister.rst
240 240
    Metadata file uploaded as pithos:debian_base3.diskdump.meta (version 1359)
241 241
    [kamaki]:
242 242

  
243
Metadata and Property modification
244
----------------------------------
245

  
246
Image metadata and custom properties can be modified even after the image is
247
registered. Metadata are fixed image attributes, like name, disk format etc.
248
while custom properties are set by the image owner and, usually, refer to
249
attributes of the images OS.
250

  
251
Let's rename the image:
252

  
253
.. code-block:: console
254

  
255
    [kamaki]: image meta set 7h1rd-1m4g3-1d --name='Changed Name'
256
    [kamaki]:
257

  
258
If we, now, list the image metadata, we will see that the name is changed:
259

  
260
.. code-block:: console
261

  
262
    [kamaki]: image meta list 7h1rd-1m4g3-1d
263
    checksum:         3cb03556ec971f...e8dd6190443b560cb7
264
    container-format: bare
265
    created-at:       2013-06-19 08:00:22
266
    deleted-at:       
267
    disk-format:      diskdump
268
    id:               7h1rd-1m4g3-1d
269
    is-public:        False
270
    location:         pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
271
    name:             Changed Name
272
    owner:            s0m3-u53r-1d
273
    properties:      
274
            OS:     Linux
275
            USER:   root
276
    size:             903471104
277
    status:           available
278
    updated-at:       2013-06-19 08:01:00
279
    [kamaki]:
280

  
281
We can use the same idea to change the values of other metadata like disk
282
format, container format or status. On the other hand, we cannot modify the
283
id, owner, location, checksum and dates. E.g., to publish and unpublish:
284

  
285
.. code-block:: console
286

  
287
    [kamaki]: image meta set 7h1rd-1m4g3-1d --publish --name='Debian Base Gama'
288
    [kamaki]: image meta set 7h1rd-1m4g3-1d --unpublish
289
    [kamaki]:
290

  
291
The first call published the image (set is-public to True) and also restored
292
the name to "Debian Base Gama". The second one unpublished the image (set
293
is-public to False).
294

  
295
To delete metadata, use the image meta delete method:
296

  
297
.. code-block:: console
298

  
299
    [kamaki]: image meta delete 7h1rd-1m4g3-1d status
300
    [kamaki]:
301

  
302
will empty the value of "status".
303

  
304
These operations can be used for properties with the same semantics:
305

  
306
.. code-block:: console
307

  
308
    [kamaki]: image meta set 7h1rd-1m4g3-1d -p user=user
309
    [kamaki]: image meta list 7h1rd-1m4g3-1d
310
    ...
311
    properties:
312
            OS:     Linux
313
            USER:   user
314
    ...
315
    [kamaki]:
316

  
317
Just to test the feature, let's create a property "greet" with value
318
"hi there", and then remove it. Also, let's restore the value of USER:
319

  
320
.. code-block:: console
321

  
322
    [kamaki]: image meta set 7h1rd-1m4g3-1d -p greet='Hi there' -p user=root
323
    [kamaki]: image meta list 7h1rd-1m4g3-1d
324
    ...
325
    properties:
326
            OS:     Linux
327
            USER:   root
328
            GREET:  Hi there
329
    ...
330
    [kamaki]: image meta delete 7h1rd-1m4g3-1d -p greet
331
    [kamaki]: image meta list 7h1rd-1m4g3-1d
332
    ...
333
    properties:
334
            OS:     Linux
335
            USER:   root
336
    ...
337
    [kamaki]:
338

  
339

  
243 340
Reregistration: priorities and overrides
244 341
----------------------------------------
245 342

  

Also available in: Unified diff