Commit Graph

14 Commits

Author SHA1 Message Date
Eric Harney ca5c2ce4e8 Continue renaming volume_utils (core)
Now that volume_utils has been renamed, import it
and use it consistently everywhere.

Change-Id: I6a74f664ff890ff3f24f715a1e93df7e0384aa6b
2019-09-09 20:48:26 -04:00
Eric Harney de789648e5 Rename volume/utils.py to volume/volume_utils.py
Much of our code renames this at import already --
just name it "volume_utils" for consistency, and
to make code that imports other modules named "utils"
less confusing.

Change-Id: I3cdf445ac9ab89b3b4c221ed2723835e09d48a53
2019-09-09 15:00:07 -04:00
Erlon R. Cruz f33b234aa0 Make scheduler check online_extend_support capability
Since Pike release, Cinder supports volume online extending, and by
default it assumes that every backend supports this feature. This
assumption causes a bug on those backends that don't support it. On
such backends, an online extending attempt leaves the volume in
error_extending state.

This patch allows a backend to report to the scheduler if it does not
support online extending. This way, an online extending attempt will
fail, without leaving the volume in error_extending state.

Closes-bug: #1765182
Change-Id: I2c31b5c171574074a8fc7ba86f94f983fc9658f7
Co-Authored-By: Lucio Seki <luciomitsuru.seki@fit-tecnologia.org.br>
2018-06-26 14:42:34 -03:00
Erlon R. Cruz f98c9da944 Overprovisioning Improvements
This is part of the effort to improve Cinder's Thin provisioning
support. As some operators have been facing problems to determinte
what is the best value for the max_over_subscription_ratio, we
add in this patch a mechanism to automatically calculate this value.

The formula used for calculation is:
max_over_subscription_ratio = 20 if provisioned_capacity_gb == 0 else:
max_over_subscription_ratio = 1 + (provisioned_capacity_gb/(
                             total_capacity_gb - free_capacity_gb + 1))

Using this formula, the scheduler will allow the creation of a much
bigger number of volumes at the begginning of the pool's life, and
start to restrict the creation as the free space approaces to 0 or
the reserved limit.

Drivers now can set max_over_subscription_ratio = 'auto' and take
benefit of the change. Drivers that somehow use the
max_over_subscription_ratio inside the driver to do any kind of
calculations are incompatible with this new feature and should
get fixed in order to be able to use the feature.

Implements: bp provisioning-improvements
Change-Id: If30bb6276f58532c0f78ac268544a8804008770e
2018-01-25 07:37:17 -02:00
Goutham Pacha Ravi 39816f9ff3 Fix create from snapshot and source volume
A regression was introduced in
I970c10f9b50092b659fa2d88bd6a02f6c69899f2
on backends supporting storage pools. By extracting the
'host@backend' out of the host attr from a parent volume,
the scheduler may attempt to put volumes into other pools
belonging to the backend.

Many backends cannot clone across storage pools,
or create storage volumes from snapshots from other
storage pools.

Change-Id: Ic4c8f29bef2c82550d6d6f03f8fa1dc80696f56e
Closes-Bug: #1732557
2017-12-07 22:23:55 -05:00
John Griffith 950e693697 Make service object UUID not nullable
Fix the UUID entry for the newly added service attribute and
udpate the unit tests appropriately.

This makes the UUID entry in the service object not nullable
and fixes up the unit tests to work properly.  Also introduces
a unit test specifically for the online migration api in the db.

Closes-Bug: #1727091

Change-Id: I17d3a873cfc8f056c2d31f6c8710489785998d3c
2017-10-26 10:17:50 -06:00
wangxiyuan f3d66c3254 Fix NoneType has no attribute get error
If volume_type is None and then create volumes with allow-multiattach,
Cinder-schduler will raise error:
AttributeError: 'NoneType' object has no attribute 'get'

Ied42d13b642617dd239ea92c019354b90657821a didn't fix it completely.
The error still exists. Here is the reproduce command:
"cinder create 1 ----allow-multiattach"

Because that the volume_type is always in the "request_spec", if
users doesn't pass it, its value is None.

