[Kimchi-devel] [PATCH v2] Set virt_use_nfs when NFS pool is added.

Aline Manera alinefm at linux.vnet.ibm.com
Fri Apr 11 03:19:21 UTC 2014


The tests are failing with this patch set:

E..........EEEE......E.....EE
======================================================================
ERROR: test_exception (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_exception
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_exception.py", line 25, in <module>
     import kimchi.mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_mockmodel (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_mockmodel
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 27, in <module>
     import kimchi.mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_rest (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_rest
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_rest.py", line 35, in <module>
     import kimchi.mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_model (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_model
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_model.py", line 34, in <module>
     import utils
   File "/home/alinefm/kimchi/tests/utils.py", line 35, in <module>
     import kimchi.server
   File "/home/alinefm/kimchi/src/kimchi/server.py", line 30, in <module>
     from kimchi import mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_server (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_server
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_server.py", line 24, in <module>
     import utils
   File "/home/alinefm/kimchi/tests/utils.py", line 35, in <module>
     import kimchi.server
   File "/home/alinefm/kimchi/src/kimchi/server.py", line 30, in <module>
     from kimchi import mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_authorization (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_authorization
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_authorization.py", line 28, in 
<module>
     import kimchi.mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_networkxml (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_networkxml
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_networkxml.py", line 25, in 
<module>
     import utils
   File "/home/alinefm/kimchi/tests/utils.py", line 35, in <module>
     import kimchi.server
   File "/home/alinefm/kimchi/src/kimchi/server.py", line 30, in <module>
     from kimchi import mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


======================================================================
ERROR: test_plugin (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_plugin
Traceback (most recent call last):
   File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
     module = self._get_module_from_name(name)
   File "/usr/lib/python2.7/unittest/loader.py", line 230, in 
_get_module_from_name
     __import__(name)
   File "/home/alinefm/kimchi/tests/test_plugin.py", line 28, in <module>
     import kimchi.mockmodel
   File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 49, in <module>
     from kimchi.model.storagepools import ISO_POOL_NAME, STORAGE_SOURCES
   File "/home/alinefm/kimchi/src/kimchi/model/storagepools.py", line 133
     kimchi_log.error('Unable to set virt_use_nfs=1. If you use
                                                              ^
SyntaxError: EOL while scanning string literal


----------------------------------------------------------------------
Ran 29 tests in 0.011s

FAILED (errors=8)
make[3]: *** [check-local] Error 1
make[3]: Leaving directory `/home/alinefm/kimchi/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/alinefm/kimchi/tests'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/alinefm/kimchi/tests'
make: *** [check-recursive] Error 1


On 04/10/2014 07:56 PM, Christy Perez wrote:
> selinux has a special boolean to make it easier for disk images
> to be managedi by libvirt. Set this to true when a user
> adds an NFS storage pool.
>
> Most virtualzation documentation recommends that this be set
> to true. For example:
> http://www.ovirt.org/Troubleshooting_NFS_Storage_Issues
> http://fedoraproject.org/wiki/How_to_debug_Virtualization_problems
>
> This will leave it set to true, even if
> the user removes NFS storage pools. It is not a security risk, and
> we should not set it to False in case it had already been set by the
> user for another non-kimchi use.
>
> Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/storagepools.py | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
> index 5af33b7..1ec6e99 100644
> --- a/src/kimchi/model/storagepools.py
> +++ b/src/kimchi/model/storagepools.py
> @@ -126,6 +126,13 @@ class StoragePoolsModel(object):
>               kimchi_log.error("Problem creating Storage Pool: %s", e)
>               raise OperationFailed("KCHPOOL0007E",
>                                     {'name': name, 'err': e.get_error_message()})
> +        if params['type'] == 'netfs':
> +            output, error, returncode = run_command(['setsebool', '-P',
> +                                                    'virt_use_nfs=1'])
> +            if error or returncode:
> +                kimchi_log.error('Unable to set virt_use_nfs=1. If you use
> +                                 SELinux, this may prevent NFS pools from
> +                                 being used.')
>           return name
>
>       def _clean_scan(self, pool_name):




More information about the Kimchi-devel mailing list