Skip to content

Commit

Permalink
utils_misc: Reorg disk related APIs into utils_disk
Browse files Browse the repository at this point in the history
Reorganise disk related method to utils_disk and break circular
imports caused with respect to disk related APIs in utils_misc and
gluster to utils_disk for better work flow. Rename utils_disk.py to
disk.py

Signed-off-by: Srikanth Aithal <[email protected]>
Signed-off-by: Balamuruhan S <[email protected]>
  • Loading branch information
balamuruhans committed Aug 29, 2019
1 parent 6109022 commit a1d965b
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 466 deletions.
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

0 comments on commit a1d965b

Please sign in to comment.