From nobody Tue Apr 16 11:22:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531322837396436.94254979620314; Wed, 11 Jul 2018 08:27:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B459C30820D7; Wed, 11 Jul 2018 15:27:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6ECB22010D5C; Wed, 11 Jul 2018 15:27:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D4BE118037EF; Wed, 11 Jul 2018 15:27:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6BFRDis030753 for ; Wed, 11 Jul 2018 11:27:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FFCD2010CBF; Wed, 11 Jul 2018 15:27:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 037C32010D5A for ; Wed, 11 Jul 2018 15:27:11 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 692E8307D85C for ; Wed, 11 Jul 2018 15:26:59 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id c13-v6so18566228wrt.1 for ; Wed, 11 Jul 2018 08:26:59 -0700 (PDT) Received: from localhost.localdomain (240.red-83-61-121.dynamicip.rima-tde.net. [83.61.121.240]) by smtp.gmail.com with ESMTPSA id x124-v6sm1740518wmg.38.2018.07.11.08.26.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 08:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2cbag/R/IZLCBmYI7UM/lXMk9eFsifhWAYDzGC0eKBg=; b=YPxtlix8nHc9atTrscPR5fCO1wTqDyA0+FII0y1MEVlAtXdX8Hj0Kwq2mjAhls/Qw+ Kuwr3DHWQmJ1/b49Owsmgl36o4qPzJJWEItvEyxHBSem48wgEiRhE+IDeMk0Rdkm7C5g MxX5se8ZLAt789w3i6LjMn7fGOg63JaK7c1+1ThDSYt4JB07sJihp94ueVtWh1EfrMyR lAEsmgGgd9TWE1dJDKRF69A593bYj/oEnqLiElKe580vslSeOJ680MtzRfmnZamrg2Uy rURLb/HzASfJ9f293qbiMl8MuJA7DaIwIIy0MsVaeFUImIl2KVK8YJD9YUa7lNfY82yi i4uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2cbag/R/IZLCBmYI7UM/lXMk9eFsifhWAYDzGC0eKBg=; b=d1OGjD3aV1h4T3qlCSwQjWkA1/mBafTDAiedXLyfcorZDZc1KMligpFCVg1m3s6tR9 7Dc4N+9G0CRjTPA6zgTau+w+t1p8cK1P5xq/M9dalYBPxBtfGyilO5N96bW88lWe1fQM uglJn43dSln7UxD0dG1QqJZNjV/mr7z+CFZR9/nT2AGB+HtjkD5IMgDPSH0jdIWnq+/7 BaAT9Cq3J8oqVn2AJ8pMhdY/7HlZBjJK6MxfM2iC9nDpDJVtGFW9mNtg3CoEHspBRdQD CyI+YKF3Jp5UM9tFK0gMyxN7DO8ce3MI2FoOfoID09E59hJM4KkyE5VpW+3kLx+Syp/M y0Tg== X-Gm-Message-State: APt69E0/7LhdpT7yT1b9rs0ZByxj9DsKGosDH1YXCtLrHmQ3FYklGHYJ 8EJG1elyZwFIEST9KoUFJ4KxgtXo X-Google-Smtp-Source: AAOMgpeY0N2fyF+lh56vwS0D6fxfzDxs4PxYMGOlxSmlVHTrp2xfaSrviyp9JSTsfql74HPu5sySbQ== X-Received: by 2002:adf:fdcd:: with SMTP id i13-v6mr20359913wrs.276.1531322817777; Wed, 11 Jul 2018 08:26:57 -0700 (PDT) From: Javier Uruen Val To: libvir-list@redhat.com Date: Wed, 11 Jul 2018 15:26:45 +0000 Message-Id: <20180711152645.31468-1-javi.uruen@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 11 Jul 2018 15:26:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 11 Jul 2018 15:26:59 +0000 (UTC) for IP:'209.85.221.44' DOMAIN:'mail-wr1-f44.google.com' HELO:'mail-wr1-f44.google.com' FROM:'javi.uruen@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.221.44 mail-wr1-f44.google.com 209.85.221.44 mail-wr1-f44.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: Javier Uruen Val Subject: [libvirt] [PATCH] vmx: add support for hostonly interfaces X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 11 Jul 2018 15:27:16 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Vmware fusion allows you to configure a network interface as "hostonly". This uses a private network that is not normally accessible from the physical networks on the Mac/PC. We map "hostonly" in the vmx configuration to "network" in the domain configuration. Some comments in vmx.c seem to point towards using this mapping and not other such as "internal" or something else. Added tests and configuration files from actual vmx machines configured with "hostonly". Signed-off-by: Javier Uruen Val --- src/vmx/vmx.c | 19 ++- .../vmx2xml-fusion-in-the-wild-2.vmx | 115 ++++++++++++++++++ .../vmx2xml-fusion-in-the-wild-2.xml | 34 ++++++ tests/vmx2xmltest.c | 1 + .../xml2vmx-fusion-in-the-wild-2.vmx | 36 ++++++ .../xml2vmx-fusion-in-the-wild-2.xml | 31 +++++ tests/xml2vmxtest.c | 1 + 7 files changed, 231 insertions(+), 6 deletions(-) create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.xml create mode 100755 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.xml diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index fe24b060d7..c812a8fb33 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2650,6 +2650,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, = virDomainNetDefPtr *def) /* vmx:networkName -> def:data.bridge.brname */ if (connectionType =3D=3D NULL || STRCASEEQ(connectionType, "bridged") || + STRCASEEQ(connectionType, "hostonly") || STRCASEEQ(connectionType, "custom")) { if (virVMXGetConfigString(conf, networkName_name, &networkName, true) < 0) @@ -2674,11 +2675,12 @@ virVMXParseEthernet(virConfPtr conf, int controller= , virDomainNetDefPtr *def) virtualDev =3D NULL; networkName =3D NULL; } else if (STRCASEEQ(connectionType, "hostonly")) { - /* FIXME */ - virReportError(VIR_ERR_INTERNAL_ERROR, - _("No yet handled value '%s' for VMX entry '%s'"), - connectionType, connectionType_name); - goto cleanup; + (*def)->type =3D VIR_DOMAIN_NET_TYPE_NETWORK; + (*def)->model =3D virtualDev; + (*def)->data.network.name =3D networkName; + + virtualDev =3D NULL; + networkName =3D NULL; } else if (STRCASEEQ(connectionType, "nat")) { (*def)->type =3D VIR_DOMAIN_NET_TYPE_USER; (*def)->model =3D virtualDev; @@ -3783,6 +3785,12 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int con= troller, case VIR_DOMAIN_NET_TYPE_USER: virBufferAsprintf(buffer, "ethernet%d.connectionType =3D \"nat\"\n= ", controller); + + break; + + case VIR_DOMAIN_NET_TYPE_NETWORK: + virBufferAsprintf(buffer, "ethernet%d.connectionType =3D \"hostonl= y\"\n", + controller); break; =20 case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -3790,7 +3798,6 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int cont= roller, case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: - case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.vmx b/tests/vmx= 2xmldata/vmx2xml-fusion-in-the-wild-2.vmx new file mode 100644 index 0000000000..c871cca540 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.vmx @@ -0,0 +1,115 @@ +.encoding =3D "UTF-8" +config.version =3D "8" +virtualHW.version =3D "12" +vcpu.hotadd =3D "TRUE" +scsi0.present =3D "TRUE" +scsi0.virtualDev =3D "lsilogic" +sata0.present =3D "TRUE" +memsize =3D "4996" +mem.hotadd =3D "TRUE" +scsi0:0.present =3D "TRUE" +scsi0:0.fileName =3D "Virtual Disk.vmdk" +sata0:1.present =3D "TRUE" +sata0:1.autodetect =3D "TRUE" +sata0:1.deviceType =3D "cdrom-image" +sata0:1.startConnected =3D "FALSE" +ethernet0.present =3D "TRUE" +ethernet0.connectionType =3D "hostonly" +ethernet0.virtualDev =3D "e1000" +ethernet0.wakeOnPcktRcv =3D "FALSE" +ethernet0.addressType =3D "generated" +ethernet0.linkStatePropagation.enable =3D "FALSE" +usb.present =3D "TRUE" +ehci.present =3D "TRUE" +ehci.pciSlotNumber =3D "35" +sound.present =3D "TRUE" +sound.fileName =3D "-1" +sound.autodetect =3D "TRUE" +mks.enable3d =3D "TRUE" +svga.graphicsMemoryKB =3D "786432" +pciBridge0.present =3D "TRUE" +pciBridge4.present =3D "TRUE" +pciBridge4.virtualDev =3D "pcieRootPort" +pciBridge4.functions =3D "8" +pciBridge5.present =3D "TRUE" +pciBridge5.virtualDev =3D "pcieRootPort" +pciBridge5.functions =3D "8" +pciBridge6.present =3D "TRUE" +pciBridge6.virtualDev =3D "pcieRootPort" +pciBridge6.functions =3D "8" +pciBridge7.present =3D "TRUE" +pciBridge7.virtualDev =3D "pcieRootPort" +pciBridge7.functions =3D "8" +vmci0.present =3D "TRUE" +hpet0.present =3D "TRUE" +usb.vbluetooth.startConnected =3D "TRUE" +tools.syncTime =3D "TRUE" +displayName =3D "Ubuntu16.04" +guestOS =3D "ubuntu-64" +nvram =3D "Ubuntu16.04.nvram" +virtualHW.productCompatibility =3D "hosted" +tools.upgrade.policy =3D "upgradeAtPowerCycle" +powerType.powerOff =3D "soft" +powerType.powerOn =3D "soft" +powerType.suspend =3D "soft" +powerType.reset =3D "soft" +extendedConfigFile =3D "Ubuntu16.04.vmxf" +uuid.bios =3D "56 4d 97 36 09 cb ba 6f-20 57 e7 01 50 72 7f 3f" +uuid.location =3D "56 4d 97 36 09 cb ba 6f-20 57 e7 01 50 72 7f 3f" +migrate.hostlog =3D "./Ubuntu16.04-7a77148b.hlog" +scsi0:0.redo =3D "" +pciBridge0.pciSlotNumber =3D "17" +pciBridge4.pciSlotNumber =3D "21" +pciBridge5.pciSlotNumber =3D "22" +pciBridge6.pciSlotNumber =3D "23" +pciBridge7.pciSlotNumber =3D "24" +scsi0.pciSlotNumber =3D "16" +usb.pciSlotNumber =3D "32" +ethernet0.pciSlotNumber =3D "33" +sound.pciSlotNumber =3D "34" +vmci0.pciSlotNumber =3D "36" +sata0.pciSlotNumber =3D "37" +ethernet0.generatedAddress =3D "00:0C:29:72:7F:3F" +ethernet0.generatedAddressOffset =3D "0" +vmci0.id =3D "1349680959" +monitor.phys_bits_used =3D "42" +vmotion.checkpointFBSize =3D "4194304" +vmotion.checkpointSVGAPrimarySize =3D "67108864" +cleanShutdown =3D "FALSE" +softPowerOff =3D "FALSE" +usb:1.speed =3D "2" +usb:1.present =3D "TRUE" +usb:1.deviceType =3D "hub" +usb:1.port =3D "1" +usb:1.parent =3D "-1" +checkpoint.vmState =3D "" +sata0:1.fileName =3D "/Users/johndoe/Downloads/ubuntu-16.04.3-desktop-amd6= 4.iso" +gui.lastPoweredViewMode =3D "windowed" +svga.guestBackedPrimaryAware =3D "TRUE" +gui.viewModeAtPowerOn =3D "windowed" +tools.remindInstall =3D "FALSE" +toolsInstallManager.updateCounter =3D "2" +toolsInstallManager.lastInstallError =3D "0" +keyboardAndMouseProfile =3D "52506018-92dd-7b40-6bc7-085ea95583f4" +isolation.tools.hgfs.disable =3D "false" +hgfs.mapRootShare =3D "true" +hgfs.linkRootShare =3D "true" +sharedFolder0.present =3D "true" +sharedFolder0.enabled =3D "TRUE" +sharedFolder0.readAccess =3D "true" +sharedFolder0.writeAccess =3D "true" +sharedFolder0.hostPath =3D "/Users/johndoe/dev/vmware-shared" +sharedFolder0.guestName =3D "vmware-shared" +sharedFolder0.expiration =3D "never" +sharedFolder.maxNum =3D "1" +gui.exitOnCLIHLT =3D "TRUE" +serial0.present =3D "FALSE" +floppy0.present =3D "FALSE" +usb:0.present =3D "TRUE" +usb:0.deviceType =3D "hid" +usb:0.port =3D "0" +usb:0.parent =3D "-1" +ehci:0.present =3D "TRUE" +ehci:0.deviceType =3D "video" +ehci:0.port =3D "0" +ehci:0.parent =3D "-1" diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.xml b/tests/vmx= 2xmldata/vmx2xml-fusion-in-the-wild-2.xml new file mode 100644 index 0000000000..2e0bf504f0 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-2.xml @@ -0,0 +1,34 @@ + + Ubuntu16.04 + 564d9736-09cb-ba6f-2057-e70150727f3f + 5115904 + 5115904 + 1 + + hvm + + + destroy + restart + destroy + + + + +
+ + + + + + + + + + + + + + diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 7289dc91e3..0db4702519 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -280,6 +280,7 @@ mymain(void) DO_TEST("ws-in-the-wild-2", "ws-in-the-wild-2"); =20 DO_TEST("fusion-in-the-wild-1", "fusion-in-the-wild-1"); + DO_TEST("fusion-in-the-wild-2", "fusion-in-the-wild-2"); =20 DO_TEST("annotation", "annotation"); =20 diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.vmx b/tests/xml= 2vmxdata/xml2vmx-fusion-in-the-wild-2.vmx new file mode 100755 index 0000000000..a5dbf5244c --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.vmx @@ -0,0 +1,36 @@ +.encoding =3D "UTF-8" +config.version =3D "8" +virtualHW.version =3D "9" +guestOS =3D "other-64" +uuid.bios =3D "56 4d 08 c1 40 dd 13 95-85 01 b3 af 47 74 24 7d" +displayName =3D "Windows 10 x64" +memsize =3D "6728" +numvcpus =3D "1" +scsi0.present =3D "true" +scsi0.virtualDev =3D "lsisas1068" +scsi0:0.present =3D "true" +scsi0:0.deviceType =3D "scsi-hardDisk" +scsi0:0.fileName =3D "/data/vmware/disk.vmdk" +floppy0.present =3D "false" +floppy1.present =3D "false" +ethernet0.present =3D "true" +ethernet0.virtualDev =3D "e1000" +ethernet0.connectionType =3D "hostonly" +ethernet0.addressType =3D "static" +ethernet0.address =3D "00:90:b9:dc:ea:81" +ethernet0.checkMACAddress =3D "false" +svga.vramSize =3D "4194304" +pciBridge0.present =3D "true" +pciBridge4.present =3D "true" +pciBridge4.virtualDev =3D "pcieRootPort" +pciBridge4.functions =3D "8" +pciBridge5.present =3D "true" +pciBridge5.virtualDev =3D "pcieRootPort" +pciBridge5.functions =3D "8" +pciBridge6.present =3D "true" +pciBridge6.virtualDev =3D "pcieRootPort" +pciBridge6.functions =3D "8" +pciBridge7.present =3D "true" +pciBridge7.virtualDev =3D "pcieRootPort" +pciBridge7.functions =3D "8" +vmci0.present =3D "true" diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.xml b/tests/xml= 2vmxdata/xml2vmx-fusion-in-the-wild-2.xml new file mode 100644 index 0000000000..be988e1bd9 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-2.xml @@ -0,0 +1,31 @@ + + Windows 10 x64 + 564d08c1-40dd-1395-8501-b3af4774247d + 6889472 + 6889472 + 1 + + hvm + + + + destroy + restart + destroy + + + + +
+ + + + + + + + + + diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index f6bcd7b012..e9bde580eb 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -290,6 +290,7 @@ mymain(void) DO_TEST("ws-in-the-wild-2", "ws-in-the-wild-2", 8); =20 DO_TEST("fusion-in-the-wild-1", "fusion-in-the-wild-1", 9); + DO_TEST("fusion-in-the-wild-2", "fusion-in-the-wild-2", 9); =20 DO_TEST("annotation", "annotation", 4); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list