Generic driver
Generic driver, that uses cinder volumes as backend and nova instances to reach multitenancy Implements: bp generic-driver Change-Id: I1d8d4ff15ecbbe2ea0c794d93de950616422279b
This commit is contained in:
parent
ce5eeb7364
commit
feca18a1ca
|
@ -415,10 +415,6 @@ class FailedCmdWithDump(ManilaException):
|
|||
message = _("Operation failed with status=%(status)s. Full dump: %(data)s")
|
||||
|
||||
|
||||
class InstanceNotFound(NotFound):
|
||||
message = _("Instance %(instance_id)s could not be found.")
|
||||
|
||||
|
||||
class ShareBackendAPIException(ManilaException):
|
||||
message = _("Bad or unexpected response from the storage share "
|
||||
"backend API: %(data)s")
|
||||
|
|
|
@ -90,7 +90,11 @@ class API(base.Base):
|
|||
@property
|
||||
def admin_tenant_id(self):
|
||||
if self.client.httpclient.auth_token is None:
|
||||
self.client.httpclient.authenticate()
|
||||
try:
|
||||
self.client.httpclient.authenticate()
|
||||
except neutron_client_exc.NeutronClientException as e:
|
||||
raise exception.NetworkException(code=e.status_code,
|
||||
message=e.message)
|
||||
return self.client.httpclient.auth_tenant_id
|
||||
|
||||
def get_all_tenant_networks(self, tenant_id):
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,96 @@
|
|||
# Copyright 2013 OpenStack Foundation
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from manila.openstack.common import log as logging
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FakeServer(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_id')
|
||||
self.status = kwargs.pop('status', 'ACTIVE')
|
||||
self.networks = kwargs.pop('networks', {})
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
def __setitem__(self, attr, value):
|
||||
setattr(self, attr, value)
|
||||
|
||||
def get(self, attr, default):
|
||||
return getattr(self, attr, default)
|
||||
|
||||
def update(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class FakeKeypair(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_keypair_id')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
class FakeImage(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_image_id')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
class API(object):
|
||||
"""Fake Compute API"""
|
||||
def instance_volume_attach(self, ctx, server_id, volume_id, mount_path):
|
||||
pass
|
||||
|
||||
def instance_volume_detach(self, ctx, server_id, volume_id):
|
||||
pass
|
||||
|
||||
def instance_volumes_list(self, ctx, server_id):
|
||||
pass
|
||||
|
||||
def server_list(self, ctx, search_opts, all_tenants):
|
||||
pass
|
||||
|
||||
def server_create(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def server_delete(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def server_get(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def keypair_list(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def keypair_import(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def keypair_delete(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def image_list(self, *args, **kwargs):
|
||||
pass
|
|
@ -26,8 +26,60 @@ CONF = cfg.CONF
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FakeNetwork(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_net_id')
|
||||
self.name = kwargs.pop('name', 'net_name')
|
||||
self.subnets = kwargs.pop('subnets', [])
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class FakeSubnet(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_subnet_id')
|
||||
self.network_id = kwargs.pop('network_id', 'fake_net_id')
|
||||
self.cidr = kwargs.pop('cidr', 'fake_cidr')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class FakePort(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_subnet_id')
|
||||
self.network_id = kwargs.pop('network_id', 'fake_net_id')
|
||||
self.fixed_ips = kwargs.pop('fixed_ips', [])
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class FakeRouter(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_router_id')
|
||||
self.name = kwargs.pop('name', 'fake_router_name')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
def __setitem__(self, attr, value):
|
||||
setattr(self, attr, value)
|
||||
|
||||
|
||||
class API(object):
|
||||
"""Fake Network API"""
|
||||
admin_tenant_id = 'fake admin tenant id'
|
||||
|
||||
network = {
|
||||
"status": "ACTIVE",
|
||||
"subnets": ["fake_subnet_id"],
|
||||
|
@ -103,6 +155,24 @@ class API(object):
|
|||
port['id'] = port_id
|
||||
return port
|
||||
|
||||
def delete_port(self, port_id):
|
||||
pass
|
||||
|
||||
def get_subnet(self, subnet_id):
|
||||
pass
|
||||
|
||||
def subnet_create(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def router_add_interface(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def show_router(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def update_port_fixed_ips(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_all_networks(self):
|
||||
"""Get all networks for client."""
|
||||
net1 = self.network.copy()
|
||||
|
@ -116,3 +186,9 @@ class API(object):
|
|||
network = self.network.copy()
|
||||
network['id'] = network_uuid
|
||||
return network
|
||||
|
||||
def network_create(self, tenant_id, name):
|
||||
network = self.network.copy()
|
||||
network['tenant_id'] = tenant_id
|
||||
network['name'] = name
|
||||
return network
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
# Copyright 2013 OpenStack Foundation
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from manila.openstack.common import log as logging
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FakeVolume(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_vol_id')
|
||||
self.status = kwargs.pop('status', 'available')
|
||||
self.device = kwargs.pop('device', '')
|
||||
self.display_name = kwargs.pop('display_name', 'fake_vol_name')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class FakeVolumeSnapshot(object):
|
||||
def __init__(self, **kwargs):
|
||||
self.id = kwargs.pop('id', 'fake_volsnap_id')
|
||||
self.status = kwargs.pop('status', 'available')
|
||||
self.display_name = kwargs.pop('display_name', 'fake_volsnap_name')
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
def __getitem__(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class API(object):
|
||||
"""Fake Volume API"""
|
||||
def get(self, volume_id):
|
||||
pass
|
||||
|
||||
def create_snapshot_force(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_snapshot(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def delete_snapshot(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def create(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_all(self, search_opts):
|
||||
pass
|
||||
|
||||
def delete(self, volume_id):
|
||||
pass
|
||||
|
||||
def get_all_snapshots(self, search_opts):
|
||||
pass
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue