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

Class Server

object --+    
         |    
   _Handle --+
             |
            Server

The main class providing methods for accessing Virtuozzo Service. Most of the operations in the Virtuozzo Python API begin with obtaining an instance of this class. The class is used to establish a connection with the Virtuozzo Service. Its other methods can be used to perform various tasks related to the Virtuozzo Service itself, higher level virtual machine tasks, such as obtaining the virtual machine list or creating a virtual machine, and many others.

Instance Methods [hide private]
 
__init__(self, handle=0)
x.__init__(...) initializes x; see help(type(x)) for signature
 
create(self)
Create a new instance of the Server class.
 
login(self, host, user, passwd, sPrevSessionUuid='', port_cmd=0, timeout=0, security_level=2)
Login to a remote Virtuozzo Service.
 
login_local(self, sPrevSessionUuid='', port=0, security_level=2)
Login to the local Virtuozzo Service.
 
logoff(self)
Log off the Virtuozzo Service.
 
reg_event_handler(self, callback_func, userData)
Register an event handler.
 
unreg_event_handler(self, callback_func, userData)
Unregister the specified event handler.
 
get_questions(self)
Allows to synchronously receive questions from Virtuozzo Service.
 
set_non_interactive_session(self, bNonInteractive, nFlags=0)
Set the session in noninteractive or interactive mode.
 
is_non_interactive_session(self)
 
disable_confirmation_mode(self, sUser, sPasswd, nFlags=0)
Disable administrator confirmation mode for the session.
 
enable_confirmation_mode(self, nFlags=0)
Enable administrator confirmation mode for the session.
 
is_confirmation_mode_enabled(self)
Determine confirmation mode for the session.
 
get_srv_config(self)
Obtain the ServerConfig object containing the host configuration information.
 
get_common_prefs(self)
Obtain the DispConfig object containing the specified Virtuozzo Service preferences info.
 
common_prefs_begin_edit(self)
Mark the beginning of the Virtuozzo Service preferences modification operation.
 
common_prefs_commit(self, hDispCfg)
Commit the Virtuozzo Server preferences changes.
 
common_prefs_commit_ex(self, hDispCfg, nFlags)
 
get_user_profile(self)
Obtain the UserConfig object containing profile data of the currently logged in user.
 
get_user_info_list(self)
Obtain a list of UserInfo objects containing information about all known users.
 
get_user_info(self, sUserId)
Obtain the UserInfo object containing information about the specified user.
 
get_virtual_network_list(self, nFlags=0)
Obtain the VirtualNet object containing information about all existing virtual networks.
 
add_virtual_network(self, hVirtNet, nFlags=0)
Add a new virtual network to the Virtuozzo Service configuration.
 
update_virtual_network(self, hVirtNet, nFlags=0)
Update parameters of an existing virtual network.
 
delete_virtual_network(self, hVirtNet, nFlags=0)
Remove an existing virtual network from the Virtuozzo Service configuration.
 
update_offline_service(self, hOffmgmtService, nFlags)
 
delete_offline_service(self, hOffmgmtService, nFlags)
 
get_offline_services_list(self, nFlags)
 
update_network_classes_list(self, hNetworkClassesList, nFlags)
 
get_network_classes_list(self, nFlags)
 
update_network_shaping_config(self, hNetworkShapingConfig, nFlags)
 
get_network_shaping_config(self, nFlags)
 
configure_generic_pci(self, hDevList, nFlags=0)
Configure the PCI device assignment.
 
get_statistics(self)
Obtain the Statistics object containing the host resource usage statistics.
 
user_profile_begin_edit(self)
 
user_profile_commit(self, hUserProfile)
Saves (commits) user profile changes to the Virtuozzo Service.
 
is_connected(self)
Determine if the connection to the specified Virtuozzo Service is active.
 
get_server_info(self)
Obtain the ServerInfo object containing the host computer information.
 
register_vm(self, strVmDirPath, bNonInteractiveMode=False)
Register an existing virtual machine with the Virtuozzo Service.
 
register_vm_ex(self, strVmDirPath, nFlags)
Register an existing virtual machine with Virtuozzo Service (extended version).
 
