mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
storage: Ensure the device path exists before refreshing disk pool
Doing libvirt_parthelper on an not existed device path will get an unfriendly error message. This patch is to prohibit it.
This commit is contained in:
parent
232392b1c6
commit
891c6fd74f
@ -262,7 +262,6 @@ static int
|
||||
virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
|
||||
virStorageVolDefPtr vol)
|
||||
{
|
||||
|
||||
/*
|
||||
* # libvirt_parthelper DEVICE
|
||||
* /dev/sda1 normal data 32256 106928128 106896384
|
||||
@ -320,6 +319,13 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
virFileWaitForDevices();
|
||||
|
||||
if (!virFileExists(pool->def->source.devices[0].path)) {
|
||||
virStorageReportError(VIR_ERR_INVALID_ARG,
|
||||
_("device path '%s' doesn't exist"),
|
||||
pool->def->source.devices[0].path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virStorageBackendDiskReadGeometry(pool) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user