[Kimchi-devel] [PATCH v2 1/3] Add persistent flag to VM info

Christy Perez christy at linux.vnet.ibm.com
Thu Aug 21 20:18:34 UTC 2014


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 at 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):
-- 
1.9.3




More information about the Kimchi-devel mailing list