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 Container ID. See Creating a Simple Client Program for an example on how to obtain the list of the IDs from the Hardware Node.

/// <summary>

/// Sample function StartCT.

/// Starts the specified Container.

/// </summary>

/// <param name="ve_eid">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 the Server ID of the Container.

        start_input.eid = ve_eid;

    

        // Start the VE.

        env.start(start_input);

    

        return "OK!";

    }

    catch (Exception e) {

        return "Exception: " + e.Message;

    }

}

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

/// <summary>

/// Sample function StopVE.

/// Stops a VE.

/// </summary>

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

/// <returns></returns>

public string StopVE(string ve_eid)

{

    try {

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

        stop1 stop_input = new stop1();

    

        // Set ID.

        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">Server ID of the Container.</param>

/// <returns></returns>

public string RestartCT(string ve_eid)

{

    try {

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

        restart1 restart_input = new restart1();

    

        // Set ID.

        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