mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
storageVolCreateXMLFrom: Check if backend knows how to createVol
It is highly unlikely that a backend will know how to create a volume from a different volume (buildVolFrom) and not know how to create an empty volume (createVol). But: 1) we call the function without any prior check so if that's the case we would SIGSEGV immediatelly 2) it's better to be safe than sorry. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
78490acc39
commit
611a278fa4
@ -2037,6 +2037,13 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
|
|||||||
if (newvol->target.capacity < origvol->target.capacity)
|
if (newvol->target.capacity < origvol->target.capacity)
|
||||||
newvol->target.capacity = origvol->target.capacity;
|
newvol->target.capacity = origvol->target.capacity;
|
||||||
|
|
||||||
|
if (!backend->createVol) {
|
||||||
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
|
"%s", _("storage pool does not support volume "
|
||||||
|
"creation"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (!backend->buildVolFrom) {
|
if (!backend->buildVolFrom) {
|
||||||
virReportError(VIR_ERR_NO_SUPPORT,
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
"%s", _("storage pool does not support"
|
"%s", _("storage pool does not support"
|
||||||
|
Loading…
Reference in New Issue
Block a user