[PATCH][Kimchi 0/3] Issue #857: Support VM description

Ramon Medeiros (3): Issue #857: Support VM description Update tests Update docs API.json | 20 ++++++++++++++++++++ docs/API.md | 6 ++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- tests/test_mockmodel.py | 3 ++- tests/test_model.py | 3 ++- vmtemplate.py | 5 ++++- 7 files changed, 57 insertions(+), 6 deletions(-) -- 2.5.5

Able Kimchi to add description and title while creating and updating vms Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- API.json | 20 ++++++++++++++++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- vmtemplate.py | 5 ++++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/API.json b/API.json index 4fdd522..a3af02d 100644 --- a/API.json +++ b/API.json @@ -268,6 +268,16 @@ "pattern": "^[^/]*$", "error": "KCHVM0011E" }, + "title": { + "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "template": { "description": "The URI of a template to use when building a VM", "type": "string", @@ -294,6 +304,16 @@ "minLength": 1, "error": "KCHVM0011E" }, + "title": { + "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "bootorder": { "description": "Boot order", "type": "array", diff --git a/i18n.py b/i18n.py index 7625469..fd4b6db 100644 --- a/i18n.py +++ b/i18n.py @@ -135,6 +135,8 @@ messages = { "KCHVM0082E": _("Either the guest %(name)s did not start to listen to the serial or it is not configured to use the serial console."), "KCHVM0083E": _("Unable to retrieve Virt Viewer file for stopped virtual machine %(name)s"), "KCHVM0084E": _("Error occured while retrieving the Virt Viewer file for virtual machine %(name)s : %(err)s"), + "KCHVM0085E": _("VM Title must be a string"), + "KCHVM0086E": _("VM Description must be a string"), "KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."), "KCHVMHDEV0002E": _("The host device %(dev_name)s is not allowed to directly assign to VM."), diff --git a/model/vms.py b/model/vms.py index 433770a..2c6c63c 100644 --- a/model/vms.py +++ b/model/vms.py @@ -83,7 +83,8 @@ VM_ONLINE_UPDATE_PARAMS = ['graphics', 'groups', 'memory', 'users'] # update parameters which are updatable when the VM is offline VM_OFFLINE_UPDATE_PARAMS = ['cpu_info', 'graphics', 'groups', 'memory', - 'name', 'users', 'bootorder', 'bootmenu'] + 'name', 'users', 'bootorder', 'bootmenu', + 'description', 'title'] XPATH_DOMAIN_DISK = "/domain/devices/disk[@device='disk']/source/@file" XPATH_DOMAIN_DISK_BY_FILE = "./devices/disk[@device='disk']/source[@file='%s']" @@ -98,10 +99,12 @@ XPATH_DOMAIN_DEV_CPU_ID = '/domain/devices/spapr-cpu-socket/@id' XPATH_BOOT = 'os/boot/@dev' XPATH_BOOTMENU = 'os/bootmenu/@enable' XPATH_CPU = './cpu' +XPATH_DESCRIPTION = './description' XPATH_NAME = './name' XPATH_NUMA_CELL = './cpu/numa/cell' XPATH_SNAP_VM_NAME = './domain/name' XPATH_SNAP_VM_UUID = './domain/uuid' +XPATH_TITLE = './title' XPATH_TOPOLOGY = './cpu/topology' XPATH_VCPU = './vcpu' XPATH_MAX_MEMORY = './maxMemory' @@ -138,7 +141,9 @@ class VMsModel(object): t.validate() data = {'name': name, 'template': t, - 'graphics': params.get('graphics', {})} + 'graphics': params.get('graphics', {}), + "title": params.get("title", ""), + "description": params.get("description", "")} taskid = add_task(u'/plugins/kimchi/vms/%s' % name, self._create_task, self.objstore, data) @@ -152,6 +157,8 @@ class VMsModel(object): - name: The name for the new VM """ vm_uuid = str(uuid.uuid4()) + title = params.get('title', '') + description = params.get('description', '') t = params['template'] name, nonascii_name = get_ascii_nonascii_name(params['name']) conn = self.conn.get() @@ -178,7 +185,8 @@ class VMsModel(object): xml = t.to_vm_xml(name, vm_uuid, libvirt_stream_protocols=stream_protocols, graphics=graphics, - mem_hotplug_support=self.caps.mem_hotplug_support) + mem_hotplug_support=self.caps.mem_hotplug_support, + title=title, description=description) cb('Defining new VM') try: @@ -786,6 +794,14 @@ class VMModel(object): name, nonascii_name = get_ascii_nonascii_name(name) new_xml = xml_item_update(new_xml, XPATH_NAME, name, None) + if 'title' in params: + new_xml = xml_item_update(new_xml, XPATH_TITLE, params['title'], + None) + + if 'description' in params: + new_xml = xml_item_update(new_xml, XPATH_DESCRIPTION, + params['description'], None) + # Update CPU info cpu_info = params.get('cpu_info', {}) cpu_info = self._update_cpu_info(new_xml, dom, cpu_info) @@ -1267,6 +1283,8 @@ class VMModel(object): else "no" return {'name': name, + 'title': "".join(xpath_get_text(xml, XPATH_TITLE)), + 'description': "".join(xpath_get_text(xml, XPATH_DESCRIPTION)), 'state': state, 'stats': res, 'uuid': dom.UUIDString(), diff --git a/vmtemplate.py b/vmtemplate.py index dc81fe2..79730cf 100644 --- a/vmtemplate.py +++ b/vmtemplate.py @@ -347,7 +347,8 @@ class VMTemplate(object): params['qemu-stream-cmdline'] = '' params['disks'] = self._get_disks_xml(vm_uuid) params['serial'] = get_serial_xml(params) - + params['title'] = kwargs.get('title', '') + params['description'] = kwargs.get('description', '') graphics = dict(self.info['graphics']) graphics.update(kwargs.get('graphics', {})) # Graphics is not supported on s390x, this check will @@ -404,6 +405,8 @@ class VMTemplate(object): <domain type='%(domain)s'> %(qemu-stream-cmdline)s <name>%(name)s</name> + <title>%(title)s</title> + <description>%(description)s</description> <uuid>%(uuid)s</uuid> <memtune> <hard_limit unit='MiB'>%(hard_limit)s</hard_limit> -- 2.5.5

On Aug 16 01:24PM, Ramon Medeiros wrote:
Able Kimchi to add description and title while creating and updating vms
Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- API.json | 20 ++++++++++++++++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- vmtemplate.py | 5 ++++- 4 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/API.json b/API.json index 4fdd522..a3af02d 100644 --- a/API.json +++ b/API.json @@ -268,6 +268,16 @@ "pattern": "^[^/]*$", "error": "KCHVM0011E" }, + "title": {
Just a conceptual question: what's a title? Better: What's the difference between title and name?
+ "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "template": { "description": "The URI of a template to use when building a VM", "type": "string", @@ -294,6 +304,16 @@ "minLength": 1, "error": "KCHVM0011E" }, + "title": { + "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "bootorder": { "description": "Boot order", "type": "array", diff --git a/i18n.py b/i18n.py index 7625469..fd4b6db 100644 --- a/i18n.py +++ b/i18n.py @@ -135,6 +135,8 @@ messages = { "KCHVM0082E": _("Either the guest %(name)s did not start to listen to the serial or it is not configured to use the serial console."), "KCHVM0083E": _("Unable to retrieve Virt Viewer file for stopped virtual machine %(name)s"), "KCHVM0084E": _("Error occured while retrieving the Virt Viewer file for virtual machine %(name)s : %(err)s"), + "KCHVM0085E": _("VM Title must be a string"), + "KCHVM0086E": _("VM Description must be a string"),
I did not checked all KCHVM* messages, but I think we are not using the term 'VM' but 'virtual machine'. If so, need change here and also in patch 3/3.
"KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."), "KCHVMHDEV0002E": _("The host device %(dev_name)s is not allowed to directly assign to VM."), diff --git a/model/vms.py b/model/vms.py index 433770a..2c6c63c 100644 --- a/model/vms.py +++ b/model/vms.py @@ -83,7 +83,8 @@ VM_ONLINE_UPDATE_PARAMS = ['graphics', 'groups', 'memory', 'users']
# update parameters which are updatable when the VM is offline VM_OFFLINE_UPDATE_PARAMS = ['cpu_info', 'graphics', 'groups', 'memory', - 'name', 'users', 'bootorder', 'bootmenu'] + 'name', 'users', 'bootorder', 'bootmenu', + 'description', 'title']
XPATH_DOMAIN_DISK = "/domain/devices/disk[@device='disk']/source/@file" XPATH_DOMAIN_DISK_BY_FILE = "./devices/disk[@device='disk']/source[@file='%s']" @@ -98,10 +99,12 @@ XPATH_DOMAIN_DEV_CPU_ID = '/domain/devices/spapr-cpu-socket/@id' XPATH_BOOT = 'os/boot/@dev' XPATH_BOOTMENU = 'os/bootmenu/@enable' XPATH_CPU = './cpu' +XPATH_DESCRIPTION = './description' XPATH_NAME = './name' XPATH_NUMA_CELL = './cpu/numa/cell' XPATH_SNAP_VM_NAME = './domain/name' XPATH_SNAP_VM_UUID = './domain/uuid' +XPATH_TITLE = './title' XPATH_TOPOLOGY = './cpu/topology' XPATH_VCPU = './vcpu' XPATH_MAX_MEMORY = './maxMemory' @@ -138,7 +141,9 @@ class VMsModel(object):
t.validate() data = {'name': name, 'template': t, - 'graphics': params.get('graphics', {})} + 'graphics': params.get('graphics', {}), + "title": params.get("title", ""), + "description": params.get("description", "")} taskid = add_task(u'/plugins/kimchi/vms/%s' % name, self._create_task, self.objstore, data)
@@ -152,6 +157,8 @@ class VMsModel(object): - name: The name for the new VM """ vm_uuid = str(uuid.uuid4()) + title = params.get('title', '') + description = params.get('description', '') t = params['template'] name, nonascii_name = get_ascii_nonascii_name(params['name']) conn = self.conn.get() @@ -178,7 +185,8 @@ class VMsModel(object): xml = t.to_vm_xml(name, vm_uuid, libvirt_stream_protocols=stream_protocols, graphics=graphics, - mem_hotplug_support=self.caps.mem_hotplug_support) + mem_hotplug_support=self.caps.mem_hotplug_support, + title=title, description=description)
cb('Defining new VM') try: @@ -786,6 +794,14 @@ class VMModel(object): name, nonascii_name = get_ascii_nonascii_name(name) new_xml = xml_item_update(new_xml, XPATH_NAME, name, None)
+ if 'title' in params: + new_xml = xml_item_update(new_xml, XPATH_TITLE, params['title'], + None) + + if 'description' in params: + new_xml = xml_item_update(new_xml, XPATH_DESCRIPTION, + params['description'], None) + # Update CPU info cpu_info = params.get('cpu_info', {}) cpu_info = self._update_cpu_info(new_xml, dom, cpu_info) @@ -1267,6 +1283,8 @@ class VMModel(object): else "no"
return {'name': name, + 'title': "".join(xpath_get_text(xml, XPATH_TITLE)), + 'description': "".join(xpath_get_text(xml, XPATH_DESCRIPTION)), 'state': state, 'stats': res, 'uuid': dom.UUIDString(), diff --git a/vmtemplate.py b/vmtemplate.py index dc81fe2..79730cf 100644 --- a/vmtemplate.py +++ b/vmtemplate.py @@ -347,7 +347,8 @@ class VMTemplate(object): params['qemu-stream-cmdline'] = '' params['disks'] = self._get_disks_xml(vm_uuid) params['serial'] = get_serial_xml(params) - + params['title'] = kwargs.get('title', '') + params['description'] = kwargs.get('description', '') graphics = dict(self.info['graphics']) graphics.update(kwargs.get('graphics', {})) # Graphics is not supported on s390x, this check will @@ -404,6 +405,8 @@ class VMTemplate(object): <domain type='%(domain)s'> %(qemu-stream-cmdline)s <name>%(name)s</name> + <title>%(title)s</title> + <description>%(description)s</description> <uuid>%(uuid)s</uuid> <memtune> <hard_limit unit='MiB'>%(hard_limit)s</hard_limit> -- 2.5.5
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Paulo Ricardo Paz Vital Linux Technology Center, IBM Systems http://www.ibm.com/linux/ltc/

On 08/16/2016 02:02 PM, Paulo Ricardo Paz Vital wrote:
On Aug 16 01:24PM, Ramon Medeiros wrote:
Able Kimchi to add description and title while creating and updating vms
Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- API.json | 20 ++++++++++++++++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- vmtemplate.py | 5 ++++- 4 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/API.json b/API.json index 4fdd522..a3af02d 100644 --- a/API.json +++ b/API.json @@ -268,6 +268,16 @@ "pattern": "^[^/]*$", "error": "KCHVM0011E" }, + "title": { Just a conceptual question: what's a title? Better: What's the difference between title and name? name is used by the commands. Title can be a verbose name for vm. ex:
name: centos_13932193 title: Web Server based on CentOs
+ "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "template": { "description": "The URI of a template to use when building a VM", "type": "string", @@ -294,6 +304,16 @@ "minLength": 1, "error": "KCHVM0011E" }, + "title": { + "description": "Title of VM", + "type": "string", + "error": "KCHVM0085E" + }, + "description": { + "description": "Description of VM", + "type": "string", + "error": "KCHVM0086E" + }, "bootorder": { "description": "Boot order", "type": "array", diff --git a/i18n.py b/i18n.py index 7625469..fd4b6db 100644 --- a/i18n.py +++ b/i18n.py @@ -135,6 +135,8 @@ messages = { "KCHVM0082E": _("Either the guest %(name)s did not start to listen to the serial or it is not configured to use the serial console."), "KCHVM0083E": _("Unable to retrieve Virt Viewer file for stopped virtual machine %(name)s"), "KCHVM0084E": _("Error occured while retrieving the Virt Viewer file for virtual machine %(name)s : %(err)s"), + "KCHVM0085E": _("VM Title must be a string"), + "KCHVM0086E": _("VM Description must be a string"), I did not checked all KCHVM* messages, but I think we are not using the term 'VM' but 'virtual machine'. If so, need change here and also in patch 3/3. Both ways can be found:
"KCHVM0040E": _("Unable to resume VM '%(name)s'. Details: %(err)s"), "KCHVM0033E": _("Virtual machine '%(name)s' must be stopped before cloning it."), If you prefer Virtual machine, i can change it
"KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."), "KCHVMHDEV0002E": _("The host device %(dev_name)s is not allowed to directly assign to VM."), diff --git a/model/vms.py b/model/vms.py index 433770a..2c6c63c 100644 --- a/model/vms.py +++ b/model/vms.py @@ -83,7 +83,8 @@ VM_ONLINE_UPDATE_PARAMS = ['graphics', 'groups', 'memory', 'users']
# update parameters which are updatable when the VM is offline VM_OFFLINE_UPDATE_PARAMS = ['cpu_info', 'graphics', 'groups', 'memory', - 'name', 'users', 'bootorder', 'bootmenu'] + 'name', 'users', 'bootorder', 'bootmenu', + 'description', 'title']
XPATH_DOMAIN_DISK = "/domain/devices/disk[@device='disk']/source/@file" XPATH_DOMAIN_DISK_BY_FILE = "./devices/disk[@device='disk']/source[@file='%s']" @@ -98,10 +99,12 @@ XPATH_DOMAIN_DEV_CPU_ID = '/domain/devices/spapr-cpu-socket/@id' XPATH_BOOT = 'os/boot/@dev' XPATH_BOOTMENU = 'os/bootmenu/@enable' XPATH_CPU = './cpu' +XPATH_DESCRIPTION = './description' XPATH_NAME = './name' XPATH_NUMA_CELL = './cpu/numa/cell' XPATH_SNAP_VM_NAME = './domain/name' XPATH_SNAP_VM_UUID = './domain/uuid' +XPATH_TITLE = './title' XPATH_TOPOLOGY = './cpu/topology' XPATH_VCPU = './vcpu' XPATH_MAX_MEMORY = './maxMemory' @@ -138,7 +141,9 @@ class VMsModel(object):
t.validate() data = {'name': name, 'template': t, - 'graphics': params.get('graphics', {})} + 'graphics': params.get('graphics', {}), + "title": params.get("title", ""), + "description": params.get("description", "")} taskid = add_task(u'/plugins/kimchi/vms/%s' % name, self._create_task, self.objstore, data)
@@ -152,6 +157,8 @@ class VMsModel(object): - name: The name for the new VM """ vm_uuid = str(uuid.uuid4()) + title = params.get('title', '') + description = params.get('description', '') t = params['template'] name, nonascii_name = get_ascii_nonascii_name(params['name']) conn = self.conn.get() @@ -178,7 +185,8 @@ class VMsModel(object): xml = t.to_vm_xml(name, vm_uuid, libvirt_stream_protocols=stream_protocols, graphics=graphics, - mem_hotplug_support=self.caps.mem_hotplug_support) + mem_hotplug_support=self.caps.mem_hotplug_support, + title=title, description=description)
cb('Defining new VM') try: @@ -786,6 +794,14 @@ class VMModel(object): name, nonascii_name = get_ascii_nonascii_name(name) new_xml = xml_item_update(new_xml, XPATH_NAME, name, None)
+ if 'title' in params: + new_xml = xml_item_update(new_xml, XPATH_TITLE, params['title'], + None) + + if 'description' in params: + new_xml = xml_item_update(new_xml, XPATH_DESCRIPTION, + params['description'], None) + # Update CPU info cpu_info = params.get('cpu_info', {}) cpu_info = self._update_cpu_info(new_xml, dom, cpu_info) @@ -1267,6 +1283,8 @@ class VMModel(object): else "no"
return {'name': name, + 'title': "".join(xpath_get_text(xml, XPATH_TITLE)), + 'description': "".join(xpath_get_text(xml, XPATH_DESCRIPTION)), 'state': state, 'stats': res, 'uuid': dom.UUIDString(), diff --git a/vmtemplate.py b/vmtemplate.py index dc81fe2..79730cf 100644 --- a/vmtemplate.py +++ b/vmtemplate.py @@ -347,7 +347,8 @@ class VMTemplate(object): params['qemu-stream-cmdline'] = '' params['disks'] = self._get_disks_xml(vm_uuid) params['serial'] = get_serial_xml(params) - + params['title'] = kwargs.get('title', '') + params['description'] = kwargs.get('description', '') graphics = dict(self.info['graphics']) graphics.update(kwargs.get('graphics', {})) # Graphics is not supported on s390x, this check will @@ -404,6 +405,8 @@ class VMTemplate(object): <domain type='%(domain)s'> %(qemu-stream-cmdline)s <name>%(name)s</name> + <title>%(title)s</title> + <description>%(description)s</description> <uuid>%(uuid)s</uuid> <memtune> <hard_limit unit='MiB'>%(hard_limit)s</hard_limit> -- 2.5.5
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com

Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- tests/test_mockmodel.py | 3 ++- tests/test_model.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py index 43f6d07..147942c 100644 --- a/tests/test_mockmodel.py +++ b/tests/test_mockmodel.py @@ -163,7 +163,8 @@ class MockModelTests(unittest.TestCase): keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpu_info', 'screenshot', 'icon', 'graphics', 'users', 'groups', - 'access', 'persistent', 'bootorder', 'bootmenu')) + 'access', 'persistent', 'bootorder', 'bootmenu', 'title', + 'description')) stats_keys = set(('cpu_utilization', 'mem_utilization', 'net_throughput', 'net_throughput_peak', diff --git a/tests/test_model.py b/tests/test_model.py index 27225f8..4f49ce6 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -127,7 +127,8 @@ class ModelTests(unittest.TestCase): keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpu_info', 'screenshot', 'icon', 'graphics', 'users', 'groups', - 'access', 'persistent', 'bootorder', 'bootmenu')) + 'access', 'persistent', 'bootorder', 'bootmenu', 'title', + 'description')) stats_keys = set(('cpu_utilization', 'mem_utilization', 'net_throughput', 'net_throughput_peak', -- 2.5.5

Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com> --- docs/API.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/API.md b/docs/API.md index b07bf16..7bd677f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -90,6 +90,8 @@ server. Independent Computing Environments * null: Graphics is disabled or type not supported * listen: The network which the vnc/spice server listens on. + * description: VM description + * title: VM title ### Resource: Virtual Machine @@ -147,6 +149,8 @@ server. * groups: A list of system groups whose users have permission to access the VM. Default is: empty (i.e. no groups given access). * bootorder: list of devices in boot order + * description: VM description + * title: VM title * **DELETE**: Remove the Virtual Machine * **PUT**: update the parameters of existing VM * name: New name for this VM (only applied for shutoff VM) @@ -177,6 +181,8 @@ server. * threads - The number of threads per core. * bootorder: guest bootorder, types accepted: hd, cdrom, network or fd * bootmenu: prompts guest bootmenu. Bool type. + * description: VM description + * title: VM title * **POST**: *See Virtual Machine Actions* -- 2.5.5

Commands for testing: Creating vm with title and description: curl -u root -H "Content-Type: application/json" -H "Accept: application/json" -k http://localhost:8010/plugins/kimchi/vms -X POST -d '{"template": "/plugins/kimchi/templates/TEMPLATE", "title": <TITLE>, "description": <DESCRIPTION>}' updating VM title and description: curl -u root -H "Content-Type: application/json" -H "Accept: application/json" -k http://localhost:8010/plugins/kimchi/vms/VM -X PUT -d '{"title": "", "description": ""}' Also, run a GET to check if description is showed: curl -u root -H "Content-Type: application/json" -H "Accept: application/json" -k http://localhost:8010/plugins/kimchi/vms/VM -X GET On 08/16/2016 01:23 PM, Ramon Medeiros wrote:
Ramon Medeiros (3): Issue #857: Support VM description Update tests Update docs
API.json | 20 ++++++++++++++++++++ docs/API.md | 6 ++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- tests/test_mockmodel.py | 3 ++- tests/test_model.py | 3 ++- vmtemplate.py | 5 ++++- 7 files changed, 57 insertions(+), 6 deletions(-)
-- Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com

I wasn't able to update a VM description: [danielhb@arthas kimchi]$ curl -u root -H "Content-Type: application/json" -H "Accept: application/json" -k http://localhost:8010/plugins/kimchi/vms/winxp -X PUT -d '{"title": "windowsXP", "description": "thisisawindowsXPmachine"}' Enter host password for user 'root': { "reason":"The server encountered an unexpected condition which prevented it from fulfilling the request.", "code":"500 Internal Server Error", "call_stack":"Traceback (most recent call last):\n File \"/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py\", line 670, in respond\n response.body = self.handler()\n File \"/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py\", line 217, in __call__\n self.body = self.oldhandler(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py\", line 61, in __call__\n return self.callable(*self.args, **self.kwargs)\n File \"/home/danielhb/kimchi/wok_all_plugins/src/wok/control/base.py\", line 209, in index\n 'PUT': self.update}[method](*args, **kargs)\n File \"/home/danielhb/kimchi/wok_all_plugins/src/wok/control/base.py\", line 262, in update\n ident = update(*args)\n File \"/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/model/vms.py\", line 301, in update\n vm_name, dom = self._static_vm_update(name, dom, params)\n File \"/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/model/vms.py\", line 799, in _static_vm_update\n None)\n File \"/home/danielhb/kimchi/wok_all_plugins/src/wok/xmlutils/utils.py\", line 52, in xml_item_update\n item.text = value\nAttributeError: 'NoneType' object has no attribute 'text'\n" }[danielhb@arthas kimchi]$ This is the error on WoK console: "" "curl/7.43.0" WOKOBJST0001E: Unable to find de1fa348-1356-44b5-9b06-f70aa34a79ef in datastore [16/Aug/2016:15:58:24] HTTP Request Headers: AUTHORIZATION: Basic cm9vdDpnMDBkY29kMw== Content-Length: 64 HOST: localhost:8010 Remote-Addr: 127.0.0.1 ACCEPT: application/json USER-AGENT: curl/7.43.0 Content-Type: application/json [16/Aug/2016:15:58:24] HTTP Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 670, in respond response.body = self.handler() File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 217, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 61, in __call__ return self.callable(*self.args, **self.kwargs) File "/home/danielhb/kimchi/wok_all_plugins/src/wok/control/base.py", line 209, in index 'PUT': self.update}[method](*args, **kargs) File "/home/danielhb/kimchi/wok_all_plugins/src/wok/control/base.py", line 262, in update ident = update(*args) File "/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/model/vms.py", line 301, in update vm_name, dom = self._static_vm_update(name, dom, params) File "/home/danielhb/kimchi/wok_all_plugins/src/wok/plugins/kimchi/model/vms.py", line 799, in _static_vm_update None) File "/home/danielhb/kimchi/wok_all_plugins/src/wok/xmlutils/utils.py", line 52, in xml_item_update item.text = value AttributeError: 'NoneType' object has no attribute 'text' On 08/16/2016 01:23 PM, Ramon Medeiros wrote:
Ramon Medeiros (3): Issue #857: Support VM description Update tests Update docs
API.json | 20 ++++++++++++++++++++ docs/API.md | 6 ++++++ i18n.py | 2 ++ model/vms.py | 24 +++++++++++++++++++++--- tests/test_mockmodel.py | 3 ++- tests/test_model.py | 3 ++- vmtemplate.py | 5 ++++- 7 files changed, 57 insertions(+), 6 deletions(-)
participants (3)
-
Daniel Henrique Barboza
-
Paulo Ricardo Paz Vital
-
Ramon Medeiros