]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: Don't use a stack copy of the adapter
authorJohn Ferlan <jferlan@redhat.com>
Mon, 10 Nov 2014 16:34:57 +0000 (11:34 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 12 Nov 2014 15:18:28 +0000 (10:18 -0500)
commit5b226fcdc6ea3b9be73e31b6cff88f65d754cb0d
treef4e3954a6162c4d9ef53360952a8b954c38c6766
parent42a021c1204d7dcb531f5d476e65b53a8bd4f704
storage: Don't use a stack copy of the adapter

https://bugzilla.redhat.com/show_bug.cgi?id=1160926

Passing a copy of the storage pool adapter to a function just changes the
copy of the fields in the particular function and then when returning to
the caller those changes are discarded.  While not yet biting us in the
storage clean-up case, it did cause an issue for the fchost storage pool
startup case, createVport.  The issue was at startup, if no parent is found
in the XML, the code will search for the 'best available' parent and then
store that in the in memory copy of the adapter.  Of course, in this case
it was a copy, so when returning to the virStorageBackendSCSIStartPool that
change was discarded (or lost) from the pool->def->source.adapter which
meant at shutdown (deleteVport), the code assumed no adapter was passed
and skipped the deletion, leaving the vHBA created by libvirt still defined
requiring an additional stop of a nodedev-destroy to remove.

Adjusted the createVport to take virStoragePoolDefPtr instead of the
adapter copy. Then use the virStoragePoolSourceAdapterPtr when processing.
A future patch will need the 'def' anyway, so this just sets up for that.
src/conf/storage_conf.c
src/conf/storage_conf.h
src/storage/storage_backend_scsi.c