Error initializing IBM SVC v7000
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cinderlib |
Fix Released
|
Undecided
|
Gorka Eguileor |
Bug Description
[Bug reported by tanshaolong in old cinderlib repository https:/
I am try cinderlib for IBM svc v7000, but I get below error messages. Would you help how to resolve the issue or give some hint? Thank you very much.
Test enviroment:
Cinderlib version: v0.3.9
Cinder release: Pike
Storage: IBM SVC V7000
Versions: Unknown
Connection type: FC
Test code:
import cinderlib as cl
lvm = cl.Backend(
san_ip='...',
san_login=
san_password=
storwize_
volume_
Error messages:
Traceback (most recent call last):
File "mytest.py", line 11, in
volume_
File "/usr/lib/
self.driver.
File "/usr/lib/
volumes = objects.
File "/usr/lib/
volumes = db.volume_
File "/usr/lib/
return IMPL.volume_
AttributeError: 'DB' object has no attribute 'volume_
Configuration in cinder.conf
[svc1234]
volume_
san_ip=...
san_login=superuser
san_password=
storwize_
volume_
The issue is caused by the SVC driver accessing the database directly, which is not considered good practice in Cinder, though this code could come from a time when this was a common practice in Cinder drivers.
The problem with drivers using the DB directly is that cinderlib doesn't require a DB, it can work storing everything in memory. To facilitate storage of the resources' metadata cinderlib has its own persistence plugin mechanism, and has some ad-hoc "workarounds" for drivers that access the DB directly.
Since you are the first one to try the SVC driver, you were the one that discovered these DB dependencies on the driver which will require adding workarounds in cinderlib for the DB access that driver has.
As a temporary workaround, and to confirm that there are no additional issues with the driver, you can use one of the database persistence plugins: in-memory or using a database (it can be a sqlite database).
To use a different persistence plugin you must pass the `persistence_ config` parameter to the `global_setup` method before creating any `Backend` as described in the [initialization part of the docs](https:/ /docs.openstack .org/cinderlib/ latest/ topics/ initialization. html#persistenc e-config). Database plugins are also explained in the [metadata persistence plugin doc](https:/ /docs.openstack .org/cinderlib/ latest/ topics/ metadata. html#database- plugin).
Example using a SQLite file called 'cl.sqlite` in the current directory:
```
import cinderlib as cl
persistence_config = {'storage': 'db', 'connection': 'sqlite: ///cl.sqlite' } persistence_ config= persistence_ config)
cl.setup(
```
Using a memory SQLite database:
```
import cinderlib as cl
persistence_config = {'storage': 'memory_db'} persistence_ config= persistence_ config)
cl.setup(
```
This is a workaround because we are limited to using DB persistence plugins and we cannot use any other plugins, which means that projects like [Ember-CSI](https:/ /ember- csi.io) will not work using their default persistence model, which in that case is storing data as CRDs in Kubernetes.
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -
The following is only relevant for coding the fix.
Upon looking at the driver I see that we have the following DB dependencies:
- `volume_ get_all_ by_host` when using `objects. VolumeList. get_all_ by_host` VolumeType. get_by_ name_or_ id` type_get_ by_name` when using `objects. VolumeType. get_by_ name_or_ id` Volume. get_by_ id` type_get_ full` directly called by `get_by_id` when using `objects. GroupType. get_by_ id`
- `volume_type_get` when using `objects.
- `volume_
- `volume_get` directly called by `get_by_id` when using `objects.
- `_group_
In cinderlib we don't currently support groups or consistency groups, so we don't need to implement `_group_ type_get_ full` and we have already implemented workaround for methods `volume_get` and `volume_type_get`, so we only need to implement workarounds for `volume_ get_all_ by_host` and `volume_ type_get_ by_name` .