Package prlsdkapi :: Class Server
[hide private]
[frames] | no frames]

Class Server

   object --+        
            |        
  prlsdk.Base --+    
                |    
prlsdk.BaseServer --+
                    |
                   Server

The Server class provides access to a Parallels Service. The class is required to use most of the functionality within the Parallels API.

Instance Methods [hide private]
 
begin_edit_common_prefs(self)
This method must be called before making any changes to the Parallels Service common preferences (see DispConfig).
 
begin_edit_user_profile(self)
This method must be called before making any changes to a Parallels Service user profile.
 
create_vm(self)
Create and return a new Vm instance.
 
register_vm(self, vm_path, non_interactive_mode=False)
Register an existing virtual machine with the Parallels Service.
 
get_vm_list(self)
Obtain and return a list of virtual machines from the host.
 
subscribe_to_host_statistics(self)
Subscribe to receive host statistics on a periodic basis.
 
unsubscribe_from_host_statistics(self)
Cancel the host statistics subscription that was started using the subscribe_from_host_statistics method.
 
subscribe_to_perf_stats(self)
Subscribe to receive host perfomance statistics on a periodic basis.
 
unsubscribe_from_perf_stats(self)
Cancel the host perfomance statistics subscription that was started using the subscribe_to_perf_stats method.
 
get_dir_entries(self, path)
Obtain and return the information about the specified file system entry on the host.
 
fs_create_dir(self, path)
Create a new directory on the host.
 
fs_remove_dir(self, path)
Remove the specified directory from the host.
 
fs_can_create_file(self, file_path)
Determine if the current user has sufficient rights to create a file or a directory in the specified location on the host.
 
fs_rename_dir(self, path, new_path)
Rename the specified directory.
 
update_licence(self, key, user, company)
Update the Parallels license.
 
send_answer(self, answer_event)
Send an answer to the Parallels Service in response to a question.
 
search_vms(self, vm_list=None)
Search for unregistered virtual machines at the specified location(s) on the host and return their information.
 
net_service(self, operation='u')
Allows to start, stop, or restart the Parallels network service.
 
add_network_adapter(self, net_adapter)
Add a new virtual network adapter to the specified Parallels Service.
 
update_network_adapter(self, net_adapter)
Update the specified virtual network adapter in the Parallels Service.
 
delete_network_adapter(self, net_adapter)
Delete the specified virtual network adapter from the Parallels Service configuration.
 
attach_to_lost_task(self, task_uuid)
The method allows to obtain a Job object attached to a running task after loosing a connection with the Parallels Service and reconnecting to it again.
 
get_unique_fs_entry_name(self, path, fn_prefix='', fn_suffix='', index_delim='')
Automatically generates a unique name for a new directory.
 
get_user_info(self, user_id)
Return a UsrInfo class containing the information about the specified user.

Inherited from prlsdk.BaseServer: __init__, __new__, login, login_local, logoff, reg_event_handler, shutdown, unreg_event_handler

Inherited from prlsdk.Base: __cmp__, __repr__

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  __prefix__ = 'srv'
  __ht__ = 268435457
Properties [hide private]
  is_local
Indicates whether the current connection is local or remote: True - local connection; False - remote connection.
  licence_info
An instance of LicenceInfo.
  common_prefs
An instance of DispConfig.
  user_profile
An instance of UserConfig.
  statistics
An instance of VmStat.
  fs_disk_list
An instance of FSInfo.
  net_service_status
An instance of NetServiceStatus.
  problem_report
A string containing a problem report in the event of a virtual machine operation failure.
  server_config
An instance of SrvConfig.
  server_info
An instance of SrvInfo.
  users_info
An instance of UsrInfo.
  questions
A tuple of instances of Question.
  perf_stats
Returns an instance of Event containing the host perfomance statistics \.
  vm_list
Instance of Result containing Vm instances

Inherited from prlsdk.BaseServer: __editing_common__, __editing_user__, __login_result__, autostart_editing, connected, last_session_uuid, session_uuid

Inherited from prlsdk.Base: __handle__, handle_type

