mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Use virDomainDiskByName where appropriate
Most virDomainDiskIndexByName callers do not care about the index; what they really want is a disk def pointer. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
865109b353
commit
82cffb58a1
@ -3502,18 +3502,16 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
|
|||||||
{
|
{
|
||||||
virDomainDiskDefPtr orig;
|
virDomainDiskDefPtr orig;
|
||||||
virDomainDiskDefPtr disk;
|
virDomainDiskDefPtr disk;
|
||||||
int idx;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
switch (dev->type) {
|
switch (dev->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
disk = dev->data.disk;
|
disk = dev->data.disk;
|
||||||
if ((idx = virDomainDiskIndexByName(vmdef, disk->dst, false)) < 0) {
|
if (!(orig = virDomainDiskByName(vmdef, disk->dst, false))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("target %s doesn't exist."), disk->dst);
|
_("target %s doesn't exist."), disk->dst);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
orig = vmdef->disks[idx];
|
|
||||||
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) {
|
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("this disk doesn't support update"));
|
_("this disk doesn't support update"));
|
||||||
|
@ -2332,7 +2332,7 @@ lxcDomainBlockStats(virDomainPtr dom,
|
|||||||
const char *path,
|
const char *path,
|
||||||
virDomainBlockStatsPtr stats)
|
virDomainBlockStatsPtr stats)
|
||||||
{
|
{
|
||||||
int ret = -1, idx;
|
int ret = -1;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
virLXCDomainObjPrivatePtr priv;
|
virLXCDomainObjPrivatePtr priv;
|
||||||
@ -2367,12 +2367,11 @@ lxcDomainBlockStats(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
|
if (!(disk = virDomainDiskByName(vm->def, path, false))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("invalid path: %s"), path);
|
_("invalid path: %s"), path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
disk = vm->def->disks[idx];
|
|
||||||
|
|
||||||
if (!disk->info.alias) {
|
if (!disk->info.alias) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -2400,7 +2399,7 @@ lxcDomainBlockStatsFlags(virDomainPtr dom,
|
|||||||
int * nparams,
|
int * nparams,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int tmp, ret = -1, idx;
|
int tmp, ret = -1;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
virLXCDomainObjPrivatePtr priv;
|
virLXCDomainObjPrivatePtr priv;
|
||||||
@ -2449,12 +2448,11 @@ lxcDomainBlockStatsFlags(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
|
if (!(disk = virDomainDiskByName(vm->def, path, false))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("invalid path: %s"), path);
|
_("invalid path: %s"), path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
disk = vm->def->disks[idx];
|
|
||||||
|
|
||||||
if (!disk->info.alias) {
|
if (!disk->info.alias) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -1850,9 +1850,10 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
|
|||||||
for (j = 0; j < ndisk; j++) {
|
for (j = 0; j < ndisk; j++) {
|
||||||
virJSONValuePtr disk = virJSONValueArrayGet(entry, j);
|
virJSONValuePtr disk = virJSONValueArrayGet(entry, j);
|
||||||
virJSONValuePtr pci;
|
virJSONValuePtr pci;
|
||||||
int diskaddr[3], pciaddr[4], idx;
|
int diskaddr[3], pciaddr[4];
|
||||||
const char *diskaddr_comp[] = {"bus", "target", "unit"};
|
const char *diskaddr_comp[] = {"bus", "target", "unit"};
|
||||||
const char *pciaddr_comp[] = {"domain", "bus", "slot", "function"};
|
const char *pciaddr_comp[] = {"domain", "bus", "slot", "function"};
|
||||||
|
virDomainDiskDefPtr diskDef;
|
||||||
|
|
||||||
if (!disk) {
|
if (!disk) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1892,12 +1893,12 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
|
|||||||
pci_address.bus = pciaddr[1];
|
pci_address.bus = pciaddr[1];
|
||||||
pci_address.slot = pciaddr[2];
|
pci_address.slot = pciaddr[2];
|
||||||
pci_address.function = pciaddr[3];
|
pci_address.function = pciaddr[3];
|
||||||
if ((idx = virDomainDiskIndexByAddress(
|
if (!(diskDef = virDomainDiskByAddress(
|
||||||
vmdef, &pci_address,
|
vmdef, &pci_address,
|
||||||
diskaddr[0], diskaddr[1], diskaddr[2])) < 0)
|
diskaddr[0], diskaddr[1], diskaddr[2])))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (VIR_STRDUP(*alias, vmdef->disks[idx]->dst) < 0)
|
if (VIR_STRDUP(*alias, diskDef->dst) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (*alias) {
|
if (*alias) {
|
||||||
|
@ -82,11 +82,10 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
|
|||||||
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
|
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
|
||||||
if (disk->mirrorState == VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT) {
|
if (disk->mirrorState == VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT) {
|
||||||
if (vm->newDef) {
|
if (vm->newDef) {
|
||||||
int indx = virDomainDiskIndexByName(vm->newDef, disk->dst, false);
|
|
||||||
virStorageSourcePtr copy = NULL;
|
virStorageSourcePtr copy = NULL;
|
||||||
|
|
||||||
if (indx >= 0) {
|
if ((persistDisk = virDomainDiskByName(vm->newDef,
|
||||||
persistDisk = vm->newDef->disks[indx];
|
disk->dst, false))) {
|
||||||
copy = virStorageSourceCopy(disk->mirror, false);
|
copy = virStorageSourceCopy(disk->mirror, false);
|
||||||
if (virStorageSourceInitChainElement(copy,
|
if (virStorageSourceInitChainElement(copy,
|
||||||
persistDisk->src,
|
persistDisk->src,
|
||||||
|
@ -8559,13 +8559,11 @@ qemuDomainUpdateDeviceConfig(virQEMUCapsPtr qemuCaps,
|
|||||||
switch ((virDomainDeviceType) dev->type) {
|
switch ((virDomainDeviceType) dev->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
disk = dev->data.disk;
|
disk = dev->data.disk;
|
||||||
pos = virDomainDiskIndexByName(vmdef, disk->dst, false);
|
if (!(orig = virDomainDiskByName(vmdef, disk->dst, false))) {
|
||||||
if (pos < 0) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("target %s doesn't exist."), disk->dst);
|
_("target %s doesn't exist."), disk->dst);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
orig = vmdef->disks[pos];
|
|
||||||
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
|
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
|
||||||
!(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
|
!(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
@ -11163,7 +11161,7 @@ qemuDomainBlockResize(virDomainPtr dom,
|
|||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
int ret = -1, idx;
|
int ret = -1;
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
|
|
||||||
@ -11203,12 +11201,11 @@ qemuDomainBlockResize(virDomainPtr dom,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
|
if (!(disk = virDomainDiskByName(vm->def, path, false))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("invalid path: %s"), path);
|
_("invalid path: %s"), path);
|
||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
disk = vm->def->disks[idx];
|
|
||||||
|
|
||||||
/* qcow2 and qed must be sized on 512 byte blocks/sectors,
|
/* qcow2 and qed must be sized on 512 byte blocks/sectors,
|
||||||
* so adjust size if necessary to round up.
|
* so adjust size if necessary to round up.
|
||||||
@ -11291,13 +11288,10 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (*path) {
|
if (*path) {
|
||||||
int idx;
|
if (!(disk = virDomainDiskByName(vm->def, path, false))) {
|
||||||
|
|
||||||
if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path);
|
virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
disk = vm->def->disks[idx];
|
|
||||||
|
|
||||||
if (!disk->info.alias) {
|
if (!disk->info.alias) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -12178,7 +12172,6 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainDiskDefPtr disk = NULL;
|
virDomainDiskDefPtr disk = NULL;
|
||||||
virStorageSourcePtr src;
|
virStorageSourcePtr src;
|
||||||
int idx;
|
|
||||||
bool activeFail = false;
|
bool activeFail = false;
|
||||||
virQEMUDriverConfigPtr cfg = NULL;
|
virQEMUDriverConfigPtr cfg = NULL;
|
||||||
|
|
||||||
@ -12205,14 +12198,12 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
|
|||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Check the path belongs to this domain. */
|
if (!(disk = virDomainDiskByName(vm->def, path, false))) {
|
||||||
if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("invalid path %s not assigned to domain"), path);
|
_("invalid path %s not assigned to domain"), path);
|
||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
disk = vm->def->disks[idx];
|
|
||||||
src = disk->src;
|
src = disk->src;
|
||||||
if (virStorageSourceIsEmpty(src)) {
|
if (virStorageSourceIsEmpty(src)) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
@ -14640,15 +14631,11 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if (snap->def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
|
if (snap->def->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
|
||||||
continue;
|
continue;
|
||||||
if (vm->newDef) {
|
if (vm->newDef &&
|
||||||
int indx = virDomainDiskIndexByName(vm->newDef,
|
(persistDisk = virDomainDiskByName(vm->newDef,
|
||||||
vm->def->disks[i]->dst,
|
vm->def->disks[i]->dst,
|
||||||
false);
|
false)))
|
||||||
if (indx >= 0) {
|
|
||||||
persistDisk = vm->newDef->disks[indx];
|
|
||||||
persist = true;
|
persist = true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = qemuDomainSnapshotCreateSingleDiskActive(driver, vm,
|
ret = qemuDomainSnapshotCreateSingleDiskActive(driver, vm,
|
||||||
&snap->def->disks[i],
|
&snap->def->disks[i],
|
||||||
@ -14681,15 +14668,11 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
|||||||
if (snap->def->disks[i].snapshot ==
|
if (snap->def->disks[i].snapshot ==
|
||||||
VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
|
VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
|
||||||
continue;
|
continue;
|
||||||
if (vm->newDef) {
|
if (vm->newDef &&
|
||||||
int indx = virDomainDiskIndexByName(vm->newDef,
|
(persistDisk = virDomainDiskByName(vm->newDef,
|
||||||
vm->def->disks[i]->dst,
|
vm->def->disks[i]->dst,
|
||||||
false);
|
false)))
|
||||||
if (indx >= 0) {
|
|
||||||
persistDisk = vm->newDef->disks[indx];
|
|
||||||
persist = true;
|
persist = true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qemuDomainSnapshotUndoSingleDiskActive(driver, vm,
|
qemuDomainSnapshotUndoSingleDiskActive(driver, vm,
|
||||||
vm->def->disks[i],
|
vm->def->disks[i],
|
||||||
@ -17687,7 +17670,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
int conf_idx = -1;
|
virDomainDiskDefPtr conf_disk = NULL;
|
||||||
bool set_bytes = false;
|
bool set_bytes = false;
|
||||||
bool set_iops = false;
|
bool set_iops = false;
|
||||||
bool set_bytes_max = false;
|
bool set_bytes_max = false;
|
||||||
@ -17921,7 +17904,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
if ((conf_idx = virDomainDiskIndexByName(persistentDef, disk, true)) < 0) {
|
if (!(conf_disk = virDomainDiskByName(persistentDef, disk, true))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("missing persistent configuration for disk '%s'"),
|
_("missing persistent configuration for disk '%s'"),
|
||||||
disk);
|
disk);
|
||||||
@ -17999,8 +17982,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
sa_assert(persistentDef);
|
oldinfo = &conf_disk->blkdeviotune;
|
||||||
oldinfo = &persistentDef->disks[conf_idx]->blkdeviotune;
|
|
||||||
if (!set_bytes) {
|
if (!set_bytes) {
|
||||||
info.total_bytes_sec = oldinfo->total_bytes_sec;
|
info.total_bytes_sec = oldinfo->total_bytes_sec;
|
||||||
info.read_bytes_sec = oldinfo->read_bytes_sec;
|
info.read_bytes_sec = oldinfo->read_bytes_sec;
|
||||||
@ -18011,7 +17993,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
|
|||||||
info.read_iops_sec = oldinfo->read_iops_sec;
|
info.read_iops_sec = oldinfo->read_iops_sec;
|
||||||
info.write_iops_sec = oldinfo->write_iops_sec;
|
info.write_iops_sec = oldinfo->write_iops_sec;
|
||||||
}
|
}
|
||||||
persistentDef->disks[conf_idx]->blkdeviotune = info;
|
conf_disk->blkdeviotune = info;
|
||||||
ret = virDomainSaveConfig(cfg->configDir, persistentDef);
|
ret = virDomainSaveConfig(cfg->configDir, persistentDef);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
@ -18105,14 +18087,14 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||||
int idx = virDomainDiskIndexByName(persistentDef, disk, true);
|
virDomainDiskDefPtr diskDef;
|
||||||
if (idx < 0) {
|
if (!(diskDef = virDomainDiskByName(persistentDef, disk, true))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("disk '%s' was not found in the domain config"),
|
_("disk '%s' was not found in the domain config"),
|
||||||
disk);
|
disk);
|
||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
reply = persistentDef->disks[idx]->blkdeviotune;
|
reply = diskDef->blkdeviotune;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX && i < *nparams; i++) {
|
for (i = 0; i < QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX && i < *nparams; i++) {
|
||||||
|
@ -1594,21 +1594,19 @@ qemuMigrationPrecreateStorage(virConnectPtr conn,
|
|||||||
|
|
||||||
for (i = 0; i < nbd->ndisks; i++) {
|
for (i = 0; i < nbd->ndisks; i++) {
|
||||||
virDomainDiskDefPtr disk;
|
virDomainDiskDefPtr disk;
|
||||||
int indx;
|
|
||||||
const char *diskSrcPath;
|
const char *diskSrcPath;
|
||||||
|
|
||||||
VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)",
|
VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)",
|
||||||
nbd->disks[i].target, nbd->disks[i].capacity);
|
nbd->disks[i].target, nbd->disks[i].capacity);
|
||||||
|
|
||||||
if ((indx = virDomainDiskIndexByName(vm->def,
|
if (!(disk = virDomainDiskByName(vm->def, nbd->disks[i].target,
|
||||||
nbd->disks[i].target, false)) < 0) {
|
false))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unable to find disk by target: %s"),
|
_("unable to find disk by target: %s"),
|
||||||
nbd->disks[i].target);
|
nbd->disks[i].target);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
disk = vm->def->disks[indx];
|
|
||||||
diskSrcPath = virDomainDiskGetSource(disk);
|
diskSrcPath = virDomainDiskGetSource(disk);
|
||||||
|
|
||||||
if (disk->src->shared || disk->src->readonly ||
|
if (disk->src->shared || disk->src->readonly ||
|
||||||
|
@ -357,21 +357,6 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virDomainDiskDefPtr
|
|
||||||
qemuProcessFindDomainDiskByPath(virDomainObjPtr vm,
|
|
||||||
const char *path)
|
|
||||||
{
|
|
||||||
int idx = virDomainDiskIndexByName(vm->def, path, true);
|
|
||||||
|
|
||||||
if (idx >= 0)
|
|
||||||
return vm->def->disks[idx];
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("no disk found with path %s"),
|
|
||||||
path);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
virDomainDiskDefPtr
|
virDomainDiskDefPtr
|
||||||
qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm,
|
qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm,
|
||||||
const char *alias)
|
const char *alias)
|
||||||
@ -492,10 +477,12 @@ qemuProcessFindVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
virObjectLock(vm);
|
virObjectLock(vm);
|
||||||
disk = qemuProcessFindDomainDiskByPath(vm, path);
|
if (!(disk = virDomainDiskByName(vm->def, path, true))) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
if (!disk)
|
_("no disk found with path %s"),
|
||||||
|
path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ret = qemuProcessGetVolumeQcowPassphrase(conn, disk, secretRet, secretLen);
|
ret = qemuProcessGetVolumeQcowPassphrase(conn, disk, secretRet, secretLen);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user