Previous page

Next page

Locate page in Contents

Print this page

Starting, Stopping, Restarting a Container

To start a Container, use the vzaenvmBinding.start() method passing the Server ID. See Creating a Simple Client Program for the example on how to obtain the list of the Server IDs.

/// <summary>

/// Sample function StartCT.

/// Starts the specified Container.

/// </summary>

/// <param name="ve_eid">The Server ID of the Container.</param>

/// <returns>"OK" or error information.</returns>

public string StartCT(string ve_eid)

{

    try {

    

        // Instantiate the proxy class.

        vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));

          

        // The main input object.

        start start_input = new start();

    

        // Set Server ID.

        start_input.eid = ve_eid;

    

        // Start the Container.

        env.start(start_input);

    

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

Stopping and Restarting a Container is similar to the example above. The following two functions demonstrate how it's done.

/// <summary>

/// Sample function StopCT.

/// Stops a Container.

/// </summary>

/// <param name="ve_eid">Server ID of the Container.</param>

/// <returns></returns>

public string StopCT(string ve_eid)

{

    try {

        vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));

        stop1 stop_input = new stop1();

    

        // Set the Server ID of the Container.

        stop_input.eid = ve_eid;

    

        // Stop the Container.

        env.stop(stop_input);

    

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

    

/// <summary>

/// Sample function RestartCT.

/// Restarts a Container.

/// </summary>

/// <param name="ve_eid">Container Server ID.</param>

/// <returns></returns>

public string RestartCT(string ve_eid)

{

    try {

        vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));

        restart1 restart_input = new restart1();

    

        // Set the Server ID of the Container.

        restart_input.eid = ve_eid;

        // Restart the Container.

        env.restart(restart_input);

    

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

Please send us your feedback on this help page