* Corrected docstrings as per pep0257 recommentations. * Stream-lined the comments. * Updated code with locals() where ever applicable. * VIM : It stands for VMware Virtual Infrastructure Methodology. We have used the terminology from VMware. we have added a question in FAQ inside vmware_readme.rst in doc/source * New fake db: vmwareapi fake module uses a different set of fields and hence the structures required are different. Ex: bridge : 'xenbr0' does not hold good for VMware environment and bridge : 'vmnic0' is used instead. Also return values varies, hence went for implementing separate fake db. * Now using eventlet library instead and removed io_utils.py from branch. * Now using glance.client.Client instead of homegrown code to talk to Glance server to handle images. * Corrected all mis-spelled function names and corresponding calls. Yeah, an auto-complete side-effect!
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 | 
						|
 | 
						|
# Copyright (c) 2011 Citrix Systems, Inc.
 | 
						|
# Copyright 2011 OpenStack LLC.
 | 
						|
#
 | 
						|
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 | 
						|
#    not use this file except in compliance with the License. You may obtain
 | 
						|
#    a copy of the License at
 | 
						|
#
 | 
						|
#         http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
#
 | 
						|
#    Unless required by applicable law or agreed to in writing, software
 | 
						|
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
						|
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
						|
#    License for the specific language governing permissions and limitations
 | 
						|
#    under the License.
 | 
						|
 | 
						|
"""
 | 
						|
Stubouts for the test suite
 | 
						|
"""
 | 
						|
 | 
						|
from nova.virt import vmwareapi_conn
 | 
						|
from nova.virt.vmwareapi import fake
 | 
						|
from nova.virt.vmwareapi import vmware_images
 | 
						|
 | 
						|
 | 
						|
def fake_get_vim_object(arg):
 | 
						|
    """Stubs out the VMWareAPISession's get_vim_object method."""
 | 
						|
    return fake.FakeVim()
 | 
						|
 | 
						|
 | 
						|
def fake_is_vim_object(arg, module):
 | 
						|
    """Stubs out the VMWareAPISession's is_vim_object method."""
 | 
						|
    return isinstance(module, fake.FakeVim)
 | 
						|
 | 
						|
 | 
						|
def set_stubs(stubs):
 | 
						|
    """Set the stubs."""
 | 
						|
    stubs.Set(vmware_images, 'fetch_image', fake.fake_fetch_image)
 | 
						|
    stubs.Set(vmware_images, 'get_vmdk_size_and_properties',
 | 
						|
              fake.fake_get_vmdk_size_and_properties)
 | 
						|
    stubs.Set(vmware_images, 'upload_image', fake.fake_upload_image)
 | 
						|
    stubs.Set(vmwareapi_conn.VMWareAPISession, "_get_vim_object",
 | 
						|
              fake_get_vim_object)
 | 
						|
    stubs.Set(vmwareapi_conn.VMWareAPISession, "_is_vim_object",
 | 
						|
              fake_is_vim_object)
 |