and set adapter model specified in xml
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_driver.c | 7 ++++++-
src/parallels/parallels_sdk.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 1a6d6e6..807c1b1 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -168,13 +168,18 @@ parallelsDomainDefPostParse(virDomainDefPtr def ATTRIBUTE_UNUSED,
return 0;
}
-
static int
parallelsDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const virDomainDef *def ATTRIBUTE_UNUSED,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
+ if (dev->type == VIR_DOMAIN_DEVICE_NET &&
+ (dev->data.net->type == VIR_DOMAIN_NET_TYPE_NETWORK ||
+ dev->data.net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
+ !dev->data.net->model)
+ return VIR_STRDUP(dev->data.net->model, "e1000");
+
return 0;
}
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index d699613..d34c814 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2672,6 +2672,23 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom, parallelsConnPtr
privconn, virDomainN
pret = PrlVmDevNet_SetMacAddress(sdknet, macstr);
prlsdkCheckRetGoto(pret, cleanup);
+ if (STREQ(net->model, "rtl8139"))
+ pret = PrlVmDevNet_SetAdapterType(sdknet, PNT_RTL);
+ else if (STREQ(net->model, "e1000"))
+ pret = PrlVmDevNet_SetAdapterType(sdknet, PNT_E1000);
+ else if (STREQ(net->model, "virtio"))
+ pret = PrlVmDevNet_SetAdapterType(sdknet, PNT_VIRTIO);
+ else {
+
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Specified network adapter model is not "
+ "supported by Parallels Cloud Server."));
+ goto cleanup;
+ }
+
+ pret = PrlVmDevNet_SetAdapterType(sdknet, PNT_E1000);
+ prlsdkCheckRetGoto(pret, cleanup);
+
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
if (STREQ(net->data.network.name, PARALLELS_DOMAIN_ROUTED_NETWORK_NAME)) {
pret = PrlVmDev_SetEmulatedType(sdknet, PNA_ROUTED);
--
1.7.1