[libvirt] [PATCH v2 0/6] Converge Storage Pool vHBA logic with Node Device
by John Ferlan
v1: http://www.redhat.com/archives/libvir-list/2017-February/msg00963.html
Changes since v1:
NB: Former Patch 1 - was pushed
Patch 1 - Was the old patch 2... Similar for rest of series...
Altered to match the adjusted testNodeDeviceMockCreateVport
from commit 2a862092
Patch 2 - reworked the code to not place the new module in src/util, but
rather in src/conf as storage_adapter_conf.{c,h}. The concepts
didn't change - only the name/location. Removed the changes for
util/virvirscsi.c since virSCSIHostGetNameByParentaddr wouldn't
be allowed to use virStorageAdapterSCSIHostPtr since it's a conf
definition.
Patch 3 - Unchanged, ACK'd in v1
Patch 4 - Unchanged, ACK'd in v1
Patch 5 - Unchanged...
Even though there is concern over usage of API's in this manner
(e.g. calling virNodeDeviceLookupSCSIHostByWWN as well as
virNodeDeviceCreateXML) - the "purpose" of the exercise is
a means to have the StoragePool code use the same algorithms
as the node device code instead of what could be a potentially
long slow journey through the sysfs file system. The key piece
being the replication of the API's that find the parent in the
node device object list. I suppose it would be possible to add
even more API's to get that answer, but I'm not sure it'd be
worthwhile at this point. As for the concern about deadlock -
I understand it, but since the whole purpose of the API is
to essentially utilize the nodedev create algorithm there'd
be no reason for nodedev to call it.
If it doesn't get ACK'd - that's OK - I can hold onto it and
reconsider some other means at some point in time in the future
(probably distant future too).
Patch 6 - Unchanged
The former patch 8 is dropped for now - needs some more "discussion" as
to viability and/or need.
John Ferlan (6):
tests: Add createVHBAByStoragePool-by-parent to fchosttest
conf: Convert virStoragePoolSourceAdapter to virStorageAdapter
util: Rename virFileWaitForDevices
conf: Move/rename createVport and deleteVport
util: Alter virNodeDevice{Create|Delete}Vport to use nodedev APIs
tests: Add more storage pool vHBA tests
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/node_device_conf.c | 332 +++++++++++++++++++++++++++++++++
src/conf/node_device_conf.h | 9 +
src/conf/storage_adapter_conf.c | 291 +++++++++++++++++++++++++++++
src/conf/storage_adapter_conf.h | 89 +++++++++
src/conf/storage_conf.c | 333 ++++++++--------------------------
src/conf/storage_conf.h | 35 +---
src/libvirt_private.syms | 20 +-
src/node_device/node_device_driver.c | 2 +-
src/phyp/phyp_driver.c | 3 +-
src/storage/storage_backend_disk.c | 6 +-
src/storage/storage_backend_iscsi.c | 2 +-
src/storage/storage_backend_logical.c | 4 +-
src/storage/storage_backend_mpath.c | 2 +-
src/storage/storage_backend_scsi.c | 267 +++++----------------------
src/storage/storage_util.c | 2 +-
src/test/test_driver.c | 99 +++++++++-
src/util/virfile.h | 2 -
src/util/virutil.c | 4 +-
src/util/virutil.h | 2 +
tests/fchosttest.c | 111 ++++++++++++
22 files changed, 1087 insertions(+), 530 deletions(-)
create mode 100644 src/conf/storage_adapter_conf.c
create mode 100644 src/conf/storage_adapter_conf.h
--
2.9.3
7 years, 8 months
[libvirt] [PATCH 0/3] libxl: implement virDomainObjCheckIsActive
by Sagar Ghuge
Add function which raises error if domain is
not active. This is BiteSizedTask.
http://wiki.libvirt.org/page/BiteSizedTasks#Add_function_that_raises_erro...
Sagar Ghuge (3):
libxl: Implement virDomainObjCheckIsActive
change virDomainObjIsActive with virDomainObjCheckIsActive
libxl: Change virDomainObjIsActive to virDomainObjCheckIsActive
...libxl-Implement-virDomainObjCheckIsActive.patch | 55 ++++
...omainObjIsActive-with-virDomainObjCheckIs.patch | 109 ++++++++
...e-virDomainObjIsActive-to-virDomainObjChe.patch | 298 +++++++++++++++++++++
patch1 | 52 ++++
src/conf/domain_conf.c | 15 ++
src/conf/domain_conf.h | 1 +
src/libxl/libxl_driver.c | 102 ++-----
src/test/test_driver.c | 35 +--
8 files changed, 560 insertions(+), 107 deletions(-)
create mode 100644 0001-libxl-Implement-virDomainObjCheckIsActive.patch
create mode 100644 0002-change-virDomainObjIsActive-with-virDomainObjCheckIs.patch
create mode 100644 0003-libxl-Change-virDomainObjIsActive-to-virDomainObjChe.patch
create mode 100644 patch1
--
2.9.3
7 years, 8 months
[libvirt] [PATCH RFC 0/9] Introduce virPoolObj[Table]Ptr data/API's
by John Ferlan
Based of current top of git commit id '5620c6095'... I imagine things
will change while this is on-list, so if there is the desire to create
your own branch that's your starting point!
This is perhaps more than an RFC considering I've added comments
already (at least one reason why the insertions count is high). Still
it's not really complete and ready for prime time, but I figured I'd
put it out there for feedback.
Essentially I've tried to follow the domainobj 'model' by creating
an API to manage the "objects" various drivers have the need to manage.
Currently there are 4 drivers using linked lists of some sort and 4
using hash tables in some manner. This implementation modifies the
linked list abusers to use a common hash table.
The common hash table will have uuid/name accessors. The preference
remains uuid for uniqueness, but there are a couple of tables (node
device, nwfilter) that don't have a uuid and thus name is unique
enough for them.
The genesis for this was recent patches to the storage driver that
were essentially copying many lines of code and just changing the
names to do the same thing. As I looked deeper at that - I found
a mish-mash of object management throughout the drivers, so this
is my attempt to unify that.
The "goal" is to have a common look and feel to the API's so there's
less thought over how a specific implementation does things. Each
trip into the driver and exit can be handled in a common manner
especially with respect to locks/refcnt's.
Since I was splitting things apart - I also split out the object
code/data *_conf.{c,h} into separate vir*obj.{c,h} files. I took
some liberties with adjusting some names, modifying some other things
along the way since the type A personality took over to try and
follow more current coding conventions while I was in the middle
of changing things.
While the ultimate goal is to finish with the domain code - that's
just too busy in order to make adjustments right now. Still at least
that code does use a similar hash table model - so while it will be
painful - it can be done later if/when this is accepted (and perhaps
when we know there's a slow period for posting changes).
John Ferlan (9):
conf: Modify gendispatch.pl to make ACL argument opaque
conf: Introduce virPoolObj and virPoolTableObj and PoolObj API's
nodedev: Convert virNodeDevObj[List] to use virPoolObj[Table]
interface: Convert virInterfaceObj[List] to use virPoolObj[Table]
nwfilter: Convert virNWFilterObj[List] to use virPoolObj[Table]
secret: Convert virSecretObj[List] to use virPoolObj[Table]
volume: Convert virStorageVolObj[List] to use virPoolObj[Table]
storage: Convert virStoragePoolObj[List] to use virPoolObj[Table]
network: Convert virNetworkObj[List] to use virPoolObj[Table]
include/libvirt/virterror.h | 1 +
po/POTFILES.in | 5 +
src/Makefile.am | 18 +-
src/conf/domain_conf.h | 3 +-
src/conf/interface_conf.c | 170 +--
src/conf/interface_conf.h | 47 +-
src/conf/network_conf.c | 1308 +-----------------
src/conf/network_conf.h | 133 +-
src/conf/node_device_conf.c | 497 +------
src/conf/node_device_conf.h | 86 +-
src/conf/nwfilter_conf.c | 381 +-----
src/conf/nwfilter_conf.h | 69 +-
src/conf/secret_conf.c | 3 +-
src/conf/secret_conf.h | 2 +-
src/conf/storage_conf.c | 925 +------------
src/conf/storage_conf.h | 128 +-
src/conf/virinterfaceobj.c | 205 +++
src/conf/virinterfaceobj.h | 46 +
src/conf/virnetworkobj.c | 1166 ++++++++++++++++
src/conf/virnetworkobj.h | 121 ++
src/conf/virnodedeviceobj.c | 570 ++++++++
src/conf/virnodedeviceobj.h | 86 ++
src/conf/virnwfilterobj.c | 373 +++++
src/conf/virnwfilterobj.h | 64 +
src/conf/virpoolobj.c | 1184 ++++++++++++++++
src/conf/virpoolobj.h | 222 +++
src/conf/virsecretobj.c | 782 ++++-------
src/conf/virsecretobj.h | 92 +-
src/conf/virstorageobj.c | 1206 +++++++++++++++++
src/conf/virstorageobj.h | 143 ++
src/interface/interface_backend_netcf.c | 6 +-
src/interface/interface_backend_udev.c | 5 +-
src/libvirt_private.syms | 217 +--
src/network/bridge_driver.c | 1812 +++++++++++++------------
src/network/bridge_driver.h | 11 +-
src/network/bridge_driver_platform.h | 3 +-
src/node_device/node_device_driver.c | 388 +++---
src/node_device/node_device_driver.h | 2 +-
src/node_device/node_device_hal.c | 82 +-
src/node_device/node_device_udev.c | 76 +-
src/nwfilter/nwfilter_driver.c | 225 ++-
src/nwfilter/nwfilter_gentech_driver.c | 111 +-
src/nwfilter/nwfilter_gentech_driver.h | 2 +-
src/nwfilter/nwfilter_tech_driver.h | 2 +-
src/rpc/gendispatch.pl | 5 +-
src/secret/secret_driver.c | 187 +--
src/storage/storage_backend.h | 32 +-
src/storage/storage_backend_disk.c | 309 +++--
src/storage/storage_backend_fs.c | 145 +-
src/storage/storage_backend_gluster.c | 52 +-
src/storage/storage_backend_iscsi.c | 65 +-
src/storage/storage_backend_logical.c | 177 +--
src/storage/storage_backend_mpath.c | 37 +-
src/storage/storage_backend_rbd.c | 115 +-
src/storage/storage_backend_scsi.c | 57 +-
src/storage/storage_backend_sheepdog.c | 89 +-
src/storage/storage_backend_vstorage.c | 47 +-
src/storage/storage_backend_zfs.c | 109 +-
src/storage/storage_driver.c | 1952 +++++++++++++-------------
src/storage/storage_driver.h | 6 +-
src/storage/storage_util.c | 234 ++--
src/storage/storage_util.h | 31 +-
src/test/test_driver.c | 2257 ++++++++++++++-----------------
src/util/virerror.c | 1 +
tests/networkxml2conftest.c | 18 +-
tests/storagevolxml2argvtest.c | 16 +-
66 files changed, 10145 insertions(+), 8774 deletions(-)
create mode 100644 src/conf/virinterfaceobj.c
create mode 100644 src/conf/virinterfaceobj.h
create mode 100644 src/conf/virnetworkobj.c
create mode 100644 src/conf/virnetworkobj.h
create mode 100644 src/conf/virnodedeviceobj.c
create mode 100644 src/conf/virnodedeviceobj.h
create mode 100644 src/conf/virnwfilterobj.c
create mode 100644 src/conf/virnwfilterobj.h
create mode 100644 src/conf/virpoolobj.c
create mode 100644 src/conf/virpoolobj.h
create mode 100644 src/conf/virstorageobj.c
create mode 100644 src/conf/virstorageobj.h
--
2.7.4
7 years, 8 months
[libvirt] [PATCH] testNodeDeviceMockCreateVport: Don't call public APIs
by Michal Privoznik
This function is calling public APIs (virNodeDeviceLookupByName
etc.). That requires the driver lock to be unlocked and locked
again. If we, however, replace the public APIs calls with the
internal calls (that public APIs call anyway), we can drop the
lock/unlock exercise.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/test/test_driver.c | 59 ++++++++++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 26 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 5fef3f10b..8495443db 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5626,17 +5626,16 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
}
-static virNodeDeviceDefPtr
+static virNodeDeviceObjPtr
testNodeDeviceMockCreateVport(virConnectPtr conn,
const char *wwnn,
const char *wwpn)
{
testDriverPtr driver = conn->privateData;
- virNodeDevicePtr devcpy = NULL;
char *xml = NULL;
virNodeDeviceDefPtr def = NULL;
virNodeDevCapsDefPtr caps;
- virNodeDeviceObjPtr obj = NULL;
+ virNodeDeviceObjPtr obj = NULL, objcopy = NULL;
virObjectEventPtr event = NULL;
/* In the real code, we'd call virVHBAManageVport which would take the
@@ -5648,9 +5647,15 @@ testNodeDeviceMockCreateVport(virConnectPtr conn,
* using the scsi_host11 definition, changing the name and the
* scsi_host capability fields before calling virNodeDeviceAssignDef
* to add the def to the node device objects list. */
- if (!(devcpy = virNodeDeviceLookupByName(conn, "scsi_host11")) ||
- !(xml = virNodeDeviceGetXMLDesc(devcpy, 0)) ||
- !(def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL)))
+ if (!(objcopy = virNodeDeviceFindByName(&driver->devs, "scsi_host11")))
+ goto cleanup;
+
+ xml = virNodeDeviceDefFormat(objcopy->def);
+ virNodeDeviceObjUnlock(objcopy);
+ if (!xml)
+ goto cleanup;
+
+ if (!(def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL)))
goto cleanup;
VIR_FREE(def->name);
@@ -5684,23 +5689,17 @@ testNodeDeviceMockCreateVport(virConnectPtr conn,
if (!(obj = virNodeDeviceAssignDef(&driver->devs, def)))
goto cleanup;
- virNodeDeviceObjUnlock(obj);
+ def = NULL;
- event = virNodeDeviceEventLifecycleNew(def->name,
+ event = virNodeDeviceEventLifecycleNew(obj->def->name,
VIR_NODE_DEVICE_EVENT_CREATED,
0);
testObjectEventQueue(driver, event);
cleanup:
VIR_FREE(xml);
- if (!obj) {
- virNodeDeviceDefFree(def);
- def = NULL;
- }
- if (devcpy)
- virNodeDeviceFree(devcpy);
-
- return def;
+ virNodeDeviceDefFree(def);
+ return obj;
}
@@ -5712,8 +5711,8 @@ testNodeDeviceCreateXML(virConnectPtr conn,
testDriverPtr driver = conn->privateData;
virNodeDeviceDefPtr def = NULL;
char *wwnn = NULL, *wwpn = NULL;
- virNodeDevicePtr dev = NULL;
- virNodeDeviceDefPtr newdef = NULL;
+ virNodeDevicePtr dev = NULL, ret = NULL;
+ virNodeDeviceObjPtr obj = NULL;
virCheckFlags(0, NULL);
@@ -5739,20 +5738,28 @@ testNodeDeviceCreateXML(virConnectPtr conn,
* mocking udev. The mock routine will copy an existing vHBA and
* rename a few fields to mock that. So in order to allow that to
* work properly, we need to drop our lock */
- testDriverUnlock(driver);
- if ((newdef = testNodeDeviceMockCreateVport(conn, wwnn, wwpn))) {
- if ((dev = virNodeDeviceLookupByName(conn, newdef->name)))
- ignore_value(VIR_STRDUP(dev->parent, def->parent));
- }
- testDriverLock(driver);
- newdef = NULL;
+ if (!(obj = testNodeDeviceMockCreateVport(conn, wwnn, wwpn)))
+ goto cleanup;
+
+ if (!(dev = virGetNodeDevice(conn, obj->def->name)))
+ goto cleanup;
+
+ VIR_FREE(dev->parent);
+ if (VIR_STRDUP(dev->parent, def->parent) < 0)
+ goto cleanup;
+
+ ret = dev;
+ dev = NULL;
cleanup:
+ if (obj)
+ virNodeDeviceObjUnlock(obj);
testDriverUnlock(driver);
virNodeDeviceDefFree(def);
+ virObjectUnref(dev);
VIR_FREE(wwnn);
VIR_FREE(wwpn);
- return dev;
+ return ret;
}
static int
--
2.11.0
7 years, 8 months