Inherited from object: __class__

Method Details [hide private]

begin_edit_common_prefs(self)

 

This method must be called before making any changes to the Parallels Service common preferences (see DispConfig). When you are done making the changes, call DispConfig.commit to commit the changes.

begin_edit_user_profile(self)

 

This method must be called before making any changes to a Parallels Service user profile. When you are done making the changes, call UserConfig.commit to commit the changes.

create_vm(self)

 

Create and return a new Vm instance.

Returns:
A new instance of Vm.

register_vm(self, vm_path, non_interactive_mode=False)

 

Register an existing virtual machine with the Parallels Service. This is an asynchronous method.

Parameters:
  • vm_path - Name and path of the virtual machine directory.
  • non_interactive_mode - Set to True to use interactive mode. Set to False to use non-interactive mode.
Returns:
An instance of the Vm class containing information about the virtual machine that was registered.

get_vm_list(self)

 

Obtain and return a list of virtual machines from the host.

Returns:
A prlsdk.Result object containing a list of Vm instances. Individual Vm objects can be extracted using the prlsdk.Result.get_param method.

subscribe_to_host_statistics(self)

 

Subscribe to receive host statistics on a periodic basis. This is an asynchronous method.

Returns:
A Job object.

unsubscribe_from_host_statistics(self)

 

Cancel the host statistics subscription that was started using the subscribe_from_host_statistics method. This is an asynchronous method.

Returns:
A Job object.

subscribe_to_perf_stats(self)

 

Subscribe to receive host perfomance statistics on a periodic basis. This is an asynchronous method.

Returns:
A Job object.

unsubscribe_from_perf_stats(self)

 

Cancel the host perfomance statistics subscription that was started using the subscribe_to_perf_stats method. This is an asynchronous method.

Returns:
A Job object.

get_dir_entries(self, path)

 

Obtain and return the information about the specified file system entry on the host. This is an asynchronous method.

Parameters:
  • path - The full path to the virtual machine directory.
Returns:
An instance of FSInfo containing the directory information.

fs_create_dir(self, path)

 

Create a new directory on the host. This is an asynchronous method.

Parameters:
  • path - The new directory name and path.
Returns:
A Job object.

fs_remove_dir(self, path)

 

Remove the specified directory from the host. This is an asynchronous method.

Parameters:
  • path - Name and path of the directory to remove.
Returns:
A Job object.

fs_can_create_file(self, file_path)

 

Determine if the current user has sufficient rights to create a file or a directory in the specified location on the host. This is an asynchronous method.

Parameters:
  • file_path - Name and path of the file to remove.
Returns:
An instance of the Job class containing the result. Success indicates that the user can create the specified file.

fs_rename_dir(self, path, new_path)

 

Rename the specified directory. This is an asynchronous method.

Parameters:
  • path - Name and path of the directory to rename.
  • new_path - The new directory name and path.
Returns:
A Job object.

update_licence(self, key, user, company)

 

Update the Parallels license. This is an asynchronous method.

Parameters:
  • key - A string containing the license key.
  • user - License user name.
  • company - License company name.
Returns:
A Job object.

send_answer(self, answer_event)

 

Send an answer to the Parallels Service in response to a question. This is an asynchronous method.

Parameters:
  • answer_event - An Event object containing the answer.
Returns:
A Job object.

search_vms(self, vm_list=None)

 

Search for unregistered virtual machines at the specified location(s) on the host and return their information. This is an asynchronous method.

Parameters:
  • vm_list - A list of pathnames to search. Default value searches all available drives and directories.
Returns:
A Result object containing a list of FoundVm objects, each containing information about an individual virtual machine.

net_service(self, operation='u')

 

Allows to start, stop, or restart the Parallels network service. This is an asynchronous method.

Parameters:
  • operation - Specifies the operation to perform. Possible values are:

    'u' - start network service.

    'd' - stop network service.

    'r' - restart network service.

Returns:
A Job object.

add_network_adapter(self, net_adapter)

 

Add a new virtual network adapter to the specified Parallels Service. This is an asynchronous method.

