add project ids to volumes
This commit is contained in:
@@ -279,7 +279,8 @@ class CloudController(object):
|
||||
# TODO(vish): refactor this to create the volume object here and tell storage to create it
|
||||
res = rpc.call(FLAGS.storage_topic, {"method": "create_volume",
|
||||
"args" : {"size": size,
|
||||
"user_id": context.user.id}})
|
||||
"user_id": context.user.id,
|
||||
"project_id": context.project.id}})
|
||||
def _format_result(result):
|
||||
volume = self._get_volume(context, result['result'])
|
||||
return {'volumeSet': [self.format_volume(context, volume)]}
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import StringIO
|
||||
import time
|
||||
import unittest
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from nova import vendor
|
||||
import mox
|
||||
from tornado import ioloop
|
||||
from twisted.internet import defer
|
||||
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@@ -50,7 +41,8 @@ class StorageTestCase(test.TrialTestCase):
|
||||
def test_run_create_volume(self):
|
||||
vol_size = '0'
|
||||
user_id = 'fake'
|
||||
volume_id = self.mystorage.create_volume(vol_size, user_id)
|
||||
project_id = 'fake'
|
||||
volume_id = self.mystorage.create_volume(vol_size, user_id, project_id)
|
||||
# TODO(termie): get_volume returns differently than create_volume
|
||||
self.assertEqual(volume_id,
|
||||
storage.get_volume(volume_id)['volume_id'])
|
||||
@@ -63,17 +55,19 @@ class StorageTestCase(test.TrialTestCase):
|
||||
def test_too_big_volume(self):
|
||||
vol_size = '1001'
|
||||
user_id = 'fake'
|
||||
project_id = 'fake'
|
||||
self.assertRaises(TypeError,
|
||||
self.mystorage.create_volume,
|
||||
vol_size, user_id)
|
||||
vol_size, user_id, project_id)
|
||||
|
||||
def test_run_attach_detach_volume(self):
|
||||
# Create one volume and one node to test with
|
||||
instance_id = "storage-test"
|
||||
vol_size = "5"
|
||||
user_id = "fake"
|
||||
project_id = 'fake'
|
||||
mountpoint = "/dev/sdf"
|
||||
volume_id = self.mystorage.create_volume(vol_size, user_id)
|
||||
volume_id = self.mystorage.create_volume(vol_size, user_id, project_id)
|
||||
|
||||
volume_obj = storage.get_volume(volume_id)
|
||||
volume_obj.start_attach(instance_id, mountpoint)
|
||||
|
||||
Reference in New Issue
Block a user