mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
conf: Introduce support for usb-mtp devices
Expose usb-mtp device as another type of <filesystem/>. Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e529b7b5c4
commit
5c70a7e328
@ -3590,6 +3590,11 @@ A directory on the host that can be accessed directly from the guest.
|
||||
<source socket='/tmp/sock'/>
|
||||
<target dir='tag'/>
|
||||
</filesystem>
|
||||
<filesystem type='mount'>
|
||||
<driver type='mtp'/>
|
||||
<source dir='/export/to/guest'/>
|
||||
<target dir='mtptag'/>
|
||||
</filesystem>
|
||||
...
|
||||
</devices>
|
||||
...
|
||||
@ -3702,6 +3707,8 @@ A directory on the host that can be accessed directly from the guest.
|
||||
can also be set. ( :since:`Since 3.5.0` )
|
||||
- For ``virtiofs``, the ``queue`` attribute can be used to specify the queue
|
||||
size (i.e. how many requests can the queue fit). ( :since:`Since 6.2.0` )
|
||||
- QEMU supports ``mtp`` which exposes a virtual USB MTP device to the
|
||||
guest. ( :since:`Since 10.2.0` )
|
||||
|
||||
``binary``
|
||||
The optional ``binary`` element can tune the options for virtiofsd. All of
|
||||
|
@ -611,6 +611,7 @@ bhyveBuildFSArgStr(const virDomainDef *def G_GNUC_UNUSED,
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unsupported filesystem driver '%1$s'"),
|
||||
|
@ -517,6 +517,7 @@ VIR_ENUM_IMPL(virDomainFSDriver,
|
||||
"nbd",
|
||||
"ploop",
|
||||
"virtiofs",
|
||||
"mtp",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainFSAccessMode,
|
||||
@ -28724,6 +28725,15 @@ virDomainUSBDeviceDefForeach(virDomainDef *def,
|
||||
}
|
||||
}
|
||||
|
||||
/* usb-mtp */
|
||||
for (i = 0; i < def->nfss; i++) {
|
||||
virDomainFSDef *fsdev = def->fss[i];
|
||||
if (fsdev->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_MTP) {
|
||||
if (iter(&fsdev->info, opaque) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -804,6 +804,7 @@ typedef enum {
|
||||
VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
|
||||
VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
|
||||
VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS,
|
||||
VIR_DOMAIN_FS_DRIVER_TYPE_MTP,
|
||||
|
||||
VIR_DOMAIN_FS_DRIVER_TYPE_LAST
|
||||
} virDomainFSDriverType;
|
||||
|
@ -3253,6 +3253,11 @@
|
||||
</optional>
|
||||
<ref name="virtioOptions"/>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name="type">
|
||||
<value>mtp</value>
|
||||
</attribute>
|
||||
</group>
|
||||
<empty/>
|
||||
</choice>
|
||||
</element>
|
||||
|
@ -861,6 +861,7 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
|
||||
*baseName = "vhost-user-fs";
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||
@ -2496,6 +2497,7 @@ qemuBuildFilesystemCommandLine(virCommand *cmd,
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -642,6 +642,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
|
||||
/* vhost-user-fs-pci */
|
||||
return virtioFlags;
|
||||
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LOOP:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_NBD:
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP:
|
||||
@ -2074,8 +2075,10 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def,
|
||||
if (!virDeviceInfoPCIAddressIsWanted(&def->fss[i]->info))
|
||||
continue;
|
||||
|
||||
/* Only support VirtIO-9p-pci so far. If that changes,
|
||||
* we might need to skip devices here */
|
||||
/* Skip MTP device */
|
||||
if (def->fss[i]->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_MTP)
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->fss[i]->info) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -4469,6 +4469,19 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_MTP:
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_MTP)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("mtp is not supported with this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("mtp only supports passthrough accessmode"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainFSDriverType, fs->fsdriver);
|
||||
|
Loading…
Reference in New Issue
Block a user