Previous page

Next page

Locate page in Contents

Connecting to Parallels Service and Logging In

The sample program in the previous section provided basic instructions on how to connect and log in to a local or a remote host. In this section, we will discuss these operations in greater detail.

Parallels Server accepts both local and remote connections. This means that your program can run anywhere on the network and connect to the Parallels Server remotely. Parallels Server allows multiple connections. If running a program locally, you have an option to login as the current user or as a specific user. If a program is running on a remote machine, you always have to specify the user information.

All other Parallels virtualization products accept local connections only. This means that you can only run your program on the same computer that hosts the Parallels Virtualization Service. Multiple connections are not allowed, so the only option available is to connect as the current user.

The prlsdkapi.Server class provides two login methods: login_local and login.

The login_local method is used to establish a local connection as a current user.  It can be used with Parallels Server and other Parallels products.

The login() method is used to establish a local or a remote connection as a specified user. It can be used with Parallels Server only.

The following tables describe the parameters of the two login methods.

prlsdkapi.Server.login_local

Parameter

Type

Description

sPrevSessionUuid

string

[optional] Previous session ID. This parameter can be used in recovering from a lost connection. The ID will be used to restore references to the asynchronous jobs that were started in the previous session and are still running on the server. If you are not restoring a connection, omit this parameter or pass an empty string.

The default value is empty string.

port

integer

[optional] Port number at which Parallels Service is listening for incoming requests. To use the default port number, pass 0. If the default port number was changed by the administrator of your system, specify the correct value.

The default value is 0.

security_level

integer

[optional] Communication security level to use for the session. The value must be specified using one of the constants with the PSL_ prefix. The following options are currently available (for possible changes, consult the Parallels Python API Reference guide):

PSL_HIGH_SECURITY - using SSL. PSL_LOW_SECURITY - no encryption. PSL_NORMAL_SECURITY - mixed.

Parallels Service configuration have a setting specifying the minimum security level (the setting can be modified). You must specify here an equal or a higher level to establish a connection. To find out the minimum level, use the get_min_security_level method of the prlsdkapi.DispConfig class.

The default value is PSL_HIGH_SECURITY.

prlsdkapi.Server.login

Parameter

Type

Description

host

string

The IP address or name of the host.

user

string

User name.

passwd

string

User password.

sPrevSessionUuid

string

[optional] Previous session ID. This parameter can be used in recovering from a lost connection. The ID will be used to restore references to asynchronous jobs that were started in the previous session and are still running on the server. If you are not restoring a connection, omit this parameter or pass an empty string value.

The default value is empty string.

port_cmd

integer

[optional] Port number on which Parallels Service is listening for incoming requests. To use the default port number, pass 0. If the default port number was changed by the administrator, specify the correct value.

The default value is 0.

timeout

integer

[optional] Timeout value in milliseconds. The operation will be automatically interrupted if a connection is not established within this timeframe. Specify 0 (zero) for infinite timeout.

The default value is 0.

security_level

integer

[optional] Communication security level to use for the session. The value must be specified using one of the constants with the PSL_ prefix. The following options are currently available (for possible changes, consult the Parallels Python API Reference guide):

PSL_HIGH_SECURITY - using SSL. PSL_LOW_SECURITY - no encryption. PSL_NORMAL_SECURITY - mixed.

Parallels Service configuration have a setting specifying the minimum security level (the setting can be modified). You must specify here an equal or a higher level to establish a connection. To find out the minimum level, use the get_min_security_level method of the prlsdkapi.DispConfig class.

The default value is PSL_HIGH_SECURITY.

Both methods return an instance of the prlsdkapi.LoginResponse class containing some basic information about the host, the new session ID, and the information about the previous session (if applicable).