Changes in v4:
- removed POST documentation (not supported) and added GET and PUT documentation in
API.md
Changes in v3:
- changed the name of the new parameter to 'format' instead of 'type'
- added all the supported disk formats in i18n.py messages
- using 'GET' to retrieve the updated value in unit tests
Changes in v2:
- added unit tests
- added support to all default disk types
These patches implement the backend support to change the disk format
when editing a template.
Example of usage:
1- create a test template:
$ curl -u user -H "Content-Type: application/json -H "Accept:
application/json"
http://localhost:8010/templates -X POST -d'{"name":
"test_template", "cdrom": "/valid/iso/path.iso"}'
2- change the disk format to 'cloop':
$ curl -u user -H "Content-Type: application/json -H "Accept:
application/json"
http://localhost:8010/templates/test_template -X PUT
-d'{"disks":[{"index":0,"size":10, "format":
"cloop"}]}'
3- retrieve the template to see the changes:
$ curl -u user -H "Content-Type: application/json -H "Accept:
application/json"
http://localhost:8010/templates/test_template -X GET
Enter host password for user 'user':
{
"cpus":1,
"cpu_info":{},
"graphics":{
"type":"vnc",
"listen":"127.0.0.1"
},
"cdrom":"/valid/iso/path.iso",
"networks":[
"default"
],
"icon":"images/icon-opensuse.png",
"os_distro":"opensuse",
"name":"test_template",
"disks":[
{
"index":0,
"size":10,
"format":"cloop"
}
],
"invalid":{},
"os_version":"13.1",
"storagepool":"/storagepools/default",
"memory":1024,
"folder":[]
}
Daniel Henrique Barboza (2):
Choose disk image format in vm template - backend
Unit tests for the new disk image format
docs/API.md | 6 ++--
src/kimchi/API.json | 8 +++++-
src/kimchi/i18n.py | 3 +-
src/kimchi/vmtemplate.py | 5 +++-
tests/test_mockmodel.py | 75 ++++++++++++++++++++++++++++++++++++++++--------
tests/test_model.py | 14 +++++++++
6 files changed, 94 insertions(+), 17 deletions(-)
--
1.8.3.1