Class Vdc


  • public class Vdc
    extends PoolElement
    This class represents an OpenNebula vdc. It also offers static XML-RPC call wrappers.
    • Constructor Detail

      • Vdc

        public Vdc​(int id,
                   Client client)
        Creates a new Vdc representation.
        Parameters:
        id - The vdc id.
        client - XML-RPC Client.
      • Vdc

        protected Vdc​(org.w3c.dom.Node xmlElement,
                      Client client)
        See Also:
        PoolElement
    • Method Detail

      • allocate

        public static OneResponse allocate​(Client client,
                                           java.lang.String description)
        Allocates a new vdc in OpenNebula
        Parameters:
        client - XML-RPC Client.
        description - A string containing the template of the vdc.
        Returns:
        If successful the message contains the associated id generated for this vdc.
      • info

        public static OneResponse info​(Client client,
                                       int id)
        Retrieves the information of the given vdc.
        Parameters:
        client - XML-RPC Client.
        id - The vdc id.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info

        public static OneResponse info​(Client client,
                                       int id,
                                       boolean decrypt)
        Retrieves the information of the given VDC.
        Parameters:
        client - XML-RPC Client.
        id - The VDC id for the VDC to retrieve the information from
        decrypt - If true decrypt sensitive attributes
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • delete

        public static OneResponse delete​(Client client,
                                         int id)
        Deletes a vdc from OpenNebula.
        Parameters:
        client - XML-RPC Client.
        id - The vdc id.
        Returns:
        A encapsulated response.
      • update

        public static OneResponse update​(Client client,
                                         int id,
                                         java.lang.String new_template,
                                         boolean append)
        Replaces the template contents.
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc we want to modify.
        new_template - New template contents
        append - True to append new attributes instead of replace the whole template
        Returns:
        If successful the message contains the vdc id.
      • rename

        public static OneResponse rename​(Client client,
                                         int id,
                                         java.lang.String name)
        Renames this vdc
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        name - New name for the vdc.
        Returns:
        If an error occurs the error message contains the reason.
      • addGroup

        public static OneResponse addGroup​(Client client,
                                           int id,
                                           int groupId)
        Adds a group to this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        groupId - The group to add
        Returns:
        If an error occurs the error message contains the reason.
      • delGroup

        public static OneResponse delGroup​(Client client,
                                           int id,
                                           int groupId)
        Deletes a group from this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        groupId - The group to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addCluster

        public static OneResponse addCluster​(Client client,
                                             int id,
                                             int zoneId,
                                             int clusterId)
        Adds a cluster to this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The cluster's zone
        clusterId - The cluster to add
        Returns:
        If an error occurs the error message contains the reason.
      • delCluster

        public static OneResponse delCluster​(Client client,
                                             int id,
                                             int zoneId,
                                             int clusterId)
        Deletes a cluster from this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The cluster's zone
        clusterId - The cluster to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addHost

        public static OneResponse addHost​(Client client,
                                          int id,
                                          int zoneId,
                                          int hostId)
        Adds a host to this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The host's zone
        hostId - The host to add
        Returns:
        If an error occurs the error message contains the reason.
      • delHost

        public static OneResponse delHost​(Client client,
                                          int id,
                                          int zoneId,
                                          int hostId)
        Deletes a host from this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The host's zone
        hostId - The host to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addVnet

        public static OneResponse addVnet​(Client client,
                                          int id,
                                          int zoneId,
                                          int vnetId)
        Adds a vnet to this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The vnet's zone
        vnetId - The vnet to add
        Returns:
        If an error occurs the error message contains the reason.
      • delVnet

        public static OneResponse delVnet​(Client client,
                                          int id,
                                          int zoneId,
                                          int vnetId)
        Deletes a vnet from this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The vnet's zone
        vnetId - The vnet to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addDatastore

        public static OneResponse addDatastore​(Client client,
                                               int id,
                                               int zoneId,
                                               int datastoreId)
        Adds a datastore to this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The datastore's zone
        datastoreId - The datastore to add
        Returns:
        If an error occurs the error message contains the reason.
      • delDatastore

        public static OneResponse delDatastore​(Client client,
                                               int id,
                                               int zoneId,
                                               int datastoreId)
        Deletes a datastore from this VDC
        Parameters:
        client - XML-RPC Client.
        id - The vdc id of the target vdc
        zoneId - The datastore's zone
        datastoreId - The datastore to delete
        Returns:
        If an error occurs the error message contains the reason.
      • update

        public OneResponse update​(java.lang.String new_template)
        Replaces the template contents.
        Parameters:
        new_template - New template contents
        Returns:
        If successful the message contains the vdc id.
      • update

        public OneResponse update​(java.lang.String new_template,
                                  boolean append)
        Replaces the template contents.
        Parameters:
        new_template - New template contents
        append - True to append new attributes instead of replace the whole template
        Returns:
        If successful the message contains the vdc id.
      • rename

        public OneResponse rename​(java.lang.String name)
        Renames this Vdc
        Parameters:
        name - New name for the vdc.
        Returns:
        If an error occurs the error message contains the reason.
      • addGroup

        public OneResponse addGroup​(int groupId)
        Adds a group to this VDC
        Parameters:
        groupId - The group to add
        Returns:
        If an error occurs the error message contains the reason.
      • delGroup

        public OneResponse delGroup​(int groupId)
        Deletes a group from this VDC
        Parameters:
        groupId - The group to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addCluster

        public OneResponse addCluster​(int zoneId,
                                      int clusterId)
        Adds a cluster to this VDC
        Parameters:
        zoneId - The cluster's zone
        clusterId - The cluster to add
        Returns:
        If an error occurs the error message contains the reason.
      • delCluster

        public OneResponse delCluster​(int zoneId,
                                      int clusterId)
        Deletes a cluster from this VDC
        Parameters:
        zoneId - The cluster's zone
        clusterId - The cluster to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addHost

        public OneResponse addHost​(int zoneId,
                                   int hostId)
        Adds a host to this VDC
        Parameters:
        zoneId - The host's zone
        hostId - The host to add
        Returns:
        If an error occurs the error message contains the reason.
      • delHost

        public OneResponse delHost​(int zoneId,
                                   int hostId)
        Deletes a host from this VDC
        Parameters:
        zoneId - The host's zone
        hostId - The host to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addVnet

        public OneResponse addVnet​(int zoneId,
                                   int vnetId)
        Adds a vnet to this VDC
        Parameters:
        zoneId - The vnet's zone
        vnetId - The vnet to add
        Returns:
        If an error occurs the error message contains the reason.
      • delVnet

        public OneResponse delVnet​(int zoneId,
                                   int vnetId)
        Deletes a vnet from this VDC
        Parameters:
        zoneId - The vnet's zone
        vnetId - The vnet to delete
        Returns:
        If an error occurs the error message contains the reason.
      • addDatastore

        public OneResponse addDatastore​(int zoneId,
                                        int datastoreId)
        Adds a datastore to this VDC
        Parameters:
        zoneId - The datastore's zone
        datastoreId - The datastore to add
        Returns:
        If an error occurs the error message contains the reason.
      • delDatastore

        public OneResponse delDatastore​(int zoneId,
                                        int datastoreId)
        Deletes a datastore from this VDC
        Parameters:
        zoneId - The datastore's zone
        datastoreId - The datastore to delete
        Returns:
        If an error occurs the error message contains the reason.