register_vm_with_uuid(self, strVmDirPath, strVmUuid, nFlags)
 
register3rd_party_vm(self, strVmConfigPath, strVmRootDirPath, nFlags)
 
create_vm(self)
Create a new instaince of the Vm class.
 
get_vm_list(self)
Obtain a list of virtual machines from the host.
 
get_vm_list_ex(self, nFlags)
 
get_default_vm_config(self, nVmType, sConfigSample, nOsVersion, nFlags)
 
create_vm_backup(self, sVmUuid, sTargetHost, nTargetPort, sTargetSessionId, strDescription='', backup_flags=2048, reserved_flags=0, force_operation=True)
Backup an existing virtual machine to a backup server.
 
restore_vm_backup(self, sVmUuid, sBackupUuid, sTargetHost, nTargetPort, sTargetSessionId, sTargetVmHomePath='', sTargetVmName='', restore_flags=0, reserved_flags=0, force_operation=True)
Restore a virtual machine from a backup server.
 
get_backup_tree(self, sUuid, sTargetHost, nTargetPort, sTargetSessionId, backup_flags=2048, reserved_flags=0, force_operation=True)
Obtain a backup tree from the backup server.
 
remove_vm_backup(self, sVmUuid, sBackupUuid, sTargetHost, nTargetPort, sTargetSessionId, remove_flags, reserved_flags, force_operation)
Remove backup of the virtual machine from the backup server.
 
subscribe_to_host_statistics(self)
Subscribe to receive host statistics.
 
unsubscribe_from_host_statistics(self)
Cancel the host statistics subscription.
 
shutdown(self, bForceShutdown=False)
Shut down the Virtuozzo Service.
 
shutdown_ex(self, nFlags)
 
fs_get_disk_list(self)
Returns a list of root directories on the host computer.
 
fs_get_dir_entries(self, path)
Retrieve information about a file system entry on the host.
 
fs_create_dir(self, path)
Create a directory in the specified location on the host.
 
fs_remove_entry(self, path)
Remove a file system entry from the host computer.
 
fs_can_create_file(self, path)
Determine if the current user has rights to create a file on the host.
 
fs_rename_entry(self, oldPath, newPath)
Rename a file system entry on the host.
 
update_license(self, sKey, sUser, sCompany)
Installs Virtuozzo license on the specified Virtuozzo Service.
 
update_license_ex(self, sKey, sUser, sCompany, nFlags)
 
get_license_info(self)
Obtain the License object containing the Virtuozzo license information.
 
send_answer(self, hAnswer)
Send an answer to the Virtuozzo Service in response to a question.
 
start_search_vms(self, hStringsList=0)
Searche for unregistered virtual machines at the specified location(s).
 
net_service_start(self)
Start the Virtuozzo network service.
 
net_service_stop(self)
Stop the Virtuozzo network service.
 
net_service_restart(self)
Restarts the Virtuozzo network service.
 
net_service_restore_defaults(self)
Restores the default settings of the Virtuozzo network service.
 
get_net_service_status(self)
Obtain the NetService object containing the Virtuozzo network service status information.
 
get_problem_report(self)
Obtain a problem report in the event of a virtual machine operation failure.
 
get_packed_problem_report(self, nFlags)
 
attach_to_lost_task(self, sTaskId)
Obtain a handle to a running task after the connection to the Virtuozzo Service was lost.
 
get_supported_oses(self)
 
create_unattended_cd(self, nGuestType, sUserName, sPasswd, sFullUserName, sOsDistroPath, sOutImagePath)
Create a bootable ISO-image for unattended Linux installation.
 
fs_generate_entry_name(self, sDirPath, sFilenamePrefix='', sFilenameSuffix='', sIndexDelimiter='')
Automatically generate a unique name for a new directory.
 
subscribe_to_perf_stats(self, sFilter)
Subscribe to receive perfomance statistics.
 
unsubscribe_from_perf_stats(self)
Cancels the performance statistics subscription.
 
get_perf_stats(self, sFilter)
 
has_restriction(self, nRestrictionKey)
 
get_restriction_info(self, nRestrictionKey)
 
