<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 01/13/2014 09:19 AM, Sheldon wrote:<br>
</div>
<blockquote cite="mid:52D3CBC5.209@linux.vnet.ibm.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 01/10/2014 09:30 PM, Aline Manera
wrote:<br>
</div>
<blockquote cite="mid:52CFF5EE.4020902@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 12/30/2013 01:13 AM, Sheldon
wrote:<br>
</div>
<blockquote cite="mid:52C0E4F0.3040108@linux.vnet.ibm.com"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
now we have support network
get/create/delete/activate/deactivate<br>
<br>
Now we need to support the <a moz-do-not-send="true"
href="https://github.com/kimchi-project/kimchi/wiki/customize-VM#organization-of-sub-resources-and-rest-api-exposition">attach/detach/</a>
a Network to a guest. <br>
And get the info of Network attached to a guest.<br>
<br>
<br>
libvirt supports several types of network interfaces:<br>
'bridge','network','user','ethernet','direct','hostdev','mcast',
'server', 'client'<br>
<br>
but there is not a unique "name" attribute for "interface"
element.(<a moz-do-not-send="true"
href="http://libvirt.org/formatdomain.html#elementsNICS">more
libvirt network interfaces info</a>)<br>
<br>
That is not good to define our REST API.<br>
<br>
But for "network" type resource, there is a "network"
attribute of "source" resource. <br>
And the value of "network" attribute is the name of network
that we defined by /networks POST method.<br>
<br>
the "network" type + "network" attribute is unique.<br>
<br>
We can define the Network Interfaces like this to support
"network" type Interfaces:<br>
GET /vms/*name*/Interfaces?type=network&network="default"<br>
But this is not RESTFUL.<br>
<br>
<br>
Maybe We can also name a Network Interface by the Interface
mac. <br>
The mac is unique.<br>
GET /vms/*name*/Interfaces/mac<br>
<br>
<br>
</blockquote>
<br>
I think using the mac address is enough for us.<br>
<br>
I'd also suggest to use 'ifaces' instead of 'Interfaces'<br>
<br>
# list the iface info<br>
GET /vms/<name>/ifaces/<mac><br>
<br>
# attach new iface<br>
POST /vms/<name>/ifaces/<mac> {network:
<network-id>}<br>
</blockquote>
POST /vms/<name>/ifaces/ {network: <network-id>} ?<br>
</blockquote>
<br>
Yeap<br>
<br>
<blockquote cite="mid:52D3CBC5.209@linux.vnet.ibm.com" type="cite">
<blockquote cite="mid:52CFF5EE.4020902@linux.vnet.ibm.com"
type="cite"> <br>
# dettach a iface<br>
DELETE /vms/<name>/ifaces/<mac><br>
<br>
<blockquote cite="mid:52C0E4F0.3040108@linux.vnet.ibm.com"
type="cite"> The best way for user is get the NICS name in
guest. such as eth0, eth1....<br>
GET /vms/*name*/Interfaces/eth0
<br>
GET /vms/*name*/Interfaces/eth1 <br>
<br>
But there is a problem, we need get the nic name and mac from
guest. <br>
and Make a map in kimchi DB. <br>
also the nic name may change, we need make the map
consistence with guest nic name. <br>
<br>
</blockquote>
<br>
I think it is not needed.<br>
Only the mac address should be enough.<br>
Just for reference: I also looked at virt-manager and it doesn't
display information <br>
about nic name, only mac and network name and type.<br>
<br>
<br>
<blockquote cite="mid:52C0E4F0.3040108@linux.vnet.ibm.com"
type="cite"> <br>
<pre class="moz-signature" cols="72">--
Sheldon Feng(冯少合)<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
IBM Linux Technology Center</pre>
</blockquote>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Thanks and best regards!
Sheldon Feng(冯少合)<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
IBM Linux Technology Center</pre>
</blockquote>
<br>
</body>
</html>