Change-Id: I1140234dd69a644dcbf6fc3a01f382ee101624b2
Related-bug: #1683431
2017-06-07 17:18:18 +08:00
xing-yang c979bdac87 Remove unused CG code
There are CG related code in api, scheduler, and manager that are
no longer invoked in Pike. This is because we will force users to
migrate all existing CGs and CGsnapshots to the new generic volume
groups tables when they upgrade to Pike. CG CLI and API are still
supported in Pike. They will be re-directed to create/modify
entries in generic volume groups tables instead.

Database and versioned object related code are still kept for now
because there are still drivers referencing them.

Change-Id: Ieba87c6725f07564fd5a69674602eb3ca6200db3
2017-03-19 00:49:10 -04:00
Gorka Eguileor 41bbdbc8a9 Cosmetic changes to scheduler
Now that we have clustered services it is no longer correct to refer to
"hosts" in the scheduler, as we may be referring to a cluster sometimes.

This patch changes those cases where "host" is no longer appropriate
(ie: `find_retype_host`) and uses the more generic name "backend" (ie:
`find_retype_backend`).

Specs: https://review.openstack.org/327283
Implements: blueprint cinder-volume-active-active-support
Change-Id: I6edbdaf5f38841c7e801b5f3fc0cab3e8ef44a20
2016-12-14 17:48:53 +01:00
Gorka Eguileor 9acf079b8c Support A/A on Scheduler operations
This patch allows scheduler to work with clustered hosts to support A/A
operations.

Reporting capabilities of clustered hosts will be grouped by the
cluster_name instead of the host, and non clustered hosts will still be
stored by host.

To avoid replacing a newer capability report with an older version we
timestamp capabilities on the volumes (it's backward compatible) and
only replace currently stored values in scheduler when they are newer.

Following actions now support A/A operation:

- manage_existing
- manage_existing_snapshot
- get_pools
- create_volume
- retype
- migrate_volume_to_host
- create_consistencygroup
- create_group
- update_service_capabilities
- extend_volume

And Affinity and Driver filters have been updated.

The new functionality to notify service capabilities has not been
changed to Active/Active and will be done in another patch.

APIImpact: Added microversion 3.16
Specs: https://review.openstack.org/327283
Implements: blueprint cinder-volume-active-active-support
Change-Id: I611e75500f3d5281188c5aae287c62e5810e6b72
2016-12-14 17:48:28 +01:00
Ivan Kolodyazhny 48ca2ca67c Fix InstanceLocalityFilter scheduler filter
Commit I51254e20151fe1d6771897e64a8d0bdf2d674d03 introduces new error:
We use novaclient extensions instead of Nova API extensions. In such
case, InstanceLocalityFilter won't find Nova ExtendedServerAttributes
extension and will raise CinderException.

This patch fixes novaclient usage in a right way.

Change-Id: I36fb67d597b7848dd4796ea672bc573a570677e8
Closes-Bug: #1517431
2015-11-18 15:42:13 +02:00
Ivan Kolodyazhny c131767a19 Fix usage of novaclient
We should use 'client interface' for initialization of novaclient
instead of direct import of some specific client.

Change-Id: I51254e20151fe1d6771897e64a8d0bdf2d674d03
Closes-Bug: #1493576
2015-09-14 20:03:35 +03:00
Victor Stinner 55eca11e07 Replace dict.iteritems() with dict.items()
This change adds Python 3 compatibility to the modified code.

Replace also six.iteritems(obj) with obj.items().

The iteritems() method of Python 2 dictionaries was renamed to items()
on Python 3. As discussed on the openstack-dev mailing list, iteritems()
must be replaced with items(), six.iteritems() should not be used. In
OpenStack, the overhead of creating a temporary list with dict.items()
on Python 2 is negligible.

Blueprint cinder-python3
Change-Id: Ic3d8fd6b71d2c9f21929b0d6bf68c8f84a5e2567
2015-06-12 15:18:57 +02:00
John Griffith cbcbc90cf6 Move unit tests into dedicated directory
This patch moves all of the existing cinder/tests into
cinder unit tests.  This is being done to make way for
the addition of cinder/tests/functional.

Yes, this is going to cause significant pain with
any changes that haven't merged behind it in terms
of rebase, but there's no real alternative.  We have
to rip the band-aid off at some point, and early in L
seems like a great time to do it.

Change-Id: I63b0f89474b3c139bdb89589abd85319d2aa61ec
2015-04-21 18:40:40 -06:00