23.04.2015 15:44, Dmitry Guryanov пишет:
On 04/22/2015 10:49 PM, Maxim Nestratov wrote:
> Since net->model is not defined for containers we shouldn't touch it
>
> Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
> ---
> src/parallels/parallels_sdk.c | 27 +++++++++++++++------------
> 1 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/src/parallels/parallels_sdk.c
> b/src/parallels/parallels_sdk.c
> index 59ca62e..988bcc6 100644
> --- a/src/parallels/parallels_sdk.c
> +++ b/src/parallels/parallels_sdk.c
> @@ -2728,7 +2728,8 @@ static const char *
> prlsdkFormatMac(virMacAddrPtr mac, char *macstr)
> static int prlsdkAddNet(PRL_HANDLE sdkdom,
> parallelsConnPtr privconn,
> - virDomainNetDefPtr net)
> + virDomainNetDefPtr net,
> + bool isCt)
> {
> PRL_RESULT pret;
> PRL_HANDLE sdknet = PRL_INVALID_HANDLE;
> @@ -2760,19 +2761,21 @@ 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",
> + if (!isCt) {
> + 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;
> + goto cleanup;
> + }
> + prlsdkCheckRetGoto(pret, cleanup);
> }
Could you, please, show some warning in case adapter model is
specified for a container?
Ok.
> - prlsdkCheckRetGoto(pret, cleanup);
> if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
> if (STREQ(net->data.network.name,
> PARALLELS_DOMAIN_ROUTED_NETWORK_NAME)) {
> @@ -3156,7 +3159,7 @@ prlsdkDoApplyConfig(virConnectPtr conn,
> }
> for (i = 0; i < def->nnets; i++) {
> - if (prlsdkAddNet(sdkdom, conn->privateData, def->nets[i]) < 0)
> + if (prlsdkAddNet(sdkdom, conn->privateData, def->nets[i],
> IS_CT(def)) < 0)
> goto error;
> }