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