Parameters:
  • net_adapter - A DispNet object containing the new adapter information.
Returns:
A Job object.

update_network_adapter(self, net_adapter)

 

Update the specified virtual network adapter in the Parallels Service. This is an asynchronous method.

Parameters:
  • net_adapter - A DispNet object containing the updated adapter information.
Returns:
A Job object.

delete_network_adapter(self, net_adapter)

 

Delete the specified virtual network adapter from the Parallels Service configuration. This is an asynchronous method.

Parameters:
  • net_adapter - A DispNet object identifying the adapter to delete.
Returns:
A Job object.

attach_to_lost_task(self, task_uuid)

 

The method allows to obtain a Job object attached to a running task after loosing a connection with the Parallels Service and reconnecting to it again. This is an asynchronous method.

Parameters:
  • task_uuid - The global task ID. The list of task IDs can be obtained from the LoginResponse object returned by the login operation.
Returns:
A Job object attached to the specified task.

get_unique_fs_entry_name(self, path, fn_prefix='', fn_suffix='', index_delim='')

 

Automatically generates a unique name for a new directory. This is an asynchronous method.

Parameters:
  • path - A full path to the target location (directory).
  • fn_prefix - Specifies a prefix to use in the directory name. Pass an empty string to use the default prefix 'tmpfile'. The name will be generated by adding a number to the prefix (e.g. tmpfile1, tmpfile2, etc.)
  • fn_suffix - Specifies a suffix to use in the directory name.
  • index_delim - A character(s) that will be inserted between the prefix and the index (e.g. tmpfile_1, tmpfile_2, etc).
Returns:
A Result object containing the name.

get_user_info(self, user_id)

 

Return a UsrInfo class containing the information about the specified user.

Parameters:
  • user_id - The global ID of the user to get the information for.
Returns:
A UsrInfo object containing the user information.

Property Details [hide private]

is_local

Indicates whether the current connection is local or remote: True - local connection; False - remote connection.

Get Method:
unreachable.srv__get_is_local(SDK, Server) - Returns True for local server connection.

licence_info

An instance of LicenceInfo.

Get Method:
unreachable.srv__get_licence_info(SDK, Server) - Get server licence.

common_prefs

An instance of DispConfig.

Get Method:
unreachable.srv__get_common_prefs(...) - prlsdk.__SDK__.srv__get_common_prefs(Server) -> CommonPref

user_profile

An instance of UserConfig.

Get Method:
unreachable.srv__get_user_profile(SDK, Server) - Returns logged in user profile.

statistics

An instance of VmStat.

Get Method:
unreachable.srv__get_statistics(SDK, Server) - Returns server host system resources usage statistics.

fs_disk_list

An instance of FSInfo.

Get Method:
unreachable.srv__get_fs_disk_list(SDK, Server) - Returns disk list.

net_service_status

An instance of NetServiceStatus.

Get Method:
unreachable.srv__get_net_service_status(SDK, Server) - Returns Net service status object

problem_report

A string containing a problem report in the event of a virtual machine operation failure.

Get Method:
unreachable.srv__get_problem_report(SDK, Server) - Returns common Problem report from the server.

server_config

An instance of SrvConfig.

Get Method:
unreachable.srv__get_server_config(SDK, Server) - Return server hardware info.

server_info

An instance of SrvInfo.

Get Method:
unreachable.srv__get_server_info(srv, Srv) - Returns server information object (object of type PHT_SERVER_INFO)

users_info

An instance of UsrInfo.

Get Method:
unreachable.srv__get_users_info(srv, Srv) - Returns Result object with list of UsrInfo objects

questions

A tuple of instances of Question.

Get Method:
unreachable.srv__get_questions(srv, Srv) - This method is an alternative for working with questions synchronically

perf_stats

Returns an instance of Event containing the host perfomance statistics \.

Get Method:
unreachable.srv__get_perf_stats(SDK, Server, filter='') - filter - String representing statistics filter, use char '*' at the end to get subset of statistic.

vm_list

Instance of Result containing Vm instances

Get Method:
unreachable(s)