After some more investigation, I identified the error was caused in the
poweroff request.
It is because, after each action, Kimchi tries to get the resource
information to return and in the case of a non-persistent VM the
resource was deleted.
It occurs with/out this patch and probably with all non-persistent
resources.
I will accept this patch set and open a bug to track this problem.
On 08/25/2014 11:57 AM, Christy Perez wrote:
On 08/22/2014 07:47 AM, Aline Manera wrote:
> It is not working well for me.
>
> 1) I created a vm using a base xml, by running "virsh create vm.xml"
>
> <domain type='kvm'>
> <name>for-test</name>
> <memory unit='KiB'>10240</memory>
> <os>
> <type>hvm</type>
> <boot dev='hd'/>
> </os>
> </domain>
>
> 2) Access Kimchi interface and the new vm is displayed
> 3) Try to power it off. The dialog confirmation is displayed and when I
> confirm the action an error is shown on top of page "The VM for-test
> does not exist"
> 4) Then some a few seconds the VM is removed from Guests tab.
This case needs to be handled outside of this patch, and occurs without
my patch. Power Off deletes the VM (hence this warning we're adding).
My assumption is that the UI needs to check that a VM exists again
before displaying updated stats about it (since this can happen).
> On 08/21/2014 05:18 PM, Christy Perez wrote:
>> Kimchi can manage guests not created by Kimchi. If a user creates a
>> non-persistent domain and uses the Power Off option, it will destroy
>> the user's domain. In order to warn users with non-persistent guests
>> on Power Off, this patch adds a 'persistent' field (like the one for
>> networks and storage pools) to a vm's JSON representation.
>>
>> Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
>> ---
>> docs/API.md | 2 ++
>> src/kimchi/model/vms.py | 3 ++-
>> 2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/docs/API.md b/docs/API.md
>> index d75c55f..ebb6e61 100644
>> --- a/docs/API.md
>> +++ b/docs/API.md
>> @@ -45,6 +45,8 @@ the following general conventions:
>> * **POST**: Create a new Virtual Machine
>> * name *(optional)*: The name of the VM. Used to identify the
>> VM in this
>> API. If omitted, a name will be chosen based on the template
>> used.
>> + * persistent: If 'true', vm will persist after a Power Off or
>> host reboot.
>> + All virtual machines created by Kimchi are persistent.
>> * template: The URI of a Template to use when building the VM
>> * storagepool *(optional)*: Assign a specific Storage Pool to
>> the new VM
>> * graphics *(optional)*: Specify the graphics paramenter for
>> this vm
>> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
>> index 476e4ac..5721b48 100644
>> --- a/src/kimchi/model/vms.py
>> +++ b/src/kimchi/model/vms.py
>> @@ -471,7 +471,8 @@ def lookup(self, name):
>> 'ticket': self._get_ticket(dom),
>> 'users': users,
>> 'groups': groups,
>> - 'access': 'full'
>> + 'access': 'full',
>> + 'persistent': True if dom.isPersistent() else False
>> }
>>
>> def _vm_get_disk_paths(self, dom):