Added build_local_host_path

This commit is contained in:
Anton Beloglazov 2012-10-23 17:32:51 +11:00
parent 16e26b6580
commit e0ce26445e
2 changed files with 20 additions and 1 deletions

View File

@ -82,6 +82,19 @@ def build_local_vm_path(local_data_directory):
return os.path.join(local_data_directory, 'vms')
@contract
def build_local_host_path(local_data_directory):
""" Build the path to the local host data file.
:param local_data_directory: The base local data path.
:type local_data_directory: str
:return: The path to the local host data file.
:rtype: str
"""
return os.path.join(local_data_directory, 'host')
@contract
def physical_cpu_count(vir_connection):
""" Get the number of physical CPUs using libvirt.

View File

@ -42,12 +42,18 @@ class Common(TestCase):
0,
iterations) == state
@qc
@qc(10)
def build_local_vm_path(
x=str_(of='abc123_-/')
):
assert common.build_local_vm_path(x) == os.path.join(x, 'vms')
@qc(10)
def build_local_host_path(
x=str_(of='abc123_-/')
):
assert common.build_local_host_path(x) == os.path.join(x, 'host')
@qc(10)
def physical_cpu_count(x=int_(min=0, max=8)):
with MockTransaction: