[Kimchi-devel] [PATCH V3 1/4] vmiface update support: update API.md

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Tue Apr 29 16:37:54 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

update API.md and API.json

Test this patch by:

$ curl -u <user>:<password> -H "Content-Type: application/json" \
> -H "Accept: application/json"
> http://localhost:8000/vms/<vmname>/ifaces/<mac> \
> -X PUT -d '
> {
>   "model":"virtio",
>   "network":"default"
> }'

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 docs/API.md         |  8 ++++++++
 src/kimchi/API.json | 17 +++++++++++++++++
 src/kimchi/i18n.py  |  1 +
 3 files changed, 26 insertions(+)

diff --git a/docs/API.md b/docs/API.md
index c394c69..29b81e8 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -227,6 +227,14 @@ A interface represents available network interface on VM.
 
 * **DELETE**: detach the network interface from VM
 
+* **PUT**: update the parameters of existing VM interface.
+    * model *(optional)*: model of emulated network interface card. It will be one of these models:
+             ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
+             This change is only on the persisted VM configuration.
+    * network *(optional)*: the name of resource network, only be available when the
+              interface type is network.
+              This change is on the active VM instance and persisted VM configuration.
+
 **Actions (POST):**
 
 *No actions defined*
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 38e9607..01c7898 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -300,6 +300,23 @@
                 }
             }
         },
+        "vmiface_update": {
+            "type": "object",
+            "error": "KCHVMIF0008E",
+            "properties": {
+                "network": {
+                    "description": "the name of one available network",
+                    "minLength": 1,
+                    "type": "string",
+                    "error": "KCHVMIF0005E"
+                },
+                "model": {
+                    "description": "model of emulated network interface card",
+                    "enum": ["ne2k_pci", "i82551", "i82557b", "i82559er", "rtl8139", "e1000", "pcnet", "virtio", "spapr-vlan"],
+                    "error": "KCHVMIF0006E"
+                }
+            }
+        },
         "templates_create": {
             "type": "object",
             "error": "KCHTMPL0016E",
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index a1af1f7..b5bcf30 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -95,6 +95,7 @@ messages = {
     "KCHVMIF0005E": _("Network name for virtual machine interface must be a string"),
     "KCHVMIF0006E": _("Invalid network model card specified for virtual machine interface"),
     "KCHVMIF0007E": _("Specify type and network to add a new virtual machine interface"),
+    "KCHVMIF0008E": _("Specify type and network to update a virtual machine interface"),
 
     "KCHTMPL0001E": _("Template %(name)s already exists"),
     "KCHTMPL0002E": _("Template %(name)s does not exist"),
-- 
1.9.0




More information about the Kimchi-devel mailing list