install_appliance(self, hAppCfg, sVmParentPath, nFlags)
 
cancel_install_appliance(self, hAppCfg, nFlags)
 
stop_install_appliance(self, hAppCfg, nFlags)
 
get_ct_template_list(self, nFlags)
 
remove_ct_template(self, sName, sOsTmplName, nFlags)
 
copy_ct_template(self, sName, sOsTmplName, sTargetServerHostname, nTargetServerPort, sTargetServerSessionUuid, nFlags, nReservedFlags)
 
is_feature_supported(self, nFeatureId)
 
add_ipprivate_network(self, hPrivNet, nFlags)
 
remove_ipprivate_network(self, hPrivNet, nFlags)
 
update_ipprivate_network(self, hPrivNet, nFlags)
 
get_ipprivate_networks_list(self, nFlags)
 
refresh_plugins(self, nFlags)
 
get_plugins_list(self, sClassId, nFlags)
 
login_ex(self, host, user, passwd, sPrevSessionUuid, port_cmd, timeout, security_level, flags)
 
login_local_ex(self, sPrevSessionUuid, port, security_level, flags)
 
get_disk_free_space(self, sPath, nFlags)
 
get_vm_config(self, sSearchId, nFlags)
 
get_cpupools_list(self)
 
move_to_cpupool(self, sCpuPool)
 
recalculate_cpupool(self, sCpuPool)
 
send_problem_report(self, hProblemReport, nFlags)
 
get_vcmmd_config(self, nFlags)
 
set_vcmmd_config(self, hVcmmdConfig, nFlags)

Inherited from _Handle: __del__, add_ref, free, from_string, get_handle_type, get_package_id, get_type

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, handle=0)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

create(self)

 

Create a new instance of the Server class.

Returns:
A new instance of Server.

reg_event_handler(self, callback_func, userData)

 

Register an event handler.

Overrides: _Handle.reg_event_handler

unreg_event_handler(self, callback_func, userData)

 

Unregister the specified event handler.

Overrides: _Handle.unreg_event_handler

get_srv_config(self)

 

Obtain the ServerConfig object containing the host configuration information.

Returns:
A Job object. The ServerConfig object is obtained from the Result object.

get_common_prefs(self)

 

Obtain the DispConfig object containing the specified Virtuozzo Service preferences info.

Returns:
A Job object.

common_prefs_begin_edit(self)

 

Mark the beginning of the Virtuozzo Service preferences modification operation. This method must be called before making any changes to the Virtuozzo Service common preferences through DispConfig. When you are done making the changes, call Server.common_prefs_commit to commit the changes.

common_prefs_commit(self, hDispCfg)

 

Commit the Virtuozzo Server preferences changes.

Parameters:
  • hDispCfg - A instance of DispConfig contaning the Virtuozzo Service preferences info.

get_user_profile(self)

 

Obtain the UserConfig object containing profile data of the currently logged in user.

Returns:
A Job object.

get_user_info_list(self)

 

Obtain a list of UserInfo objects containing information about all known users.

Returns:
A Job object.

get_user_info(self, sUserId)

 

Obtain the UserInfo object containing information about the specified user.

Parameters:
  • sUserId - UUID of the user to obtain the information for.
Returns:
A Job object.

add_virtual_network(self, hVirtNet, nFlags=0)

 

Add a new virtual network to the Virtuozzo Service configuration.

Parameters:
  • hVirtNet - An instance of the VirtualNet class containing the vitual network information.
  • nFlags - Reserved parameter.

delete_virtual_network(self, hVirtNet, nFlags=0)

 

Remove an existing virtual network from the Virtuozzo Service configuration.

Parameters:
  • hVirtNet - An instance of VirtualNet identifying the virtual network.
  • nFlags - Reserved parameter.

configure_generic_pci(self, hDevList, nFlags=0)

 

Configure the PCI device assignment.

Parameters:
  • hDevList - A list of HostPciDevice objects.
  • nFlags - Reserved parameter.

get_statistics(self)

 

Obtain the Statistics object containing the host resource usage statistics.

Returns:
A Job object.

get_server_info(self)

 

Obtain the ServerInfo object containing the host computer information.

Returns:
A Job object.

