Trove - Resize Volume Command Does Not Work

Bug #1199506 reported by Auston McReynolds
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Low
Haomai Wang

Bug Description

```
$ trove-cli instance resize_volume --id $DB_ID --size 6
REQUEST:
curl -i http://REDACTED:8779/v1.0/dcde6cbb1c0e4740aaeb4ac4de882b56/instances/67cb4518-ea3b-4a2c-98d7-ae3c0c6e8b28/action -X POST -H "X-Auth-Project-Id: amcreynolds" -H "User-Agent: python-troveclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: REDACTED" -d '{"resize": {"volume": {"size": "6"}}}'
BODY: {
    "resize": {
        "volume": {
            "size": "6"
        }
    }
}

RESPONSE HEADERS: {'date': 'Tue, 02 Jul 2013 21:03:10 GMT', 'status': '202', 'content-length': '0', 'content-type': 'application/json'}
RESPONSE BODY :
```

If we look at the TaskManager log:

```
2013-07-02 21:03:10.319 14573 DEBUG trove.openstack.common.rpc.amqp [-] received {u'_context_request_id': u'req-f9e832f4-06be-4037-9e2b-adaac4617b7e', u'args': {u'instance_id': u'67cb4518-ea3b-4a2c-98d7-ae3c0c6e8b28', u'new_size': u'6'}, u'_context_auth_token': '<SANITIZED>', u'_context_show_deleted': False, u'_context_tenant': u'dcde6cbb1c0e4740aaeb4ac4de882b56', u'_unique_id': u'baaedf7a7d1e4ae4a9c3ed740b5d829d', u'_context_is_admin': False, u'_context_marker': None, u'_context_read_only': False, u'_context_user': u'amcreynolds', u'method': u'resize_volume', u'_context_limit': None} _safe_log /opt/stack/trove/trove/openstack/common/rpc/common.py:291
2013-07-02 21:03:10.320 14573 DEBUG trove.openstack.common.rpc.amqp [-] unpacked context: {'read_only': False, 'show_deleted': False, 'auth_token': '<SANITIZED>', 'limit': None, 'user': u'amcreynolds', 'request_id': u'req-f9e832f4-06be-4037-9e2b-adaac4617b7e', 'marker': None, 'is_admin': False, 'tenant': u'dcde6cbb1c0e4740aaeb4ac4de882b56'} _safe_log /opt/stack/trove/trove/openstack/common/rpc/common.py:291
2013-07-02 21:03:10.333 14573 INFO requests.packages.urllib3.connectionpool [-] Starting new HTTP connection (1): REDACTED
2013-07-02 21:03:10.470 14573 DEBUG requests.packages.urllib3.connectionpool [-] "GET /v2/dcde6cbb1c0e4740aaeb4ac4de882b56//servers/56bd6607-e32f-410e-8bbd-36b5d8c342e1 HTTP/1.1" 200 1491 _make_request /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:296
2013-07-02 21:03:10.475 14573 INFO trove.instance.models [req-f9e832f4-06be-4037-9e2b-adaac4617b7e amcreynolds dcde6cbb1c0e4740aaeb4ac4de882b56] service status=<trove.instance.models.InstanceServiceStatus object at 0x3e95110>
2013-07-02 21:03:10.476 14573 DEBUG trove.taskmanager.models [req-f9e832f4-06be-4037-9e2b-adaac4617b7e amcreynolds dcde6cbb1c0e4740aaeb4ac4de882b56] <greenlet.greenlet object at 0x3c805f0>: Resizing volume for instance: 56bd6607-e32f-410e-8bbd-36b5d8c342e1 from 5 to 6 GB resize_volume /opt/stack/trove/trove/taskmanager/models.py:429
2013-07-02 21:03:10.477 14573 ERROR trove.openstack.common.rpc.amqp [req-f9e832f4-06be-4037-9e2b-adaac4617b7e amcreynolds dcde6cbb1c0e4740aaeb4ac4de882b56] Exception during message handling
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp Traceback (most recent call last):
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp File "/opt/stack/trove/trove/openstack/common/rpc/amqp.py", line 433, in _process_data
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp **args)
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp File "/opt/stack/trove/trove/openstack/common/rpc/dispatcher.py", line 148, in dispatch
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp File "/opt/stack/trove/trove/taskmanager/manager.py", line 48, in resize_volume
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp instance_tasks.resize_volume(new_size)
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp File "/opt/stack/trove/trove/taskmanager/models.py", line 430, in resize_volume
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp self.volume_client.volumes.resize(self.volume_id, new_size)
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp AttributeError: 'VolumeManager' object has no attribute 'resize'
2013-07-02 21:03:10.477 14573 TRACE trove.openstack.common.rpc.amqp
```

