qemuDomainObjPrivate *priv)
{
virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
virStorageSource *src = NULL;
+ g_autofree char *devstr = NULL;
switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
scsisrc->u.host.src = virStorageSourceNew();
src = scsisrc->u.host.src;
+ if (!(devstr = virSCSIDeviceGetSgName(NULL,
+ scsihostsrc->adapter,
+ scsihostsrc->bus,
+ scsihostsrc->target,
+ scsihostsrc->unit)))
+ return -1;
+
src->type = VIR_STORAGE_TYPE_BLOCK;
+ src->path = g_strdup_printf("/dev/%s", devstr);
break;
static int
-qemuConnectDomainXMLToNativePrepareHostHostdev(virDomainHostdevDef *hostdev)
-{
- if (virHostdevIsSCSIDevice(hostdev)) {
- virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
-
- switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: {
- virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
- virStorageSource *src = scsisrc->u.host.src;
- g_autofree char *devstr = NULL;
-
- if (!(devstr = virSCSIDeviceGetSgName(NULL,
- scsihostsrc->adapter,
- scsihostsrc->bus,
- scsihostsrc->target,
- scsihostsrc->unit)))
- return -1;
-
- src->path = g_strdup_printf("/dev/%s", devstr);
- break;
- }
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
- break;
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST:
- default:
- virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc->protocol);
- return -1;
- }
- }
-
+qemuConnectDomainXMLToNativePrepareHostHostdev(virDomainHostdevDef *hostdev G_GNUC_UNUSED)
+{
return 0;
}
int
-qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev)
-{
- if (virHostdevIsSCSIDevice(hostdev)) {
- virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
-
- switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: {
- virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
- virStorageSource *src = scsisrc->u.host.src;
- g_autofree char *devstr = NULL;
-
- if (!(devstr = virSCSIDeviceGetSgName(NULL,
- scsihostsrc->adapter,
- scsihostsrc->bus,
- scsihostsrc->target,
- scsihostsrc->unit)))
- return -1;
-
- src->path = g_strdup_printf("/dev/%s", devstr);
- break;
- }
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
- break;
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST:
- default:
- virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc->protocol);
- return -1;
- }
- }
-
+qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev G_GNUC_UNUSED)
+{
return 0;
}
return 0;
}
+char *
+virSCSIDeviceGetSgName(const char *sysfs_prefix G_GNUC_UNUSED,
+ const char *adapter G_GNUC_UNUSED,
+ unsigned int bus G_GNUC_UNUSED,
+ unsigned int target G_GNUC_UNUSED,
+ unsigned long long unit G_GNUC_UNUSED)
+{
+ return g_strdup_printf("sg0");
+}
+
int
virNetDevTapCreate(char **ifname,
const char *tunpath G_GNUC_UNUSED,
disk->src->hostcdrom = true;
}
- for (i = 0; i < vm->def->nhostdevs; i++) {
- virDomainHostdevDef *hostdev = vm->def->hostdevs[i];
-
- if (virHostdevIsSCSIDevice(hostdev)) {
- virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
-
- switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
- scsisrc->u.host.src->path = g_strdup("/dev/sg0");
- break;
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
- break;
-
- case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST:
- default:
- virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc->protocol);
- return NULL;
- }
- }
- }
-
if (vm->def->vsock) {
virDomainVsockDef *vsock = vm->def->vsock;
qemuDomainVsockPrivate *vsockPriv =