register_vm(self, strVmDirPath, bNonInteractiveMode=False)

 

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

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

create_vm(self)

 

Create a new instaince of the Vm class.

Returns:
A new instance of Vm.

get_vm_list(self)

 

Obtain a list of virtual machines from the host.

Returns:
A Job object. The list of virtual machines can be obtained from the Result object as a list of Vm objects.

create_vm_backup(self, sVmUuid, sTargetHost, nTargetPort, sTargetSessionId, strDescription='', backup_flags=2048, reserved_flags=0, force_operation=True)

 

Backup an existing virtual machine to a backup server.

Parameters:
  • sVmUuid - The virtual machine UUID
  • sTargetHost - The name of the target host machine.
  • nTargetPort - Port number on the target host.
  • sTargetSessionId - The targt Virtuozzo Service session ID.
  • strDescription - Backup description.
  • backup_flags - Backup options.
  • reserved_flags - Reserved backup flags.
  • force_operation - Ignore all possible questions from the Virtuozzo Service (non-interactive mode).
Returns:
A Job object.

get_backup_tree(self, sUuid, sTargetHost, nTargetPort, sTargetSessionId, backup_flags=2048, reserved_flags=0, force_operation=True)

 

Obtain a backup tree from the backup server.

Parameters:
  • sVmUuid - The target virtual machine UUID. Empty string gets the tree for all virtual machines.
  • sTargetHost - The name of the target host machine.
  • nTargetPort - Port number.
  • sTargetSessionId - The target Virtuozzo Service session ID.
  • backup_flags - Backup options.
  • reserved_flags - Reserved flags parameter.
  • force_operation - Ignore all questions from the Virtuozzo Service (non-interactive mode).
Returns:
A Job object. The backup tree data is obtained as an XML document from the Result object.

subscribe_to_host_statistics(self)

 

Subscribe to receive host statistics. This is an asynchronous method.

Returns:
A Job object.

unsubscribe_from_host_statistics(self)

 

Cancel the host statistics subscription. This is an asynchronous method.

Returns:
A Job object.

fs_get_dir_entries(self, path)

 

Retrieve information about a file system entry on the host.

Parameters:
  • path - Directory name or drive letter for which to get the information.
Returns:
A Job object. The directory information is returned as an FsInfo object and is obtained from the Result object.

fs_create_dir(self, path)

 

Create a directory in the specified location on the host.

Parameters:
  • path - Full name and path of the directory to create.

fs_remove_entry(self, path)

 

Remove a file system entry from the host computer.

Parameters:
  • path - Name and path of the entry to remove.

fs_can_create_file(self, path)

 

Determine if the current user has rights to create a file on the host.

Parameters:
  • path - Full path of the target directory.
Returns:
Boolean. True - the user can create files in the specified directory. False - otherwise.

fs_rename_entry(self, oldPath, newPath)

 

Rename a file system entry on the host.

Parameters:
  • oldPath - Name and path of the entry to rename.
  • newPath - New name and path.

get_license_info(self)

 

Obtain the License object containing the Virtuozzo license information.

Returns:
A Job object.

get_net_service_status(self)

 

Obtain the NetService object containing the Virtuozzo network service status information.

Returns:
A Job object.

get_problem_report(self)

 

Obtain a problem report in the event of a virtual machine operation failure.

Returns:
A Job object. The report is returned as a string that is obtained from the Result object.

attach_to_lost_task(self, sTaskId)

 

Obtain a handle to a running task after the connection to the Virtuozzo Service was lost.

Parameters:
  • sTaskId - The ID of the task to attach to. The ID is obtained from the LoginResponse object.

fs_generate_entry_name(self, sDirPath, sFilenamePrefix='', sFilenameSuffix='', sIndexDelimiter='')

 

Automatically generate a unique name for a new directory.

Parameters:
  • sDirPath - Full name and path of the target directory.
  • sFilenamePrefix - A prefix to to use in the directory name. Pass empty string for default.
  • sFilenameSuffix - A suffix to use in the name. Pass empty string for default.
  • sIndexDelimiter - A character to use as a delimiter between prefix and index.
Returns:
A Job object.