mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
parallels: make E1000 network adapter model default
and set adapter model specified in xml Signed-off-by: Maxim Nestratov <mnestratov@parallels.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
46f4a532d5
commit
5a9b01b36d
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user