[libvirt] [PATCH] storage: netfs and iscsi need option srcSpec for resource discovery

The option 'srcSpec' to virsh command find-storage-pool-sources is optional for logical type of storage pool, but mandatory for netfs and iscsi type. When missing the option for netfs and iscsi, libvirt reports XML parsing error due to null string option srcSpec. error: Failed to find any netfs pool sources error: (storage_source_specification):1: Document is empty (null) This patch adds a check for it, error info changed to: error: Failed to find any netfs pool sources error: internal error pool type 'netfs' need option \ --srcSpec for source discovery --- src/storage/storage_driver.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index fbc630d..e5f3e1b 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -458,6 +458,14 @@ storageFindPoolSources(virConnectPtr conn, goto cleanup; } + if ((*srcSpec == '\0') && (backend_type == VIR_STORAGE_POOL_ISCSI || + backend_type == VIR_STORAGE_POOL_NETFS)) { + virStorageReportError(VIR_ERR_INTERNAL_ERROR, + _("pool type '%s' need option --srcSpec " + "for source discovery"), type); + goto cleanup; + } + ret = backend->findPoolSources(conn, srcSpec, flags); cleanup: -- 1.7.7.5

On Mon, 16 Jul 2012 at 15:21 GMT, Guannan Ren <gren@redhat.com> wrote:
This patch adds a check for it, error info changed to: error: Failed to find any netfs pool sources error: internal error pool type 'netfs' need option \ --srcSpec for source discovery
s/need/needs/

On 07/18/2012 05:58 PM, Cong Wang wrote:
On Mon, 16 Jul 2012 at 15:21 GMT, Guannan Ren <gren@redhat.com> wrote:
This patch adds a check for it, error info changed to: error: Failed to find any netfs pool sources error: internal error pool type 'netfs' need option \ --srcSpec for source discovery s/need/needs/
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Thanks guy. :)
participants (2)
-
Cong Wang
-
Guannan Ren