mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: Add "shareable" field for virSCSIDevice struct
Unlike the host devices of other types, SCSI host device XML supports "shareable" tag. This patch introduces it for the virSCSIDevice struct for a later patch use (to detect if the SCSI device is shareable when preparing the SCSI host device in QEMU driver).
This commit is contained in:
parent
2340f0196f
commit
2b66504ded
@ -1683,6 +1683,7 @@ virSCSIDeviceGetDevName;
|
|||||||
virSCSIDeviceGetName;
|
virSCSIDeviceGetName;
|
||||||
virSCSIDeviceGetReadonly;
|
virSCSIDeviceGetReadonly;
|
||||||
virSCSIDeviceGetSgName;
|
virSCSIDeviceGetSgName;
|
||||||
|
virSCSIDeviceGetShareable;
|
||||||
virSCSIDeviceGetTarget;
|
virSCSIDeviceGetTarget;
|
||||||
virSCSIDeviceGetUnit;
|
virSCSIDeviceGetUnit;
|
||||||
virSCSIDeviceGetUsedBy;
|
virSCSIDeviceGetUsedBy;
|
||||||
|
@ -295,7 +295,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly)) == NULL)
|
dev->readonly,
|
||||||
|
dev->shareable)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virSCSIDeviceFileIterate(scsi,
|
if (virSCSIDeviceFileIterate(scsi,
|
||||||
|
@ -267,7 +267,8 @@ qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver,
|
|||||||
hostdev->source.subsys.u.scsi.bus,
|
hostdev->source.subsys.u.scsi.bus,
|
||||||
hostdev->source.subsys.u.scsi.target,
|
hostdev->source.subsys.u.scsi.target,
|
||||||
hostdev->source.subsys.u.scsi.unit,
|
hostdev->source.subsys.u.scsi.unit,
|
||||||
hostdev->readonly)))
|
hostdev->readonly,
|
||||||
|
hostdev->shareable)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virSCSIDeviceSetUsedBy(scsi, def->name);
|
virSCSIDeviceSetUsedBy(scsi, def->name);
|
||||||
@ -1097,7 +1098,8 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
|
|||||||
hostdev->source.subsys.u.scsi.bus,
|
hostdev->source.subsys.u.scsi.bus,
|
||||||
hostdev->source.subsys.u.scsi.target,
|
hostdev->source.subsys.u.scsi.target,
|
||||||
hostdev->source.subsys.u.scsi.unit,
|
hostdev->source.subsys.u.scsi.unit,
|
||||||
hostdev->readonly)))
|
hostdev->readonly,
|
||||||
|
hostdev->shareable)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
|
if (scsi && virSCSIDeviceListAdd(list, scsi) < 0) {
|
||||||
@ -1395,7 +1397,8 @@ qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
|
|||||||
hostdev->source.subsys.u.scsi.bus,
|
hostdev->source.subsys.u.scsi.bus,
|
||||||
hostdev->source.subsys.u.scsi.target,
|
hostdev->source.subsys.u.scsi.target,
|
||||||
hostdev->source.subsys.u.scsi.unit,
|
hostdev->source.subsys.u.scsi.unit,
|
||||||
hostdev->readonly))) {
|
hostdev->readonly,
|
||||||
|
hostdev->shareable))) {
|
||||||
VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
|
VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
|
||||||
hostdev->source.subsys.u.scsi.adapter,
|
hostdev->source.subsys.u.scsi.adapter,
|
||||||
hostdev->source.subsys.u.scsi.bus,
|
hostdev->source.subsys.u.scsi.bus,
|
||||||
|
@ -833,7 +833,8 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly);
|
dev->readonly,
|
||||||
|
dev->shareable);
|
||||||
|
|
||||||
if (!scsi)
|
if (!scsi)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -536,7 +536,8 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly);
|
dev->readonly,
|
||||||
|
dev->shareable);
|
||||||
|
|
||||||
if (!scsi)
|
if (!scsi)
|
||||||
goto done;
|
goto done;
|
||||||
@ -653,7 +654,8 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly);
|
dev->readonly,
|
||||||
|
dev->shareable);
|
||||||
|
|
||||||
if (!scsi)
|
if (!scsi)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1354,7 +1354,8 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virDomainDefPtr def,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly);
|
dev->readonly,
|
||||||
|
dev->shareable);
|
||||||
|
|
||||||
if (!scsi)
|
if (!scsi)
|
||||||
goto done;
|
goto done;
|
||||||
@ -1545,7 +1546,8 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
|
|||||||
dev->source.subsys.u.scsi.bus,
|
dev->source.subsys.u.scsi.bus,
|
||||||
dev->source.subsys.u.scsi.target,
|
dev->source.subsys.u.scsi.target,
|
||||||
dev->source.subsys.u.scsi.unit,
|
dev->source.subsys.u.scsi.unit,
|
||||||
dev->readonly);
|
dev->readonly,
|
||||||
|
dev->shareable);
|
||||||
|
|
||||||
if (!scsi)
|
if (!scsi)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -58,6 +58,7 @@ struct _virSCSIDevice {
|
|||||||
const char *used_by; /* name of the domain using this dev */
|
const char *used_by; /* name of the domain using this dev */
|
||||||
|
|
||||||
bool readonly;
|
bool readonly;
|
||||||
|
bool shareable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _virSCSIDeviceList {
|
struct _virSCSIDeviceList {
|
||||||
@ -185,7 +186,8 @@ virSCSIDeviceNew(const char *adapter,
|
|||||||
unsigned int bus,
|
unsigned int bus,
|
||||||
unsigned int target,
|
unsigned int target,
|
||||||
unsigned int unit,
|
unsigned int unit,
|
||||||
bool readonly)
|
bool readonly,
|
||||||
|
bool shareable)
|
||||||
{
|
{
|
||||||
virSCSIDevicePtr dev, ret = NULL;
|
virSCSIDevicePtr dev, ret = NULL;
|
||||||
char *sg = NULL;
|
char *sg = NULL;
|
||||||
@ -201,6 +203,7 @@ virSCSIDeviceNew(const char *adapter,
|
|||||||
dev->target = target;
|
dev->target = target;
|
||||||
dev->unit = unit;
|
dev->unit = unit;
|
||||||
dev->readonly = readonly;
|
dev->readonly = readonly;
|
||||||
|
dev->shareable= shareable;
|
||||||
|
|
||||||
if (!(sg = virSCSIDeviceGetSgName(adapter, bus, target, unit)))
|
if (!(sg = virSCSIDeviceGetSgName(adapter, bus, target, unit)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -311,6 +314,12 @@ virSCSIDeviceGetReadonly(virSCSIDevicePtr dev)
|
|||||||
return dev->readonly;
|
return dev->readonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
virSCSIDeviceGetShareable(virSCSIDevicePtr dev)
|
||||||
|
{
|
||||||
|
return dev->shareable;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virSCSIDeviceFileIterate(virSCSIDevicePtr dev,
|
virSCSIDeviceFileIterate(virSCSIDevicePtr dev,
|
||||||
virSCSIDeviceFileActor actor,
|
virSCSIDeviceFileActor actor,
|
||||||
|
@ -46,7 +46,8 @@ virSCSIDevicePtr virSCSIDeviceNew(const char *adapter,
|
|||||||
unsigned int bus,
|
unsigned int bus,
|
||||||
unsigned int target,
|
unsigned int target,
|
||||||
unsigned int unit,
|
unsigned int unit,
|
||||||
bool readonly);
|
bool readonly,
|
||||||
|
bool shareable);
|
||||||
|
|
||||||
void virSCSIDeviceFree(virSCSIDevicePtr dev);
|
void virSCSIDeviceFree(virSCSIDevicePtr dev);
|
||||||
void virSCSIDeviceSetUsedBy(virSCSIDevicePtr dev, const char *name);
|
void virSCSIDeviceSetUsedBy(virSCSIDevicePtr dev, const char *name);
|
||||||
@ -57,6 +58,7 @@ unsigned int virSCSIDeviceGetBus(virSCSIDevicePtr dev);
|
|||||||
unsigned int virSCSIDeviceGetTarget(virSCSIDevicePtr dev);
|
unsigned int virSCSIDeviceGetTarget(virSCSIDevicePtr dev);
|
||||||
unsigned int virSCSIDeviceGetUnit(virSCSIDevicePtr dev);
|
unsigned int virSCSIDeviceGetUnit(virSCSIDevicePtr dev);
|
||||||
bool virSCSIDeviceGetReadonly(virSCSIDevicePtr dev);
|
bool virSCSIDeviceGetReadonly(virSCSIDevicePtr dev);
|
||||||
|
bool virSCSIDeviceGetShareable(virSCSIDevicePtr dev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback that will be invoked once for each file
|
* Callback that will be invoked once for each file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user