δΊ 2013-3-15 6:55, John Ferlan ει:
A change was made in 0.9.10 to disallow a script on a bridge device
for
qemu guests, see 'libvirt' commit id '1734cdb99'.
---
libxkutil/xmlgen.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 2dcd0d2..099fdd2 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -270,16 +270,21 @@ static const char *set_net_source(xmlNodePtr nic,
}
-static const char *bridge_net_to_xml(xmlNodePtr nic, struct net_device *dev)
+static const char *bridge_net_to_xml(xmlNodePtr nic, struct net_device *dev,
+ int domtype)
{
const char *script = "vif-bridge";
xmlNodePtr tmp;
const char *msg = NULL;
- tmp = xmlNewChild(nic, NULL, BAD_CAST "script", NULL);
- if (tmp == NULL)
- return XML_ERROR;
- xmlNewProp(tmp, BAD_CAST "path", BAD_CAST script);
+ /* Scripts only supported on Xen guests see 'libvirt'
+ * commit id 1734cdb99 (since 0.9.10) */
+ if (domtype == DOMAIN_XENPV || domtype == DOMAIN_XENFV) {
+ tmp = xmlNewChild(nic, NULL, BAD_CAST "script", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+ xmlNewProp(tmp, BAD_CAST "path", BAD_CAST script);
+ }
msg = set_net_source(nic, dev, "bridge");
@@ -375,13 +380,13 @@ static const char *net_xml(xmlNodePtr root, struct domain
*dominfo)
}
#endif
- if (STREQ(dev->dev.net.type, "network"))
+ if (STREQ(dev->dev.net.type, "network")) {
msg = set_net_source(nic, net, "network");
- else if (STREQ(dev->dev.net.type, "bridge"))
- msg = bridge_net_to_xml(nic, net);
- else if (STREQ(dev->dev.net.type, "user"))
+ } else if (STREQ(dev->dev.net.type, "bridge")) {
+ msg = bridge_net_to_xml(nic, net, dominfo->type);
+ } else if (STREQ(dev->dev.net.type, "user")) {
continue;
- else if (STREQ(dev->dev.net.type, "direct")) {
+ } else if (STREQ(dev->dev.net.type, "direct")) {
msg = set_net_source(nic, net, "direct");
if (net->vsi.vsi_type != NULL) {
struct vsi_device *vsi = &dev->dev.net.vsi;
+1
--
Best Regards
Wenchao Xia