[RFC][PATCH] VM supports interfaces

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> now kimchi support supports network get/create/delete/activate/deactivate REST API. Now we need to support the attach/detach/ a Network to a VM. https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-s... 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@linux.vnet.ibm.com> --- docs/API.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/API.md b/docs/API.md index 9edc551..2d3ce11 100644 --- a/docs/API.md +++ b/docs/API.md @@ -127,6 +127,55 @@ Represents a snapshot of the Virtual Machine's primary monitor. * volume: A volume name that contains the initial disk contents +### Sub-Collection: Virtual Machine Network Interfaces + +**URI:** /vms/*:name*/interfaces + +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. + It can be one of these types: 'network', 'bridge', 'user','ethernet', + 'direct', 'hostdev', 'mcast', 'server' and 'client'. + 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, but already some interfaces is attached to VM, then will choose + one of model of the exist interfaces. + if on interface is attached to VM, then 'virtio' is default. + +### Sub-Resource: Virtual Machine Network Interface + +**URI:** /vms/*:name*/interfaces/*:name* + +A interface represents available 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. + +* **DELETE**: detach the network interface from VM + +**Actions (POST):** + +*No actions defined* + + ### Resource: Template **URI:** /templates/*:name* -- 1.8.4.2

On 12/30/2013 08:41 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
now kimchi support supports network get/create/delete/activate/deactivate REST API.
Now we need to support the attach/detach/ a Network to a VM. https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-s... 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@linux.vnet.ibm.com> --- docs/API.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/docs/API.md b/docs/API.md index 9edc551..2d3ce11 100644 --- a/docs/API.md +++ b/docs/API.md @@ -127,6 +127,55 @@ Represents a snapshot of the Virtual Machine's primary monitor. * volume: A volume name that contains the initial disk contents
+### Sub-Collection: Virtual Machine Network Interfaces + +**URI:** /vms/*:name*/interfaces + +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. + It can be one of these types: 'network', 'bridge', 'user','ethernet', + 'direct', 'hostdev', 'mcast', 'server' and 'client'. + Now kimchi just supports 'network' type.
- It can be one of these types: 'network', 'bridge', 'user','ethernet', - 'direct', 'hostdev', 'mcast', 'server' and 'client'. - Now kimchi just supports 'network' type. + Currently Kimchi only supports type 'network'.
+ * 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, but already some interfaces is attached to VM, then will choose + one of model of the exist interfaces. + if on interface is attached to VM, then 'virtio' is default. + +### Sub-Resource: Virtual Machine Network Interface + +**URI:** /vms/*:name*/interfaces/*:name* + +A interface represents available 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. + +* **DELETE**: detach the network interface from VM + +**Actions (POST):** + +*No actions defined* + + ### Resource: Template
**URI:** /templates/*:name*

On 12/30/2013 10:41 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
now kimchi support supports network get/create/delete/activate/deactivate
typo: support supports
REST API.
Now we need to support the attach/detach/ a Network to a VM. https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-s... 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@linux.vnet.ibm.com> --- docs/API.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/docs/API.md b/docs/API.md index 9edc551..2d3ce11 100644 --- a/docs/API.md +++ b/docs/API.md @@ -127,6 +127,55 @@ Represents a snapshot of the Virtual Machine's primary monitor. * volume: A volume name that contains the initial disk contents
+### Sub-Collection: Virtual Machine Network Interfaces + +**URI:** /vms/*:name*/interfaces +
I'd suggest to use 'ifaces' instead of 'interfaces'
+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. + It can be one of these types: 'network', 'bridge', 'user','ethernet', + 'direct', 'hostdev', 'mcast', 'server' and 'client'. + 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, but already some interfaces is attached to VM, then will choose + one of model of the exist interfaces.
typo: s/when/When If we leave model in blank, won't libvirt get the default value automatically?
+ if on interface is attached to VM, then 'virtio' is default.
typo: s/if/If
+ +### Sub-Resource: Virtual Machine Network Interface + +**URI:** /vms/*:name*/interfaces/*:name* + +A interface represents available 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. + +* **DELETE**: detach the network interface from VM + +**Actions (POST):** + +*No actions defined* + + ### Resource: Template
**URI:** /templates/*:name*

On 01/10/2014 11:41 PM, Aline Manera wrote:
On 12/30/2013 10:41 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
now kimchi support supports network get/create/delete/activate/deactivate
typo: support supports
REST API.
Now we need to support the attach/detach/ a Network to a VM. https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-s...
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@linux.vnet.ibm.com> --- docs/API.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/docs/API.md b/docs/API.md index 9edc551..2d3ce11 100644 --- a/docs/API.md +++ b/docs/API.md @@ -127,6 +127,55 @@ Represents a snapshot of the Virtual Machine's primary monitor. * volume: A volume name that contains the initial disk contents
+### Sub-Collection: Virtual Machine Network Interfaces + +**URI:** /vms/*:name*/interfaces +
I'd suggest to use 'ifaces' instead of 'interfaces'
+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. + It can be one of these types: 'network', 'bridge', 'user','ethernet', + 'direct', 'hostdev', 'mcast', 'server' and 'client'. + 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, but already some interfaces is attached to VM, then will choose + one of model of the exist interfaces.
typo: s/when/When
If we leave model in blank, won't libvirt get the default value automatically? e1000. Though virtio is more efficiency than e1000.
+ if on interface is attached to VM, then 'virtio' is default.
typo: s/if/If
+ +### Sub-Resource: Virtual Machine Network Interface + +**URI:** /vms/*:name*/interfaces/*:name* + +A interface represents available 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. + +* **DELETE**: detach the network interface from VM + +**Actions (POST):** + +*No actions defined* + + ### Resource: Template
**URI:** /templates/*:name*
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center

On 01/10/2014 11:41 PM, Aline Manera wrote:
On 12/30/2013 10:41 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
now kimchi support supports network get/create/delete/activate/deactivate
typo: support supports
REST API.
Now we need to support the attach/detach/ a Network to a VM. https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-s...
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@linux.vnet.ibm.com> --- docs/API.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/docs/API.md b/docs/API.md index 9edc551..2d3ce11 100644 --- a/docs/API.md +++ b/docs/API.md @@ -127,6 +127,55 @@ Represents a snapshot of the Virtual Machine's primary monitor. * volume: A volume name that contains the initial disk contents
+### Sub-Collection: Virtual Machine Network Interfaces + +**URI:** /vms/*:name*/interfaces +
I'd suggest to use 'ifaces' instead of 'interfaces'
+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. + It can be one of these types: 'network', 'bridge', 'user','ethernet', + 'direct', 'hostdev', 'mcast', 'server' and 'client'. + 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, but already some interfaces is attached to VM, then will choose + one of model of the exist interfaces.
typo: s/when/When
If we leave model in blank, won't libvirt get the default value automatically? http://libvirt.org/formatdomain.html#elementsNICS does not say this.
but I have tried: 'rtl8139' is default.
+ if on interface is attached to VM, then 'virtio' is default.
typo: s/if/If
+ +### Sub-Resource: Virtual Machine Network Interface + +**URI:** /vms/*:name*/interfaces/*:name* + +A interface represents available 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. + +* **DELETE**: detach the network interface from VM + +**Actions (POST):** + +*No actions defined* + + ### Resource: Template
**URI:** /templates/*:name*
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center
participants (4)
-
Aline Manera
-
Hongliang Wang
-
shaohef@linux.vnet.ibm.com
-
Sheldon