diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 1a6d6e67f2..2a6a7c9b42 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -168,14 +168,24 @@ parallelsDomainDefPostParse(virDomainDefPtr def ATTRIBUTE_UNUSED, return 0; } - static int -parallelsDomainDeviceDefPostParse(virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED, +parallelsDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, const virDomainDef *def ATTRIBUTE_UNUSED, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED) { - return 0; + int ret = -1; + + 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 && + VIR_STRDUP(dev->data.net->model, "e1000") < 0) + goto cleanup; + + ret = 0; + cleanup: + return ret; } diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index ab24b5e93b..f6fce40e89 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2674,6 +2674,20 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom, 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; + } + 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);