]> xenbits.xensource.com Git - libvirt.git/commitdiff
parallels: fill adapter model in virDomainNetDef
authorDmitry Guryanov <dguryanov@parallels.com>
Tue, 7 Apr 2015 20:35:05 +0000 (23:35 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Apr 2015 07:50:29 +0000 (09:50 +0200)
We handle this parameter for VMs while defining
domains, so let's get this property from PCS and
set corresponding field of virDomainNetDef in
prlsdkLoadDomains function.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
src/parallels/parallels_sdk.c

index 540918ef9893e21e6dcdf315b65b519c1e538364..21953f09dc30520f6a7b7e0d727b4bdab45bc5e8 100644 (file)
@@ -754,6 +754,31 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool isCt)
 
     }
 
+    if (!isCt) {
+        PRL_VM_NET_ADAPTER_TYPE type;
+        pret = PrlVmDevNet_GetAdapterType(netAdapter, &type);
+        prlsdkCheckRetGoto(pret, cleanup);
+
+        switch (type) {
+        case PNT_RTL:
+            if (VIR_STRDUP(net->model, "rtl8139") < 0)
+                goto cleanup;
+            break;
+        case PNT_E1000:
+            if (VIR_STRDUP(net->model, "e1000") < 0)
+                goto cleanup;
+            break;
+        case PNT_VIRTIO:
+            if (VIR_STRDUP(net->model, "virtio") < 0)
+                goto cleanup;
+            break;
+        default:
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Unknown adapter type: %X"), type);
+            goto cleanup;
+        }
+    }
+
     pret = PrlVmDev_IsConnected(netAdapter, &isConnected);
     prlsdkCheckRetGoto(pret, cleanup);