Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils_misc: Reorg disk related APIs into utils_disk #2103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions scripts/virt_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)

from virttest import utils_disk
from virttest import disk


class OptionParser(optparse.OptionParser):
Expand Down Expand Up @@ -85,13 +85,13 @@ def parse_cmdline(self):
def main(self):
self.parse_cmdline()
if self.options.floppy:
self.disk = utils_disk.FloppyDisk(self.image,
self.options.qemu_img,
self.options.temp,
self.options.vfd_size)
self.disk = disk.FloppyDisk(self.image,
self.options.qemu_img,
self.options.temp,
self.options.vfd_size)
elif self.options.cdrom:
self.disk = utils_disk.CdromDisk(self.image,
self.options.temp)
self.disk = disk.CdromDisk(self.image,
self.options.temp)

for f in self.files:
self.disk.copy_to(f)
Expand Down
24 changes: 12 additions & 12 deletions selftests/unit/test_nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from virttest.unittest_utils import mock
from virttest import nfs
from virttest import utils_misc
from virttest import disk
from virttest.staging import service


Expand Down Expand Up @@ -58,18 +58,18 @@ def setup_stubs_setup(self, nfs_obj):
os.makedirs.expect_call(nfs_obj.export_dir)
nfs_obj.exportfs.export.expect_call()
os.makedirs.expect_call(nfs_obj.mount_dir)
utils_misc.mount.expect_call(nfs_obj.mount_src, nfs_obj.mount_dir,
"nfs", perm=nfs_obj.mount_options)
disk.mount.expect_call(nfs_obj.mount_src, nfs_obj.mount_dir,
"nfs", nfs_obj.mount_options)

def setup_stubs_is_mounted(self, nfs_obj):
utils_misc.is_mounted.expect_call(nfs_obj.mount_src,
nfs_obj.mount_dir,
"nfs").and_return(True)
disk.is_mount.expect_call(nfs_obj.mount_src,
nfs_obj.mount_dir,
"nfs").and_return(True)

def setup_stubs_cleanup(self, nfs_obj):
utils_misc.umount.expect_call(nfs_obj.mount_src,
nfs_obj.mount_dir,
"nfs")
disk.umount.expect_call(nfs_obj.mount_src,
nfs_obj.mount_dir,
"nfs")
nfs_obj.exportfs.reset_export.expect_call()

def setUp(self):
Expand All @@ -84,9 +84,9 @@ def setUp(self):
self.god.stub_function(process, "system_output")
self.god.stub_function(os.path, "isfile")
self.god.stub_function(os, "makedirs")
self.god.stub_function(utils_misc, "is_mounted")
self.god.stub_function(utils_misc, "mount")
self.god.stub_function(utils_misc, "umount")
self.god.stub_function(disk, "is_mount")
self.god.stub_function(disk, "mount")
self.god.stub_function(disk, "umount")
self.god.stub_function(service.Factory, "create_service")
attr = getattr(nfs, "Exportfs")
setattr(attr, "already_exported", False)
Expand Down
Loading