> self.volume_client.volumes.resize(self.volume_id, new_size)
AttributeError: 'VolumeManager' object has no attribute 'resize'

https://github.com/openstack/trove/blob/b0834124e8bc917cbb6ed2881234ff4b33826f44/trove/common/cfg.py#L160 means that https://github.com/openstack/trove/blob/8125630f447ae03829a7956ed41eea07865b59d6/trove/common/remote.py#L61 is used, which is the regular ol' nova client.

It's clear from even the source (at https://github.com/openstack/python-novaclient/blob/master/novaclient/v1_1/volumes.py#L41) that there is no resize functionality in the nova client.

The help in the nova and nova-manage CLIs agree:

```
$ nova
    volume-attach Attach a volume to a server.
    volume-create Add a new volume.
    volume-delete Remove a volume.
    volume-detach Detach a volume from a server.
    volume-list List all the volumes.
    volume-show Show details about a volume.
    volume-snapshot-create
                        Add a new snapshot.
    volume-snapshot-delete
                        Remove a snapshot.
    volume-snapshot-list
                        List all the snapshots.
    volume-snapshot-show
                        Show details about a snapshot.
    volume-type-create Create a new volume type.
    volume-type-delete Delete a specific flavor
    volume-type-list Print a list of available 'volume types'.

$ nova-manage volume
/usr/bin/nova-manage category action [<args>]
Available actions for volume category:
 delete
 reattach
```

In looking at how the volume_client is being used in Trove, it becomes more confusing: https://github.com/openstack/trove/blob/eafc62f61b1a3b1294f557f676e33f831af0ce77/trove/taskmanager/models.py#L445

`rescan_server_volume` has pretty much zero results on Google, except for an article indicating that this is used for the "Fake"/mock tests in Trove. This leads me to believe that the resize_volume operation is only used for testing somehow? The only reference is indeed in a test: https://github.com/openstack/trove/blob/7ab80b554dde5f1f1e61b6a8c45492c5ac27ed6b/trove/tests/fakes/nova.py#L758

Another interesting thing I noticed was a resize_fs method for the Guest, with a comment asking if it's used: https://github.com/openstack/trove/blob/7ab80b554dde5f1f1e61b6a8c45492c5ac27ed6b/trove/guestagent/volume.py#L103 . A GitHub search suggests that it is not, except again, in a test: /tests/unittests/guestagent/test_volume.py

Update: This looks to be a duplicate of https://bugs.launchpad.net/trove/+bug/1125522 (missed it on my first search, apologies).

description: updated
description: updated
Revision history for this message
Michael Basnight (hubcap) wrote :

resize is not implemented in cinder. It was something that we privately impl'd in our own codebase, but never got impld in the public cinder codebase. We would have to impl this in cinder and fix ti in the api. Ive talked to cinder about it, and they say that it could be impl'd as a extension at first, and be called something like grow_volume, since shrinking is much harder than growing volumes. Then we'd have to just update the comm layer to call the new method.

Changed in trove:
importance: Undecided → Low
status: New → Triaged
milestone: none → ongoing
Haomai Wang (haomai)
Changed in trove:
assignee: nobody → Haomai Wang (haomai)
Haomai Wang (haomai)
Changed in trove:
milestone: ongoing → havana-3
status: Triaged → Fix Released
Changed in trove:
status: Fix Released → Fix Committed
Thierry Carrez (ttx)
Changed in trove:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in trove:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.