Previous Topic: Adding Replicas: add_replica()Next Topic: Setting Scenario Properties: set_scenario_data()


Adding Multiple Replicas: add_replica_ex()

The add_replica_ex API function lets you add one or more new replica hosts for the scenario at one time.

Arguments

The add_replica_ex API function includes the arguments described in the following table:

Name

Type

Description

session_id

uint

The session ID that was returned by calling the create_session function API.

scenario_data

ref string

The data for the scenario. After calling this API, the argument contains the updated scenario data.

host_index

uint

The parent host index; the master host index is always 1; the first replica usually is 2.

host_list

ref string

The host list provides information about hosts in an xml format. The xml contains information about the hosts that you want to add to the scenario.

Note: See the screen following this table.

For example, the following xml code contains information about two hosts.

This XML describes how to add information about two hosts.

Return Values

This function returns a value of true when the API call completes successfully. Otherwise, this function returns a value of false.

Example: Add multiple replicas

string host_list = "<?xml version=\"1.0\"?><object> <object><data label=\"Host\" val=\"155.35.76.155\" type=\"String\" /><data label=\"IP\" val=\"155.35.76.155\" type=\"String\" /> </object><object><data label=\"Host\" val=\"155.35.76.156\" type=\"String\" /><data label=\"IP\" val=\"155.35.76.156\" type=\"String\" /> </object></object>";

//add two replicas under the master host
get_mng().add_replica_ex(_session_id, ref scenario_data, master_host_index, ref host_list);