Skip to content

[SPARC Solaris] psutil.disk_partitions() fail with zones that have nfs mounts #1674

Closed
@n27051538

Description

Platform SPARC

  • { OS version } Solaris 11.4.4.4.0
  • { psutil version } 5.6.7

Bug description
When running in global zone, psutil.disk_partitions() fail with local solaris zones that have internal NFS mounts.
Have no way to ignore them like df util.

python code to reproduce the problem

root@globalzone:~# python2.7
Python 2.7.14 (default, Aug  9 2018, 16:46:26) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_partitions()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/psutil/__init__.py", line 2132, in disk_partitions
    return _psplatform.disk_partitions(all)
  File "/usr/lib/python2.7/site-packages/psutil/_pssunos.py", line 232, in disk_partitions
    if not disk_usage(mountpoint).total:
  File "/usr/lib/python2.7/site-packages/psutil/_psposix.py", line 131, in disk_usage
    st = os.statvfs(path)
OSError: [Errno 1] Not owner: '/zones/mylocalzone/root/mnt'
>>> 

investigating problem directory looking at problem dir and via logging in localzone

root@globalzone:~# ls /zones/mylocalzone/root/mnt
/zones/mylocalzone/root/mnt: Not owner

root@globalzone:~# df | grep /zones/mylocalzone/root/mnt

root@globalzone:~# grep /zones/mylocalzone/root/mnt /etc/mnttab 
nfs-server:/share   /zones/mylocalzone/root/mnt       nfs     rw,nodevices,xattr,zone=mylocalzone,sharezone=7,dev=ffbc0001        1554476045

root@globalzone:~# zlogin mylocalzone                          
[Connected to zone 'mylocalzone' pts/7]
Last login: Tue Jan 28 02:33:44 2020 on pts/7
root@mylocalzone:~# ls /mnt
file1  file2  file3 
root@mylocalzone:~# logout
[Connection to zone 'mylocalzone' pts/7 closed]

Test results

root@globalzone:~# python -c psutil.tests
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'psutil' is not defined

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions