Skip to content

Commit 06ec553

Browse files
committed
Update nfs config for image mode
Fix mount issue(RHEL-84861) in image mode. Signed-off-by: lcheng <lcheng@redhat.com>
1 parent a3cfa5a commit 06ec553

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

virttest/nfs.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ class Nfs(object):
158158
def __init__(self, params):
159159
self.mount_dir = params.get("nfs_mount_dir")
160160
self.mount_options = params.get("nfs_mount_options")
161-
self.mount_src = params.get("nfs_mount_src")
162161
self.nfs_setup = False
163162
path.find_command("mount")
164163
self.rm_mount_dir = False
@@ -167,10 +166,16 @@ def __init__(self, params):
167166
distro_details = distro.detect().name
168167
self.session = None
169168
self.setup_nfs_ip = params.get("nfs_server_ip", "127.0.0.1")
170-
self.export_dir = params.get("export_dir") or self.mount_src.split(":")[-1]
171169
self.export_ip = params.get("export_ip", "*")
172-
self.export_options = params.get("export_options", "").strip()
173170
self.run_mount = params.get("run_mount", True)
171+
migration_setup = params.get("migration_setup", "no") == "yes"
172+
if migration_setup and utils_sys.is_image_mode():
173+
self.mount_src = "/"
174+
self.export_options = params.get("export_options", "").strip() + ",fsid=0"
175+
else:
176+
self.mount_src = params.get("nfs_mount_src")
177+
self.export_options = params.get("export_options", "").strip()
178+
self.export_dir = params.get("export_dir") or self.mount_src.split(":")[-1]
174179

175180
if params.get("setup_remote_nfs") == "yes":
176181
self.nfs_setup = True
@@ -307,7 +312,6 @@ def __init__(self, params):
307312
self.mkdir_mount_remote = False
308313
self.mount_dir = params.get("nfs_mount_dir")
309314
self.mount_options = params.get("nfs_mount_options")
310-
self.mount_src = params.get("nfs_mount_src")
311315
self.nfs_server_ip = params.get("nfs_server_ip")
312316
self.ssh_user = params.get("ssh_username", "root")
313317
self.remote_nfs_mount = params.get("remote_nfs_mount", "yes")
@@ -316,6 +320,12 @@ def __init__(self, params):
316320
if not self.ssh_hostkey_check:
317321
self.ssh_cmd += "-o StrictHostKeyChecking=no "
318322

323+
migration_setup = params.get("migration_setup", "no") == "yes"
324+
if migration_setup and utils_sys.is_image_mode():
325+
self.mount_src = "/"
326+
else:
327+
self.mount_src = params.get("nfs_mount_src")
328+
319329
def is_mounted(self):
320330
"""
321331
Check the NFS is mounted or not.

0 commit comments

Comments
 (0)