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:
Daniel P. Berrange 2012-11-13 10:46:37 +00:00
parent 16266a4afb
commit e85156e20b
6 changed files with 29 additions and 10 deletions

View File

@ -39,9 +39,9 @@ from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.disk import guestfs
from nova.virt.disk import loop
from nova.virt.disk import nbd
from nova.virt.disk.mount import guestfs
from nova.virt.disk.mount import loop
from nova.virt.disk.mount import nbd
from nova.virt import images
@ -229,7 +229,7 @@ class _DiskImage(object):
@staticmethod
def _handler_class(mode=None, device=None):
"""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:
return cls
elif device and cls.device_id_string in device:

View File

@ -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
"""

View File

@ -19,10 +19,10 @@ import os
from nova import exception
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."""
mode = 'guestfs'
device_id_string = 'guest'

View File

@ -16,10 +16,10 @@
"""Support for mounting images with the loop device"""
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."""
mode = 'loop'
device_id_string = mode

View File

@ -22,7 +22,7 @@ from nova import config
from nova import flags
from nova.openstack.common import cfg
from nova import utils
from nova.virt.disk import mount
from nova.virt.disk.mount import api
nbd_opts = [
@ -38,7 +38,7 @@ CONF = config.CONF
CONF.register_opts(nbd_opts)
class Mount(mount.Mount):
class NbdMount(api.Mount):
"""qemu-nbd support disk images."""
mode = 'nbd'
device_id_string = mode