On Tue, Dec 11, 2012 at 02:59:49PM +0400, Dmitry Guryanov wrote: > Network adapters of type 'routed' is a special case. Other adapters > have 'network' parameter in prlctl's output instead. > > Routed network adapters should be connected to 'routed' network > from libvirt's view. > > Signed-off-by: Dmitry Guryanov <dgurya...@parallels.com> > --- > src/parallels/parallels_driver.c | 42 +++++++++++++++++++++++++++++++------ > 1 files changed, 35 insertions(+), 7 deletions(-) > > diff --git a/src/parallels/parallels_driver.c > b/src/parallels/parallels_driver.c > index 21279c0..f16777a 100644 > --- a/src/parallels/parallels_driver.c > +++ b/src/parallels/parallels_driver.c > @@ -482,13 +482,34 @@ parallelsGetNetInfo(virDomainNetDefPtr net, > goto error; > } > > - if (!(tmp = virJSONValueObjectGetString(value, "network"))) { > - parallelsParseError(); > - goto error; > - } > > - if (!(net->data.network.name = strdup(tmp))) { > - virReportOOMError(); > + if (virJSONValueObjectHasKey(value, "network")) { > + if (!(tmp = virJSONValueObjectGetString(value, "network"))) { > + parallelsParseError(); > + goto error; > + } > + > + if (!(net->data.network.name = strdup(tmp))) { > + virReportOOMError(); > + goto error; > + } > + } else if (virJSONValueObjectHasKey(value, "type")) { > + if (!(tmp = virJSONValueObjectGetString(value, "type"))) { > + parallelsParseError(); > + goto error; > + } > + > + if (!STREQ(tmp, "routed")) { > + parallelsParseError(); > + goto error; > + } > + > + if (!(net->data.network.name = > strdup(PARALLELS_ROUTED_NETWORK_NAME))) { > + virReportOOMError(); > + goto error; > + } > + } else { > + parallelsParseError(); > goto error; > } > > @@ -1866,7 +1887,14 @@ static int > parallelsApplyIfaceParams(parallelsDomObjPtr pdom, > } > > if (!STREQ_NULLABLE(oldnet->data.network.name, > newnet->data.network.name)) { > - virCommandAddArgFormat(cmd, "--network=%s", > newnet->data.network.name); > + if (STREQ_NULLABLE(newnet->data.network.name, > + PARALLELS_ROUTED_NETWORK_NAME)) { > + virCommandAddArgFormat(cmd, "--type=routed"); > + } else { > + virCommandAddArgFormat(cmd, "--network=%s", > + newnet->data.network.name); > + } > + > is_changed = true; > } >
ACK, Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veill...@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list