mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 11:21:44 +03:00
vz: set default SCSI model
Each version of virtuozzo supports only one type of SCSI controller So if we add disk on SCSI bus, we should set SCSI controller model. We can take it from vzCapabilities structure.
This commit is contained in:
parent
97841dd9e6
commit
bb2f63da79
@ -1080,7 +1080,7 @@ static int vzDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
ret = prlsdkAttachVolume(privdom, dev->data.disk);
|
||||
ret = prlsdkAttachVolume(privconn, privdom, dev->data.disk);
|
||||
if (ret) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("disk attach failed"));
|
||||
|
@ -2989,7 +2989,8 @@ static int prlsdkDelDisk(PRL_HANDLE sdkdom, int idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int prlsdkAddDisk(PRL_HANDLE sdkdom,
|
||||
static int prlsdkAddDisk(vzConnPtr privconn,
|
||||
PRL_HANDLE sdkdom,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool bootDisk,
|
||||
bool isCt)
|
||||
@ -3003,6 +3004,7 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom,
|
||||
virDomainDeviceDriveAddressPtr drive;
|
||||
PRL_UINT32 devIndex;
|
||||
PRL_DEVICE_TYPE devType;
|
||||
PRL_CLUSTERED_DEVICE_SUBTYPE scsiModel;
|
||||
char *dst = NULL;
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
|
||||
@ -3100,6 +3102,13 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||
if (vzGetDefaultSCSIModel(privconn, &scsiModel) < 0)
|
||||
goto cleanup;
|
||||
pret = PrlVmDev_SetSubType(sdkdisk, scsiModel);
|
||||
prlsdkCheckRetGoto(pret, cleanup);
|
||||
}
|
||||
|
||||
pret = PrlVmDev_SetIfaceType(sdkdisk, sdkbus);
|
||||
prlsdkCheckRetGoto(pret, cleanup);
|
||||
|
||||
@ -3147,7 +3156,9 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom,
|
||||
}
|
||||
|
||||
int
|
||||
prlsdkAttachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk)
|
||||
prlsdkAttachVolume(vzConnPtr privconn,
|
||||
virDomainObjPtr dom,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
int ret = -1;
|
||||
vzDomObjPtr privdom = dom->privateData;
|
||||
@ -3157,7 +3168,11 @@ prlsdkAttachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk)
|
||||
if (PRL_FAILED(waitJob(job)))
|
||||
goto cleanup;
|
||||
|
||||
ret = prlsdkAddDisk(privdom->sdkdom, disk, false, IS_CT(dom->def));
|
||||
ret = prlsdkAddDisk(privconn,
|
||||
privdom->sdkdom,
|
||||
disk,
|
||||
false,
|
||||
IS_CT(dom->def));
|
||||
if (ret == 0) {
|
||||
job = PrlVm_CommitEx(privdom->sdkdom, PVCF_DETACH_HDD_BUNDLE);
|
||||
if (PRL_FAILED(waitJob(job))) {
|
||||
@ -3388,7 +3403,11 @@ prlsdkDoApplyConfig(virConnectPtr conn,
|
||||
needBoot = false;
|
||||
bootDisk = true;
|
||||
}
|
||||
if (prlsdkAddDisk(sdkdom, def->disks[i], bootDisk, IS_CT(def)) < 0)
|
||||
if (prlsdkAddDisk(conn->privateData,
|
||||
sdkdom,
|
||||
def->disks[i],
|
||||
bootDisk,
|
||||
IS_CT(def)) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ prlsdkUnregisterDomain(vzConnPtr privconn, virDomainObjPtr dom, unsigned int fla
|
||||
int
|
||||
prlsdkDomainManagedSaveRemove(virDomainObjPtr dom);
|
||||
int
|
||||
prlsdkAttachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
|
||||
prlsdkAttachVolume(vzConnPtr privconn, virDomainObjPtr dom, virDomainDiskDefPtr disk);
|
||||
int
|
||||
prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
|
||||
int
|
||||
|
@ -475,3 +475,23 @@ vzCheckUnsupportedControllers(virDomainDefPtr def, vzCapabilitiesPtr vzCaps)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vzGetDefaultSCSIModel(vzConnPtr privconn,
|
||||
PRL_CLUSTERED_DEVICE_SUBTYPE *scsiModel)
|
||||
{
|
||||
switch (privconn->vzCaps.scsiControllerModel) {
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
||||
*scsiModel = PCD_VIRTIO_SCSI;
|
||||
break;
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC:
|
||||
*scsiModel = PCD_BUSLOGIC;
|
||||
break;
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown SCSI controller model %s"),
|
||||
virDomainControllerModelSCSITypeToString(
|
||||
privconn->vzCaps.scsiControllerModel));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -118,6 +118,9 @@ vzCheckUnsupportedDisks(virDomainDefPtr def,
|
||||
int
|
||||
vzCheckUnsupportedControllers(virDomainDefPtr def,
|
||||
vzCapabilitiesPtr vzCaps);
|
||||
int
|
||||
vzGetDefaultSCSIModel(vzConnPtr privconn,
|
||||
PRL_CLUSTERED_DEVICE_SUBTYPE *scsiModel);
|
||||
|
||||
# define PARALLELS_BLOCK_STATS_FOREACH(OP) \
|
||||
OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \
|
||||
|
Loading…
Reference in New Issue
Block a user