<html><body><div>Then how do I set ip address when a VM has to use bridged network with specific ip?</div><div><br></div><div>Clearly libxl supports it, but I don't see any way to set it though libvirt.</div><div><br></div><div>JIhoon</div><div><br>Jim Fehlig <jfehlig@suse.com> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><span class="body-text-content">Kim Larry wrote:<br></span></span><blockquote class="quoted-plain-text" type="cite">Hi,</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">I was trying to pass ip address to scripts/vif-bridge by putting <ip</blockquote><blockquote class="quoted-plain-text" type="cite">address=""/> in guest config xml file, however, I found that</blockquote><blockquote class="quoted-plain-text" type="cite">libxlMakeNic(which located in libxl/libxl_conf.c:956) doesn't set</blockquote><blockquote class="quoted-plain-text" type="cite">x_nic->ip. So I patched myself but I'm not so sure</blockquote><blockquote class="quoted-plain-text" type="cite">about VIR_DOMAIN_NET_TYPE_ETHERNET. It seems like vif-route, correct?</blockquote><span class="body-text-content"><span class="body-text-content"><br>If you want to use a routed setup, consider a 'network' type interface. <br>E.g.<br> <br> <interface type='network'><br> <source network='routed-network'/><br> </interface><br> <br>where 'routed-network' is a libvirt network with |<forward<br>mode='route'/>. For more details on libvirt networking see the wiki|<br>||<br>|<a href="http://wiki.libvirt.org/page/Networking|" data-mce-href="http://wiki.libvirt.org/page/Networking|">http://wiki.libvirt.org/page/Networking|</a> <br>||<br>||<br></span></span><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">Here is my patch:</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c</blockquote><blockquote class="quoted-plain-text" type="cite">index 0555b91..0effc59 100644</blockquote><blockquote class="quoted-plain-text" type="cite">--- a/src/libxl/libxl_conf.c</blockquote><blockquote class="quoted-plain-text" type="cite">+++ b/src/libxl/libxl_conf.c</blockquote><blockquote class="quoted-plain-text" type="cite">@@ -1047,10 +1047,18 @@ libxlMakeNic(virDomainDefPtr def,</blockquote><blockquote class="quoted-plain-text" type="cite">if (VIR_STRDUP(x_nic->bridge,</blockquote><blockquote class="quoted-plain-text" type="cite">virDomainNetGetActualBridgeName(l_nic)) < 0)</blockquote><blockquote class="quoted-plain-text" type="cite">return -1;</blockquote><blockquote class="quoted-plain-text" type="cite">- /* fallthrough */</blockquote><blockquote class="quoted-plain-text" type="cite">+ if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)</blockquote><blockquote class="quoted-plain-text" type="cite">+ return -1;</blockquote><blockquote class="quoted-plain-text" type="cite">+ if (VIR_STRDUP(x_nic->ip, l_nic->data.bridge.ipaddr) < 0)</blockquote><span class="body-text-content"><span class="body-text-content"><br>You will need to rebase against latest git master. ipaddr was removed<br>by commit aa2cc721.<br> <br></span></span><blockquote class="quoted-plain-text" type="cite">+ return -1;</blockquote><blockquote class="quoted-plain-text" type="cite">+ break;</blockquote><blockquote class="quoted-plain-text" type="cite">case VIR_DOMAIN_NET_TYPE_ETHERNET:</blockquote><blockquote class="quoted-plain-text" type="cite">if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)</blockquote><blockquote class="quoted-plain-text" type="cite">return -1;</blockquote><blockquote class="quoted-plain-text" type="cite">+ if (VIR_STRDUP(x_nic->ip, l_nic->data.ethernet.ipaddr) < 0)</blockquote><blockquote class="quoted-plain-text" type="cite">+ return -1;</blockquote><blockquote class="quoted-plain-text" type="cite">+ if (VIR_STRDUP(x_nic->gatewaydev,</blockquote><blockquote class="quoted-plain-text" type="cite">l_nic->data.ethernet.dev) < 0)</blockquote><span class="body-text-content"><br>I don't think the last part is right. data.ethernet.dev is the vdev<br>name, not a gateway.<br> <br>Regards,<br>Jim<br> <br> </span></div></div></blockquote></div></body></html>