renamed xxxservice to service
This commit is contained in:
@@ -22,11 +22,11 @@
|
||||
"""
|
||||
|
||||
from nova import twistd
|
||||
from nova.compute import computeservice
|
||||
from nova.compute import service
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
twistd.serve(__file__)
|
||||
|
||||
if __name__ == '__builtin__':
|
||||
application = computeservice.ComputeService.create()
|
||||
application = service.ComputeService.create()
|
||||
|
@@ -22,11 +22,11 @@
|
||||
"""
|
||||
|
||||
from nova import twistd
|
||||
from nova.network import networkservice
|
||||
from nova.network import service
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
twistd.serve(__file__)
|
||||
|
||||
if __name__ == '__builtin__':
|
||||
application = networkservice.NetworkService.create()
|
||||
application = service.NetworkService.create()
|
||||
|
@@ -22,11 +22,11 @@
|
||||
"""
|
||||
|
||||
from nova import twistd
|
||||
from nova.volume import volumeservice
|
||||
from nova.volume import service
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
twistd.serve(__file__)
|
||||
|
||||
if __name__ == '__builtin__':
|
||||
application = volumeservice.VolumeService.create()
|
||||
application = service.VolumeService.create()
|
||||
|
@@ -49,7 +49,7 @@ from nova.compute import disk
|
||||
from nova.compute import model
|
||||
from nova.compute import network
|
||||
from nova.objectstore import image # for image_path flag
|
||||
from nova.volume import volumeservice
|
||||
from nova.volume import service as volume_service
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
@@ -221,7 +221,7 @@ class ComputeService(service.Service):
|
||||
@exception.wrap_exception
|
||||
def attach_volume(self, instance_id = None,
|
||||
volume_id = None, mountpoint = None):
|
||||
volume = volumeservice.get_volume(volume_id)
|
||||
volume = volume_service.get_volume(volume_id)
|
||||
yield self._init_aoe()
|
||||
yield process.simple_execute(
|
||||
"sudo virsh attach-disk %s /dev/etherd/%s %s" %
|
||||
@@ -242,7 +242,7 @@ class ComputeService(service.Service):
|
||||
""" detach a volume from an instance """
|
||||
# despite the documentation, virsh detach-disk just wants the device
|
||||
# name without the leading /dev/
|
||||
volume = volumeservice.get_volume(volume_id)
|
||||
volume = volume_service.get_volume(volume_id)
|
||||
target = volume['mountpoint'].rpartition('/dev/')[2]
|
||||
yield process.simple_execute(
|
||||
"sudo virsh detach-disk %s %s " % (instance_id, target))
|
@@ -37,9 +37,9 @@ from nova.auth import rbac
|
||||
from nova.auth import users
|
||||
from nova.compute import model
|
||||
from nova.compute import network
|
||||
from nova.compute import computeservice
|
||||
from nova.compute import service as compute_service
|
||||
from nova.endpoint import images
|
||||
from nova.volume import volumeservice
|
||||
from nova.volume import service as volume_service
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
@@ -75,7 +75,7 @@ class CloudController(object):
|
||||
def volumes(self):
|
||||
""" returns a list of all volumes """
|
||||
for volume_id in datastore.Redis.instance().smembers("volumes"):
|
||||
volume = volumeservice.get_volume(volume_id)
|
||||
volume = volume_service.get_volume(volume_id)
|
||||
yield volume
|
||||
|
||||
def __str__(self):
|
||||
@@ -102,7 +102,7 @@ class CloudController(object):
|
||||
result = {}
|
||||
for instance in self.instdir.all:
|
||||
if instance['project_id'] == project_id:
|
||||
line = '%s slots=%d' % (instance['private_dns_name'], computeservice.INSTANCE_TYPES[instance['instance_type']]['vcpus'])
|
||||
line = '%s slots=%d' % (instance['private_dns_name'], compute_service.INSTANCE_TYPES[instance['instance_type']]['vcpus'])
|
||||
if instance['key_name'] in result:
|
||||
result[instance['key_name']].append(line)
|
||||
else:
|
||||
@@ -295,7 +295,7 @@ class CloudController(object):
|
||||
|
||||
@rbac.allow('projectmanager', 'sysadmin')
|
||||
def create_volume(self, context, size, **kwargs):
|
||||
# TODO(vish): refactor this to create the volume object here and tell volumeservice to create it
|
||||
# TODO(vish): refactor this to create the volume object here and tell service to create it
|
||||
res = rpc.call(FLAGS.volume_topic, {"method": "create_volume",
|
||||
"args" : {"size": size,
|
||||
"user_id": context.user.id,
|
||||
@@ -330,7 +330,7 @@ class CloudController(object):
|
||||
raise exception.NotFound('Instance %s could not be found' % instance_id)
|
||||
|
||||
def _get_volume(self, context, volume_id):
|
||||
volume = volumeservice.get_volume(volume_id)
|
||||
volume = volume_service.get_volume(volume_id)
|
||||
if context.user.is_admin() or volume['project_id'] == context.project.id:
|
||||
return volume
|
||||
raise exception.NotFound('Volume %s could not be found' % volume_id)
|
||||
|
@@ -28,7 +28,7 @@ from nova import flags
|
||||
from nova import rpc
|
||||
from nova import test
|
||||
from nova.auth import users
|
||||
from nova.compute import computeservice
|
||||
from nova.compute import service
|
||||
from nova.endpoint import api
|
||||
from nova.endpoint import cloud
|
||||
|
||||
@@ -54,7 +54,7 @@ class CloudTestCase(test.BaseTestCase):
|
||||
self.injected.append(self.cloud_consumer.attach_to_tornado(self.ioloop))
|
||||
|
||||
# set up a service
|
||||
self.compute = computeservice.ComputeService()
|
||||
self.compute = service.ComputeService()
|
||||
self.compute_consumer = rpc.AdapterConsumer(connection=self.conn,
|
||||
topic=FLAGS.compute_topic,
|
||||
proxy=self.compute)
|
||||
|
@@ -26,7 +26,7 @@ from nova import flags
|
||||
from nova import test
|
||||
from nova import utils
|
||||
from nova.compute import model
|
||||
from nova.compute import computeservice
|
||||
from nova.compute import service
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
@@ -60,7 +60,7 @@ class ComputeConnectionTestCase(test.TrialTestCase):
|
||||
self.flags(fake_libvirt=True,
|
||||
fake_storage=True,
|
||||
fake_users=True)
|
||||
self.compute = computeservice.ComputeService()
|
||||
self.compute = service.ComputeService()
|
||||
|
||||
def create_instance(self):
|
||||
instdir = model.InstanceDirectory()
|
||||
|
@@ -18,11 +18,11 @@
|
||||
|
||||
import logging
|
||||
|
||||
from nova import compute
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import test
|
||||
from nova.compute import computeservice
|
||||
from nova.volume import volumeservice
|
||||
from nova.volume import service as volume_service
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
@@ -32,11 +32,11 @@ class VolumeTestCase(test.TrialTestCase):
|
||||
def setUp(self):
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
super(VolumeTestCase, self).setUp()
|
||||
self.compute = computeservice.ComputeService()
|
||||
self.compute = compute.service.ComputeService()
|
||||
self.volume = None
|
||||
self.flags(fake_libvirt=True,
|
||||
fake_storage=True)
|
||||
self.volume = volumeservice.VolumeService()
|
||||
self.volume = volume_service.VolumeService()
|
||||
|
||||
def test_run_create_volume(self):
|
||||
vol_size = '0'
|
||||
@@ -45,11 +45,11 @@ class VolumeTestCase(test.TrialTestCase):
|
||||
volume_id = self.volume.create_volume(vol_size, user_id, project_id)
|
||||
# TODO(termie): get_volume returns differently than create_volume
|
||||
self.assertEqual(volume_id,
|
||||
volumeservice.get_volume(volume_id)['volume_id'])
|
||||
volume_service.get_volume(volume_id)['volume_id'])
|
||||
|
||||
rv = self.volume.delete_volume(volume_id)
|
||||
self.assertRaises(exception.Error,
|
||||
volumeservice.get_volume,
|
||||
volume_service.get_volume,
|
||||
volume_id)
|
||||
|
||||
def test_too_big_volume(self):
|
||||
@@ -70,7 +70,7 @@ class VolumeTestCase(test.TrialTestCase):
|
||||
for i in xrange(total_slots):
|
||||
vid = self.volume.create_volume(vol_size, user_id, project_id)
|
||||
vols.append(vid)
|
||||
self.assertRaises(volumeservice.NoMoreVolumes,
|
||||
self.assertRaises(volume_service.NoMoreVolumes,
|
||||
self.volume.create_volume,
|
||||
vol_size, user_id, project_id)
|
||||
for id in vols:
|
||||
@@ -85,7 +85,7 @@ class VolumeTestCase(test.TrialTestCase):
|
||||
mountpoint = "/dev/sdf"
|
||||
volume_id = self.volume.create_volume(vol_size, user_id, project_id)
|
||||
|
||||
volume_obj = volumeservice.get_volume(volume_id)
|
||||
volume_obj = volume_service.get_volume(volume_id)
|
||||
volume_obj.start_attach(instance_id, mountpoint)
|
||||
rv = yield self.compute.attach_volume(volume_id,
|
||||
instance_id,
|
||||
@@ -100,12 +100,12 @@ class VolumeTestCase(test.TrialTestCase):
|
||||
volume_id)
|
||||
|
||||
rv = yield self.volume.detach_volume(volume_id)
|
||||
volume_obj = volumeservice.get_volume(volume_id)
|
||||
volume_obj = volume_service.get_volume(volume_id)
|
||||
self.assertEqual(volume_obj['status'], "available")
|
||||
|
||||
rv = self.volume.delete_volume(volume_id)
|
||||
self.assertRaises(exception.Error,
|
||||
volumeservice.get_volume,
|
||||
volume_service.get_volume,
|
||||
volume_id)
|
||||
|
||||
def test_multi_node(self):
|
||||
|
Reference in New Issue
Block a user