VMware {code} Community
hgjsj
Contributor
Contributor

mount a volume always fail invoked by vmtools

Hi,

I wrote a python script to execute command in guest OS by pyvmomi 6.0. The main function I used is "GuestProcessManager.StartProgramInGuest" to talk with vmtools in guest OS to execute specific command.  this script is working well with almost LVM related command such as lvdisplay, lvcreate ..., but got failed with command "mount" a existing LV to a mount point which  is last step for us automating create new volume in guest OS(RHEL 7.2). I observed in /var/log/message, it always complain the volume already mounted in guest system, but actually I can't see this LV in guest by root. below is specific information about my script and steps

python script:

ps = vim.vm.guest.ProcessManager.ProgramSpec(programPath=vm_command, arguments=vm_param, envVariables=all_envs)

res = pm.StartProgramInGuest(vm, creds, ps)

programPath=/usr/bin/mount

vm_param=/dev/vgdata/jason1 /sutton3  (vgdata is a existing VG,and jason1 is a existing LV, the directory /sutton3 is point I want to mount)

Run script to mount volume in guest(actually vmtools to do execution), /var/log/message complaints like this:

Sep 17 19:46:03 vpc4219 vmtoolsd: mount: /dev/mapper/vgdata-jason1 is already mounted or /sutton3 busy

Sep 17 19:46:03 vpc4219 vmtoolsd: /dev/mapper/vgdata-jason1 is already mounted on /sutton3

Actually run command in guest by root, I didn't see this volume show up

[root@vpc4219 ~]# mount -l | grep sutton3

[root@vpc4219 ~]# df -hT

Filesystem            Type      Size  Used Avail Use% Mounted on

/dev/mapper/rhel-root xfs        63G   14G   50G  22% /

devtmpfs              devtmpfs  7.8G     0  7.8G   0% /dev

tmpfs                 tmpfs     7.8G   88K  7.8G   1% /dev/shm

tmpfs                 tmpfs     7.8G   25M  7.8G   1% /run

tmpfs                 tmpfs     7.8G     0  7.8G   0% /sys/fs/cgroup

/dev/sda1             xfs       497M  211M  287M  43% /boot

tmpfs                 tmpfs     1.6G   16K  1.6G   1% /run/user/42

tmpfs                 tmpfs     1.6G     0  1.6G   0% /run/user/0

Afterward, I manually run mount command in guest by root, rather than script. It is successful easily without any error/warning. the question is why vmtools always failed command and how to fix this issue? Does anybodyhelp on this? thanks in advance.

0 Kudos
1 Reply
hgjsj
Contributor
Contributor

Nobody met this kind of problem before?

0 Kudos