Example #1
0
    def test_do_setup(self):
        mock = mox.Mox()
        mock.StubOutWithMock(driver, 'xenapi_lib')
        mock.StubOutWithMock(driver, 'xenapi_opts')

        configuration = mox.MockObject(conf.Configuration)
        configuration.xenapi_connection_url = 'url'
        configuration.xenapi_connection_username = '******'
        configuration.xenapi_connection_password = '******'
        configuration.append_config_values(mox.IgnoreArg())

        session_factory = object()
        nfsops = object()

        driver.xenapi_lib.SessionFactory('url', 'user',
                                         'pass').AndReturn(session_factory)

        driver.xenapi_lib.NFSBasedVolumeOperations(session_factory).AndReturn(
            nfsops)

        drv = driver.XenAPINFSDriver(configuration=configuration)

        mock.ReplayAll()
        drv.do_setup('context')
        mock.VerifyAll()

        self.assertEquals(nfsops, drv.nfs_ops)
def get_configured_driver(server='ignore_server', path='ignore_path'):
    configuration = mox.MockObject(conf.Configuration)
    configuration.xenapi_nfs_server = server
    configuration.xenapi_nfs_serverpath = path
    configuration.append_config_values(mox.IgnoreArg())
    configuration.volume_dd_blocksize = '1M'
    return driver.XenAPINFSDriver(configuration=configuration)
Example #3
0
 def test_remove_export_does_not_raise_exception(self):
     configuration = conf.Configuration([])
     drv = driver.XenAPINFSDriver(configuration=configuration)
     drv.remove_export('context', 'volume')