#NEWLINE# @ contract #NEWLINE# def init_state( config ) : #NEWLINE# #INDENT# ' Initialize a dict for storing the state of the local manager.\n\n    :param config: A config dictionary.\n     :type config: dict(str: *)\n\n    :return: A dictionary containing the initial state of the local manager.\n     :rtype: dict\n    ' #NEWLINE# vir_connection = libvirt . openReadOnly ( None ) #NEWLINE# if ( vir_connection is None ) : #NEWLINE# #INDENT# message = 'Failed to open a connection to the hypervisor' #NEWLINE# log . critical ( message ) #NEWLINE# raise OSError ( message ) #NEWLINE# #UNINDENT# physical_cpu_mhz_total = int ( ( common . physical_cpu_mhz_total ( config ) * float ( config [ 'host_cpu_usable_by_vms' ] ) ) ) #NEWLINE# return { #NEWLINE# #INDENT# 'previous_time' : 0.0 , #NEWLINE# 'vir_connection' : vir_connection , #NEWLINE# 'db' : init_db ( config [ 'sql_connection' ] ) , #NEWLINE# 'physical_cpu_mhz_total' : physical_cpu_mhz_total , #NEWLINE# 'hostname' : vir_connection . getHostname ( ) , #NEWLINE# 'hashed_username' : sha1 ( config [ 'os_admin_user' ] ) . hexdigest ( ) , #NEWLINE# 'hashed_password' : sha1 ( config [ 'os_admin_password' ] ) . hexdigest ( ) , #NEWLINE# #UNINDENT# }