Move all mount classes into a subdirectory
The disk API will be growing some new classes in future commits. To avoid ambiguity in module names, move all the mount classes into a subdirectory nova/virt/disk/mount/ blueprint: virt-disk-api-refactoring Change-Id: I03898b4060bd0c488713c9d9f19caebdcd39113c Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
16266a4afb
commit
e85156e20b
|
@ -39,9 +39,9 @@ from nova.openstack.common import cfg
|
||||||
from nova.openstack.common import jsonutils
|
from nova.openstack.common import jsonutils
|
||||||
from nova.openstack.common import log as logging
|
from nova.openstack.common import log as logging
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt.disk import guestfs
|
from nova.virt.disk.mount import guestfs
|
||||||
from nova.virt.disk import loop
|
from nova.virt.disk.mount import loop
|
||||||
from nova.virt.disk import nbd
|
from nova.virt.disk.mount import nbd
|
||||||
from nova.virt import images
|
from nova.virt import images
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class _DiskImage(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _handler_class(mode=None, device=None):
|
def _handler_class(mode=None, device=None):
|
||||||
"""Look up the appropriate class to use based on MODE or DEVICE."""
|
"""Look up the appropriate class to use based on MODE or DEVICE."""
|
||||||
for cls in (loop.Mount, nbd.Mount, guestfs.Mount):
|
for cls in (loop.LoopMount, nbd.NbdMount, guestfs.GuestFSMount):
|
||||||
if mode and cls.mode == mode:
|
if mode and cls.mode == mode:
|
||||||
return cls
|
return cls
|
||||||
elif device and cls.device_id_string in device:
|
elif device and cls.device_id_string in device:
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
# Copyright 2012 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
"""
|
||||||
|
Support for mounting disk images on the host filesystem
|
||||||
|
|
||||||
|
"""
|
|
@ -19,10 +19,10 @@ import os
|
||||||
|
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt.disk import mount
|
from nova.virt.disk.mount import api
|
||||||
|
|
||||||
|
|
||||||
class Mount(mount.Mount):
|
class GuestFSMount(api.Mount):
|
||||||
"""libguestfs support for arbitrary images."""
|
"""libguestfs support for arbitrary images."""
|
||||||
mode = 'guestfs'
|
mode = 'guestfs'
|
||||||
device_id_string = 'guest'
|
device_id_string = 'guest'
|
|
@ -16,10 +16,10 @@
|
||||||
"""Support for mounting images with the loop device"""
|
"""Support for mounting images with the loop device"""
|
||||||
|
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt.disk import mount
|
from nova.virt.disk.mount import api
|
||||||
|
|
||||||
|
|
||||||
class Mount(mount.Mount):
|
class LoopMount(api.Mount):
|
||||||
"""loop back support for raw images."""
|
"""loop back support for raw images."""
|
||||||
mode = 'loop'
|
mode = 'loop'
|
||||||
device_id_string = mode
|
device_id_string = mode
|
|
@ -22,7 +22,7 @@ from nova import config
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova.openstack.common import cfg
|
from nova.openstack.common import cfg
|
||||||
from nova import utils
|
from nova import utils
|
||||||
from nova.virt.disk import mount
|
from nova.virt.disk.mount import api
|
||||||
|
|
||||||
|
|
||||||
nbd_opts = [
|
nbd_opts = [
|
||||||
|
@ -38,7 +38,7 @@ CONF = config.CONF
|
||||||
CONF.register_opts(nbd_opts)
|
CONF.register_opts(nbd_opts)
|
||||||
|
|
||||||
|
|
||||||
class Mount(mount.Mount):
|
class NbdMount(api.Mount):
|
||||||
"""qemu-nbd support disk images."""
|
"""qemu-nbd support disk images."""
|
||||||
mode = 'nbd'
|
mode = 'nbd'
|
||||||
device_id_string = mode
|
device_id_string = mode
|
Loading…
Reference in New Issue