[Kimchi-devel] [RFC][PATCH 1/3] VM supports interfaces: update API

Aline Manera alinefm at linux.vnet.ibm.com
Fri Jan 17 17:31:23 UTC 2014


On 01/15/2014 07:53 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> Now kimchi supports network get/create/delete/activate/deactivate
> REST API.
>
> We need to support the attach/detach/ a Network to a VM.
> https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-sub-resources-and-rest-api-exposition
> And get the info of Network attached to a VM.
>
> more libvirt network interfaces info:
> http://libvirt.org/formatdomain.html#elementsNICS
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   docs/API.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 47 insertions(+)
>
> diff --git a/docs/API.md b/docs/API.md
> index 6e240eb..db2837e 100644
> --- a/docs/API.md
> +++ b/docs/API.md
> @@ -149,6 +149,53 @@ Represents a snapshot of the Virtual Machine's primary monitor.
>               * null: Graphics is disabled or type not supported
>           * listen: The network which the vnc/spice server listens on.
>
> +### Sub-Collection: Virtual Machine Network Interfaces
> +
> +**URI:** /vms/*:name*/ifaces
> +
> +Represents all network interfaces attached to a Virtual Machine.
> +
> +**Methods:**
> +
> +* **GET**: Retrieve a summarized list of all network interfaces attached to a Virtual Machine.
> +
> +* **POST**: attach a network interface to VM
> +    * type: The type of VM network interface that libvirt supports.
> +            Now kimchi just supports 'network' type.
> +    * network *(optional)*: the name of resource network, it is required when the
> +              interface type is network.
> +    * model *(optional)*: model of emulated network interface card. It can be one of these models:
> +            ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
> +            When model is missing, libvirt will set 'rtl8139' as default value.
> +
> +### Sub-Resource: Virtual Machine Network Interface
> +
> +**URI:** /vms/*:name*/ifaces/*:name*

I think "mac" is safer than using "name"

> +
> +A interface represents available network interface on VM.

Represents a network interface on VM.

> +
> +**Methods:**
> +
> +* **GET**: Retrieve the full description of the VM network interface
> +    * name: The identifier of the network interface.
> +    * type: The type of VM network interface that libvirt supports.
> +            It will be one of these types: 'network', 'bridge', 'user','ethernet',
> +            'direct', 'hostdev', 'mcast', 'server' and 'client'.
> +    * network *(optional)*: the name of resource network, only be available when the
> +              interface type is network.
> +    * bridge *(optional)*: the name of resource bridge, only be available when the
> +              interface type is bridge.
> +    * mac: Media Access Control Address of the VM interface.
> +    * model: model of emulated network interface card. It will be one of these models:
> +             ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
> +
> +* **DELETE**: detach the network interface from VM
> +
> +**Actions (POST):**
> +
> +*No actions defined*
> +
> +
>   ### Resource: Template
>
>   **URI:** /templates/*:name*




More information about the Kimchi-devel mailing list