Ejemplo n.º 1
0
    def create(self,
               name,
               description="",
               datacenterguids=[],
               dns="",
               smtp="",
               smtplogin="",
               smtppassword="",
               jobguid="",
               executionparams={}):
        """
        
        Create a new cloud.

        @execution_method = sync
        
        @security administrators
        @param name:                   Name for the cloud.
        @type name:                    string

        @param description:            Description for the cloud.
        @type description:             string

        @param datacenterguids:        guid of the datacenters to which this cloud belongs, can be a cloud spans multiple datacenters
        @type datacenterguids:         list(guid)

        @param dns:                    dns for this cloud environment.
        @type dns:                     ipaddress
        
        @param smtp:                   Host of the SMTP server to use in this cloud.
        @type smtp:                    string
        
        @param smtplogin:              Login of the SMTP server (if required).
        @type smtplogin:               string
        
        @param smtppassword:           Password of the SMTP server (if required).
        @type smtppassword:            string

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       dictionary with cloudguid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                        dictionary

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_cloud.create(
                name, description, datacenterguids, dns, smtp, smtplogin,
                smtppassword, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 2
0
    def find(self,
             name="",
             ostype="",
             iconname="",
             osversion="",
             patchlevel="",
             description="",
             osbitversion="",
             jobguid="",
             executionparams={}):
        """
        
        Returns a list of os guids which met the find criteria.

        @execution_method = sync
        
        @param name:               Name of the os.
        @type name:                string

        @param ostype:             Os type.
        @type ostype:              string

        @param iconname:           filename of icon representing os in various clouduser interfaces
        @type iconname:            string

        @param osversion:          version of the operating system
        @type osversion:           string

        @param patchlevel:         patch level of operating system
        @type patchlevel:          string

        @param description:        description of the operating system
        @type description:         string
        
        @param osbitversion:          bit version of the operating system e.g. 32-bit , 64-bit
        @type osbitversion:           string

        @param jobguid:            guid of the job if avalailable else empty string
        @type jobguid:             guid

        @param executionparams:    dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:     dictionary

        @return:                   dictionary with an array of os guids as result and jobguid: {'result': array, 'jobguid': guid}
        @rtype:                    dictionary

        @raise e:                  In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_os.find(name, ostype, iconname,
                                                   osversion, patchlevel,
                                                   description, osbitversion,
                                                   jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 3
0
    def create(self,
               name,
               description="",
               alias="",
               address="",
               city="",
               country="",
               public=False,
               jobguid="",
               executionparams={}):
        """
        
        Create a new location.

        @execution_method = sync
        
        @security administrators
        @param name:                   Name for the location.
        @type name:                    string

        @param description:            Description for the location.
        @type description:             string

        @param alias:                  Alias for the location.
        @type alias:                   string

        @param address:                Address for the location.
        @type address:                 string

        @param city:                   City for the location.
        @type city:                    string

        @param country:                Country for the location.
        @type country:                 string

        @param public:                 Indicates if the location is a public location.
        @type public:                  boolean

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       dictionary with locationguid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                        dictionary

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_location.create(
                name, description, alias, address, city, country, public,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 4
0
    def updateModelProperties(self,
                              customerguid,
                              name="",
                              description="",
                              address="",
                              city="",
                              country="",
                              retentionpolicyguid="",
                              jobguid="",
                              executionparams={}):
        """
        
        Update properties, every parameter which is not passed or passed as empty string is not updated.
        @SECURITY administrator only

        @execution_method = sync
        
        @param customerguid:         Guid of the customer specified
        @type customerguid:          guid

        @param name:                 Name for this customer
        @type name:                  string

        @param description:          Description for this customer
        @type description:           string

        @param address:              Address for this customer
        @type address:               string

        @param city:                 City for this customer
        @type city:                  string

        @param country:              Country for this customer
        @type country:               string
        
        @param retentionpolicyguid:  Guid of the retention policy for snapshots
        @type retentionpolicyguid:   guid
        
        @param jobguid:              Guid of the job if avalailable else empty string
        @type jobguid:               guid

        @param executionparams:      dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:       dictionary

        @return:                     dictionary with customer guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                      dictionary

        @raise e:                    In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_customer.updateModelProperties(
                customerguid, name, description, address, city, country,
                retentionpolicyguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 5
0
    def list (self, cloudspaceguid = "", backplaneguid = "", languid = "", jobguid = "", executionparams = {}):
        """
        
        List all lans.

        @returns array of array [[$lanName,"public" or "private",$nrOfIpAddresses,$nrOfFreeIPAddresses,$description]]


        @execution_method = sync

        @param cloudspaceguid:             guid of the cloud space to list the lans for. If not specified, return all lans you have access to.
        @type cloudspaceguid:              guid

        @param backplaneguid:              guid of the backplane to list the lans for. If not specified, return all lans you have access to.
        @type backplaneguid:               guid

        @param languid:                    guid of the LAN
        @type languid:                     guid

        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with array of lan info as result and jobguid: {'result': array, 'jobguid': guid}
        @rtype:                            dictionary
        @note:                             {'jobguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                              'result: [{ 'cloudspaceguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'backplaneguid': '55544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'languid': '75544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'parentlanguid': '45544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'name': 'Office Lan',
        @note:                                          'description': 'Our Office Lan',
        @note:                                          'lantype': 'STATIC',
        @note:                                          'public': False,
        @note:                                          'storage': False,
        @note:                                          'management': False},
        @note:                                        { 'cloudspaceguid': '789544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'backplaneguid': '78644B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'languid': '78644B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'parentlanguid': '74844B07-4129-47B1-8690-B92C0DB21434',
        @note:                                          'name': 'Internet Feed',
        @note:                                          'description': 'Our Public Lan',
        @note:                                          'lantype': 'DYNAMIC',
        @note:                                          'public': True,
        @note:                                          'storage': False,
        @note:                                          'management': False}]}
        
        @raise e:                          In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_lan.list(cloudspaceguid,backplaneguid,languid,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
    def updateModelProperties(self,
                              networkzoneguid,
                              name="",
                              description="",
                              public=False,
                              datacenterguid="",
                              parentnetworkzoneguid="",
                              ranges=[],
                              jobguid="",
                              executionparams={}):
        """
        
        Update basic properties (every parameter which is not passed or passed as empty string is not updated)

        @security administrators

        @param networkzoneguid:        Guid of the networkzone specified
        @type networkzoneguid:         guid

        @param name:                   name of the networkzone
        @type name:                    string

        @param description:            description of the object
        @type description:             string

        @param public:                 is this network zone public to the internet
        @type public:                  bool

        @param datacenterguid:         guid of the datacenter
        @type datacenterguid:          guid

        @param parentnetworkzoneguid:  guid of the parantnetworkzoneguid
        @type parentnetworkzoneguid:   guid

        @param ranges:                 list of networkzoneranges
        @type ranges:                  array(networkzonerange)

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       dictionary with networkzone guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                        dictionary

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_networkzone.updateModelProperties(
                networkzoneguid, name, description, public, datacenterguid,
                parentnetworkzoneguid, ranges, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 7
0
    def clone (self, sourcevdcguid, destinationcloudspaceguid = "", copynetworkinfo = True, maintenancemode = False, autostart = True, jobguid = "", executionparams = {}):
        """
        
        Create a clone of a complete VDC.
        For the machines: cloning means the blocks on the disks are not copied, only the changes are remembered.

        @param sourcevdcguid:                 guid of the VDC rootobject
        @type sourcevdcguid:                  guid

        @param destinationcloudspaceguid:     guid of the VDC rootobject. If not specified, VDC will be cloned in the same space as the source VDC.
        @type destinationcloudspaceguid:      guid
        @note:                                if in same space:
        @note:                                -----------------
        @note:                                * all rootobject properties will be copied over apart from
        @note:                                ** new guid's
        @note:                                ** the machine.name = original + _clone_vX (x being incremental nr)
        @note:                                * For the network lan's, the machine's stay connected to the same LAN's but new ip addresses are looked for on those LAN's

        @note:                                if in different space
        @note:                                ---------------------
        @note:                                * all rootobject properties will be copied over
        @note:                                * new network LAN's are created with as name $originalLanName_clone_vX X being incremental nr
        @note:                                * the ip addresses are 100% the same as the original ip addresses
        @note:                                * for the private LAN's: the VLAN's are ALL NEW!!! There is always 100% separation between spaces for private LAN's
        @note:                                * for the public LAN's: the machine's stay connected to the same LAN's but new ip addresses are looked for on those LAN's

        @param copynetworkinfo:               Boolean value indicating if the network info should be copied. Default is True.
        @type copynetworkinfo:                boolean

        @param maintenancemode:               Boolean value indicating if cloned VDC should be put in maintenance mode. Default is False.
        @type maintenancemode:                boolean
        @note:                                 if maintenancemode==True
        @note:                                ------------------------
        @note:                                * then all LAN's will get a different vlan tag
        @note:                                * new network LAN's are created with as name $originalLanName_clone_vX X being incremental nr
        @note:                                * the ip addresses are 100% the same as the original ip addresses

        @param autostart:                     Boolean value indicating if the machine of the new VDC should start automatically. Default is True.
        @type autostart:                      boolean

        @param jobguid:                       guid of the job if avalailable else empty string
        @type jobguid:                        guid

        @param executionparams:               dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:                dictionary

        @return:                              dictionary with vdc guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                               dictionary

        
        """
        try:
            result = self._proxy.cloud_api_vdc.clone(sourcevdcguid,destinationcloudspaceguid,copynetworkinfo,maintenancemode,autostart,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 8
0
    def create(self,
               name,
               storageNodes,
               storageSafety,
               minSbSize,
               maxSbSize,
               spreadLocations,
               resourceGroup,
               jobguid="",
               executionparams={}):
        """
         
        creates a new dss policy

        @execution_method = sync
        
        @param name:            policy name
        @type name:             string

        @param storageNodes:    defines the minimum number of storage daemons in the spread
        @type storageNodes:     int

        @param  storageSafety:  defines the number of storage daemons in that can be unavailable in a spread before data loss occurs
        @type storageSafety:    int
    
        @param minSbSize:       the minimum size of a superblock in bytes (needs to be power of 2)
        @type minSbSize:        int       
    
        @param maxSbSize:       the maximum size of a superblock in bytes (needs to be power of 2)
        @type maxSbSize:        int
        
        @param spreadLocations: specify a list of locations on which the data needs to be equally spread, array of datacenter guids
        @type spreadLocations:  array(guid)    
    
        @param resourceGroup:   a resourcegroup is an array of pmachineguids that represent storage nodes
        @type resourceGroup:    array(guid)        

        @param jobguid:         guid of the job if available else empty string
        @type jobguid:          guid

        @param executionparams: dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:  dictionary

        @return:                dictionary with policyguid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                 dictionary

        @raise e:               In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_dsspolicy.create(
                name, storageNodes, storageSafety, minSbSize, maxSbSize,
                spreadLocations, resourceGroup, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 9
0
 def addNic(self,
            deviceguid,
            status,
            nicporttype,
            name="",
            sequence="",
            hwaddr="",
            backplaneguid="",
            cableguid="",
            jobguid="",
            executionparams={}):
     """
     
     Add nicport property
     
     @execution_method = sync
     
     @param deviceguid:        Guid of the device rootobject
     @type deviceguid:         guid
     
     @param status:            status of nicport
     @type status:             nicportstatustype
     
     @param nicporttype:       hardware type of nicport
     @type nicporttype:        nicporttype
     
     @param name:              name of the nic port
     @type name:               string
     
     @param sequence:          sequence of nic port
     @type sequence:           integer
     
     @param hwaddr:            hardware address like macaddr
     @type hwaddr:             string
     
     @param backplaneguid:     backplane to which the nicport is connected
     @type backplaneguid:      guid
     
     @param cableguid:         cable to which the nicport is connected
     @type cableguid:          guid
     
     @return:                  dictionary with device guid as result and jobguid: {'result': guid, 'jobguid': guid}
     @rtype:                   dictionary
     
     @raise e:                 In case an error occurred, exception is raised
     
     """
     try:
         result = self._proxy.cloud_api_device.addNic(
             deviceguid, status, nicporttype, name, sequence, hwaddr,
             backplaneguid, cableguid, jobguid, executionparams)
         return result
     except Exception, ex:
         raise CloudApiException(ex)
Ejemplo n.º 10
0
    def getVMachineLoad(self, vmachineguid, jobguid="", executionparams={}):
        """
        
        Returns load information for a specified (virtual) machine.

        @execution_method = sync

        memory, cpu & bandwidth usage for 1 vmachine
        - memory in MB & percentage of total MB capacity of host
        - cpu in mhz for last measurement  (calculated as % of host e.g. if host 4core 2 Ghz = 8000mhz, if machine uses 10% of capacity, his cpu load = 800 Mhz)
        - cpu in mhz avg over last hour
        - bandwidth in mbit/sec for last measurement (all vnics per vmachine)
        - bandwidth in mbit/sec avg over last hour (all vnics per vmachine)

        information comes from monitoring database (in principle only 1 monitoring object per vmachine needs to be captured, all info is in)

        If fake output fake values, can be handy for demo purposes
        - cpu: hash the guid, use first letter as gradation between 0 & 15, then do a 20% variation (random), this to make sure machine always comes back in same range
           e.g. cpu guid hash = 8B3D8B3D  , cpuusage=((guid[0]+1)/15*10)+rand(0,4)-0,2    , cpuusageAvg=((guid[0]+1)/15*10)
        -  memusage=vmachine.memory
        -  bwusage=((guid[0]+1)/15*10) * (1.4-rand(0,8)) * 1             mbit
        -  bwusageLastHour=((guid[0]+1)/15*10) * 1             mbit

        @param vmachineguid:               guid of the virtual machine for which to get load info for
        @type vmachineguid:                guid

        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with a dictionary as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                            dictionary
        @note:                             {'result':
        @note:                                  {'machineguid': '7D763680-ED8A-463F-AA25-EBF3EA7A1894',
        @note:                                   'name': 'MyVMachine',
        @note:                                   'memory': 1024,
        @note:                                   'memorypercent': 15,
        @note:                                   'cpu': 1200,
        @note:                                   'cpuavg': 800,
        @note:                                   'bandwidth': 800,
        @note:                                   'bandwidthavg': 600},
                                            'jobguid': "8D763680-ED8A-463F-AA25-EBF3EA7A1894"}

        @raise e:                          In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_machinemonitoring.getVMachineLoad(
                vmachineguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 11
0
    def find (self, name = "", racktype = "", description = "", datacenterguid = "", floor = "", corridor = "", position = "", height = 42, jobguid = "", executionparams = {}):
        """
        
        Returns a list of rack guids which met the find criteria.

        @execution_method = sync
        
        @security administrators

        @param name:                   Name for the rack.
        @type name:                    string

        @param racktype:               type of the rack
        @type racktype:                string

        @param description:            Description for the rack.
        @type description:             string

        @param datacenterguid:         datacenter to which the rack belongs
        @type datacenterguid:          guid

        @param  floor:                 floor location of the rack in the datacenter
        @type floor:                   string(100)

        @param  corridor:              corridor location of the rack on the floor
        @type corridor:                string(100)

        @param  position:              position of the rack in the corridor or datacenter
        @type position:                string(100)

        @param  height:                rack height
        @type height:                  int

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       Array of rack guids which met the find criteria specified.
        @rtype:                        array

        @note:                         Example return value:
        @note:                         {'result': '["FAD805F7-1F4E-4DB1-8902-F440A59270E6","C4395DA2-BE55-495A-A17E-6A25542CA398"]',
        @note:                          'jobguid':'5D2C0F39-F34E-4542-9B6F-B9233E80D803'}

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_rack.find(name,racktype,description,datacenterguid,floor,corridor,position,height,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 12
0
    def create(self,
               name,
               resourcegroupguid="",
               description="",
               address="",
               city="",
               country="",
               jobguid="",
               executionparams={}):
        """
        
        Creates a new customer

        @execution_method = sync
        
        @param name:                Name for this new customer
        @type name:                 string

        @param resourcegroupguid:   Guid of the resource group related to this customer
        @type resourcegroupguid:    guid

        @param description:         Description for this new customer
        @type description:          string

        @param address:             Address for this new customer
        @type address:              string

        @param city:                City for this new customer
        @type city:                 string

        @param country:             Country for this new customer
        @type country:              string

        @param jobguid:             Guid of the job if avalailable else empty string
        @type jobguid:              guid

        @param executionparams:     dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:      dictionary

        @return:                    dictionary with customer guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                     dictionary

        @raise e:                   In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_customer.create(
                name, resourcegroupguid, description, address, city, country,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 13
0
    def updateModelProperties (self, rackguid, name = "", racktype = "", description = "", datacenterguid = "", floor = "", corridor = "", position = "", height = 42, jobguid = "", executionparams = {}):
        """
        
        Update basic properties (every parameter which is not passed or passed as empty string is not updated)

        @execution_method = sync
        
        @security administrators
        @param rackguid:               Guid of the rack specified
        @type rackguid:                guid

        @param name:                   Name for the rack.
        @type name:                    string

        @param racktype:               type of the rack
        @type racktype:                string

        @param description:            Description for the rack.
        @type description:             string

        @param datacenterguid:         datacenter to which the rack belongs
        @type datacenterguid:          guid

        @param  floor:                 floor location of the rack in the datacenter
        @type floor:                   string(100)

        @param  corridor:              corridor location of the rack on the floor
        @type corridor:                string(100)

        @param  position:              position of the rack in the corridor or datacenter
        @type position:                string(100)

        @param  height:                rack height
        @type height:                  int

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       dictionary with rack guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                        dictionary

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_rack.updateModelProperties(rackguid,name,racktype,description,datacenterguid,floor,corridor,position,height,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 14
0
    def create (self, name, rootobjecttype, rootobjectaction, rootobjectguid, interval, runbetween = None, runnotbetween = None, policyparams = None, description = "", jobguid = "", executionparams = {}):
        """
        
        Creates a new policy.

        @execution_method = sync
        
        @param name:                     Name for the new policy
        @type name:                      string

        @param rootobjecttype:           RootObject type for the new policy
        @type rootobjecttype:            string
        
        @param rootobjectaction:         Name of the action for the new policy
        @type rootobjectaction:          string
        
        @param rootobjectguid:           Guid of the rootobject for the new policy
        @type rootobjectguid:            string
        
        @param interval:                 Interval for the new policy
        @type interval:                  int
        
        @param runbetween:               List of tuples with timestamps when a policy can run
        @type runbetween:                list
        
        @param runnotbetween:            List of tuples with timestamps when a policy can not run
        @type runnotbetween:             string
        
        @param policyparams:             Params for the new policy
        @type policyparams:              string
        
        @param description:              Description for the new policy
        @type description:               string
        
        @param jobguid:                  Guid of the job if available else empty string
        @type jobguid:                   guid

        @param executionparams:          dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:           dictionary

        @return:                         Dictionary with policyguid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                          dictionary

        @raise e:                        In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_policy.create(name,rootobjecttype,rootobjectaction,rootobjectguid,interval,runbetween,runnotbetween,policyparams,description,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 15
0
    def getPMachineNetworkInfo(self,
                               pmachineguid,
                               jobguid="",
                               executionparams={}):
        """
        
        return info about networking per interface (device) for a given physical machine

        @execution_method = sync

        @param pmachineguid:               guid of the host machine for which to retrieve the network info for
        @type pmachineguid:                guid

        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with a dictionary as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                            dictionary

        @raise e:                          In case an error occurred, exception is raised

        @note:                             {'result':
        @note:                                   {'machineguid': '7D763680-ED8A-463F-AA25-EBF3EA7A1894',
        @note:                                    'nics':
        @note:                                       [{'name': 'eth1',
        @nota:                                         'mac': 'aa:54:b8:3c:f7:ff',
        @note:                                         'ipaddresses': ['192.168.11.13', '85.255.23.45'],
        @note:                                         'status': 'ACTIVE',
        @note:                                         'mbsent': 49.6,
        @note:                                         'mbsentavg': 6.3,
        @note:                                         'mbreceived': 5.0,
        @note:                                         'mbreceivedavg': 300,
        @note:                                         'packetsreceived': 49.6,
        @note:                                         'packetsreceivedavg': 6.3,
        @note:                                         'packetssent': 5.0,
        @note:                                         'packetssentavg': 300,}],}
                                            'jobguid': "8D763680-ED8A-463F-AA25-EBF3EA7A1894"}

        @todo:                            Update comparing to OSIS monitoring
        @note:                            dictionary : {deviceid:{"macaddr":...,ipaddr:[ipaddr1,ipaddr2],status,mbSent,mbSentPerSecAvg,mbRec,mbRecPerSecAvg,noPacketsRecPerSec,noPacketsRecPerSecAvg,noPacketsSentPerSec,noPacketsSentPerSecAvg,errors...},...}
        
        """
        try:
            result = self._proxy.cloud_api_machinemonitoring.getPMachineNetworkInfo(
                pmachineguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 16
0
    def list (self, policyguid = "", name = "", rootobjectaction = "", rootobjecttype = "", status = "", jobguid = "", executionparams = {}):
        """
        
        Returns a list of all policies depending on passed filters.

        @execution_method = sync
        
        @param policyguid:                   Guid of the cloudspace
        @type policyguid:                    guid
        
        @param name:                         Name of the policy
        @type name:                          string
        
        @param rootobjectaction:             Action on the rootobject
        @type rootobjectaction:              string         
        
        @param rootobjecttype:               Rootobject type e.g. sso
        @type rootobjecttype:                string
        
        @param status:                       Status of the policy
        @type status:                        string        

        @param jobguid:                      guid of the job if avalailable else empty string
        @type jobguid:                       guid

        @param executionparams:              dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:               dictionary

        @return:                             dictionary with array of operating system info as result and jobguid: {'result': array, 'jobguid': guid}
        @rtype:                              dictionary
        @note:                               {'jobguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                'result: [{ 'name': 'Daily backup DBServer'
        @note:                                            'description': 'Daily backup of our database server',
        @note:                                            'rootobjecttype': 'machine',
        @note:                                            'rootobjectaction': 'backup',
        @note:                                            'policyparams': {},
        @note:                                            'rootobjectguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                            'interval': 86400,
        @note:                                            'lastrun': '2009-05-23 11:25:33',
        @note:                                            'runbetween': [("00:00", "02.00"), ("04:00", "06:00")],
        @note:                                            'runnotbetween': [("08:00", "12:00"), ("14:00", "18:00")]}]}
        
        @raise e:                            In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_policy.list(policyguid,name,rootobjectaction,rootobjecttype,status,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 17
0
    def find(self,
             name="",
             cabletype="",
             description="",
             label="",
             jobguid="",
             executionparams={}):
        """
        
        Returns a list of cable guids which met the find criteria.

        @execution_method = sync
        
        @security administrators
        @param name:                   Name for the cable.
        @type name:                    string

        @param description:            description of the cable
        @type description:             string

        @param cabletype:              cable type
        @type cabletype:               cabletype

        @param label:                  label attached to cable
        @type label:                   string(60)

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       Array of cable guids which met the find criteria specified.
        @rtype:                        array

        @note:                         Example return value:
        @note:                         {'result': '["FAD805F7-1F4E-4DB1-8902-F440A59270E6","C4395DA2-BE55-495A-A17E-6A25542CA398"]',
        @note:                          'jobguid':'5D2C0F39-F34E-4542-9B6F-B9233E80D803'}

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_cable.find(name, cabletype,
                                                      description, label,
                                                      jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 18
0
    def updateModelProperties(self,
                              cableguid,
                              name="",
                              cabletype="",
                              description="",
                              label="",
                              jobguid="",
                              executionparams={}):
        """
        
        Update basic properties (every parameter which is not passed or passed as empty string is not updated)

        @execution_method = sync
        
        @security administrators
        @param cableguid:              Guid of the cable specified
        @type cableguid:               guid

        @param name:                   Name for the cable.
        @type name:                    string

        @param description:            description of the cable
        @type description:             string

        @param cabletype:              cable type
        @type cabletype:               cabletype

        @param label:                  label attached to cable
        @type label:                   string(60)

        @param jobguid:                Guid of the job if avalailable else empty string
        @type jobguid:                 guid

        @param executionparams:        dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:         dictionary

        @return:                       dictionary with cable guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                        dictionary

        @raise e:                      In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_cable.updateModelProperties(
                cableguid, name, cabletype, description, label, jobguid,
                executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 19
0
 def copy (self, sourcevdcguid, destinationcloudspaceguid = "", copynetworkinfo = True, maintenancemode = False, autostart = True, jobguid = "", executionparams = {}):
     """
     
     See clone action but this case is copy instead of clone.
     
     @param executionparams:  dictionary of job specific params e.g. userErrormsg, maxduration ...
     @type executionparams:   dictionary
     
     
     """
     try:
         result = self._proxy.cloud_api_vdc.copy(sourcevdcguid,destinationcloudspaceguid,copynetworkinfo,maintenancemode,autostart,jobguid,executionparams)
         return result
     except Exception, ex:
         raise CloudApiException(ex)
Ejemplo n.º 20
0
    def addCapacityAvailable(self,
                             customerguid,
                             amount,
                             capacityunittype,
                             name="",
                             description="",
                             jobguid="",
                             executionparams={}):
        """
        
        Adds available capacity for the customer specified.

        @execution_method = sync
        
        @param customerguid:         Gui of the customer specified
        @type customerguid:          guid

        @param amount:               Amount of capacity units to add
        @type amount:                integer

        @param capacityunittype:     Type of capacity units to add. See capacityplanning.listCapacityUnitTypes()
        @type capacityunittype:      string

        @param name:                 Name of capacity units to add.
        @type name:                  string

        @param description:          Description of capacity units to add.
        @type type:                  string

        @param jobguid:              Guid of the job if avalailable else empty string
        @type jobguid:               guid

        @param executionparams:      dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:       dictionary

        @return:                     dictionary with True as result and jobguid: {'result': True, 'jobguid': guid}
        @rtype:                      dictionary

        @raise e:                    In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_customer.addCapacityAvailable(
                customerguid, amount, capacityunittype, name, description,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 21
0
    def find(self,
             name="",
             status="",
             disksafetytype="",
             storagesafety="",
             storagewidth="",
             jobguid="",
             executionparams={}):
        """
        
        Returns a list of dsspolicy guids which met the find criteria.

        @execution_method = sync
        
        @param name:                       Name of the dsspolicy
        @type name:                        string
        
        @param status:                     Status of the policy
        @type status:                      string
        
        @param disksafetytype:             Disksafety type of the policy (eg SSO,MIRRORCLOUD)
        @type disksafetytype:              string

        @param storagesafety:              Storage safety of the policy (nr of disks that can be lost without data loss)
        @type storagesafety:               int

        @param storagewidth:               Storage width of the policy (nr of disks that data is spread amongst)
        @type storagewidth:                int
        
        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with an array of policy guids as result and jobguid: {'result': array, 'jobguid': guid}
        @rtype:                            dictionary

        @raise e:                          In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_dsspolicy.find(
                name, status, disksafetytype, storagesafety, storagewidth,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
    def raiseErrorCondition(self,
                            level="",
                            typeid="",
                            errormessagepublic="",
                            errormessageprivate="",
                            tags="",
                            jobguid="",
                            executionparams={}):
        """
        
        Create a new errorcondition and escalate it

        @execution_method = sync

        @param level:                    level of errorcondition ('CRITICAL','ERROR','INFO','UNKNOWN','URGENT','WARNING')
        @type level:                     string
        
        @param typeid:                   predefined type id (ex. SSO-MON-NETWORK-0001)
        @type typeid:                    string

        @params errormessagepublic:      public error message
        @type errormessagepublic         string

        @params errormessageprivate:     private error message
        @type errormessageprivate        string

        @param tags:                     series of tags format
        @type tags:                      string

        @param jobguid:                  guid of the job if avalailable else empty string
        @type jobguid:                   guid

        @param executionparams:          dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:           dictionary

        @return:                         dictionary with backplaneguid as result and errorconditionguid: {'result': guid, 'errorconditionguid': guid}
        @rtype:                          dictionary

        @raise e:                        In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_errorcondition.raiseErrorCondition(
                level, typeid, errormessagepublic, errormessageprivate, tags,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 23
0
    def getPMachinePowerInfo(self,
                             pmachineguid,
                             jobguid="",
                             executionparams={}):
        """
        
        Return pmachine power monitoring information from PDU

          * Voltage
          * Current
          * CPU usage
          * Max current
          * Power
          * Power Factor
          * Consumption

        @execution_method = sync

        @param pmachineguid:               guid of the host machine for which to retrieve  the power info for
        @type pmachineguid:                guid

        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with a dictionary as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                            dictionary

        @note: {'jobguid': '301ce80a-b0cf-4a31-8be9-d89bd92efbe7',
        @note:  'result': {'voltage': '231',
        @note:             'current': '63',
        @note:             'cpuusage': '80',
        @note:             'maxcurrent': '53',
        @note:             'power': '5300',
        @note:             'powerfactor': '36',
        @note:             'consumption': '3600'}

        @raise e:                          In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_machinemonitoring.getPMachinePowerInfo(
                pmachineguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 24
0
    def listCapacity(self, customerguid, jobguid="", executionparams={}):
        """
        
        Returns a list of capacity units available and consumed for the given customer.
        
        @execution_method = sync
        
        @param customerguid:     Guid of the customer for which to retrieve the list of capacity units
        @type customerguid:      guid

        @param jobguid:          Guid of the job if avalailable else empty string
        @type jobguid:           guid

        @param executionparams:  dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:   dictionary

        @return:                 Dictionary of array of dictionaries with customerguid, login, email, firstname, lastname, array of available capacity, array of consumed capacity.
        @rtype:                  dictionary
        @note:                   Example return value:
        @note:                   {'result': '[{"customerguid": "22544B07-4129-47B1-8690-B92C0DB21434",
        @note:                                 "capacityavailable": "[{"amount": "1000",
        @note:                                                         "capacityunittype": "CU",
        @note:                                                         "name": "CPU"
        @note:                                                         "description": "CPU units"},
        @note:                                                        {"amount": "2000",
        @note:                                                         "capacityunittype": "MU",
        @note:                                                         "name": "Memory"
        @note:                                                         "description": "Memory units"}]"}]',
        @note:                                 "capacityconsumed": "[{"amount": "100",
        @note:                                                         "capacityunittype": "CU",
        @note:                                                         "name": "CPU"
        @note:                                                         "description": "CPU units"},
        @note:                                                        {"amount": "200",
        @note:                                                         "capacityunittype": "MU",
        @note:                                                         "name": "Memory"
        @note:                                                         "description": "Memory units"}]"}]',
        @note:                    'jobguid':'5D2C0F39-F34E-4542-9B6F-B9233E80D803'}

        @raise e:                In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_customer.listCapacity(
                customerguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 25
0
    def find(self,
             customerguid="",
             parentcloudspaceguid="",
             name="",
             status="",
             jobguid="",
             executionparams={}):
        """
        
        Returns a list of cloudspace guids which met the find criteria.

        @execution_method = sync
        
        @param customerguid:     		Guid of  the customer to include in the search criteria.
        @type customerguid:      		guid

        @param parentcloudspaceguid:    Guid of the parent cloudspace to include in the search criteria.
        @type parentcloudspaceguid:     guid

        @param name:    				Name of the cloudspace to include in the search criteria.
        @type name:     				string

        @param status:    				Status of the cloudspace to include in the search criteria. See listStatuses().
        @type status:     				string

        @param jobguid:    	        	Guid of the job if avalailable else empty string
        @type jobguid:     	        	guid

        @param executionparams:         dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:          dictionary

        @return:                        Array of cloudspaceguids which met the find criteria specified.
        @rtype:                         array
        @note:                          Example return value:
        @note:                          {'result': '["FAD805F7-1F4E-4DB1-8902-F440A59270E6","C4395DA2-BE55-495A-A17E-6A25542CA398"]',
        @note:                           'jobguid':'5D2C0F39-F34E-4542-9B6F-B9233E80D803'}

        @raise e:                       In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_cloudspace.find(
                customerguid, parentcloudspaceguid, name, status, jobguid,
                executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 26
0
    def list(self, locationguid="", jobguid="", executionparams={}):
        """
        
        List all locations.

        @execution_method = sync
        
        @param locationguid:            Guid of the location specified
        @type locationguid:             guid

        @security administrators
        @param jobguid:                 Guid of the job if avalailable else empty string
        @type jobguid:                  guid

        @param executionparams:         dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:          dictionary

        @return:                        dictionary with array of location info as result and jobguid: {'result': array, 'jobguid': guid}
        @rtype:                         dictionary

        @raise e:                       In case an error occurred, exception is raised

        @note:                          {'jobguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                          'result: [{ 'locationguid': '22544B07-4129-47B1-8690-B92C0DB21434',
        @note:                                      'name': 'LOCATION0001',
        @note:                                      'description': 'Location 0001',
        @note:                                      'alias': 'LOC-0001',
        @note:                                      'address': 'Antwerpsesteenweg 19',
        @note:                                      'city': 'Lochristi'
        @note:                                      'country': 'Belgium'
        @note:                                      'public': False},
        @note:                                    { 'locationguid': '1351F79F-D65A-4F65-A96B-AC4A6246C033',
        @note:                                      'name': 'LOCATION0001',
        @note:                                      'description': 'Location 0001',
        @note:                                      'alias': 'LOC-0001',
        @note:                                      'address': 'Antwerpsesteenweg 19',
        @note:                                      'city': 'Lochristi'
        @note:                                      'country': 'Belgium'
        @note:                                      'public': False}]}
        
        """
        try:
            result = self._proxy.cloud_api_location.list(
                locationguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 27
0
 def addPDisk(self,
              deviceguid,
              status,
              diskinterfacetype,
              deviceid="",
              size="",
              rpm="",
              jobguid="",
              executionparams={}):
     """
     
     Add pdisk to pdisks array of device
     
     @execution_method = sync
     
     @param deviceguid:          Guid of the device rootobject
     @type deviceguid:           guid
     
     @param status:              status of disk
     @type status:               devicediskstatustype
     
     @param diskinterfacetype:   interface type of pdisk
     @type diskinterfacetype:    diskinterfacetype
     
     @param deviceid:            id of the pdisk
     @type deviceid:             string
     
     @param size:                size of pdisk
     @type size:                 integer
     
     @param rpm:                 rpm of pdisk
     @type rpm:                  integer
   
     @return:                    dictionary with device guid as result and jobguid: {'result': deviceguid, 'jobguid': guid}
     @rtype:                     dictionary
     
     @raise e:                   In case an error occurred, exception is raised
     
     """
     try:
         result = self._proxy.cloud_api_device.addPDisk(
             deviceguid, status, diskinterfacetype, deviceid, size, rpm,
             jobguid, executionparams)
         return result
     except Exception, ex:
         raise CloudApiException(ex)
    def find(self,
             errorconditiontype="",
             timestamp="",
             level="",
             agent="",
             tags="",
             application="",
             jobguid="",
             executionparams={}):
        """
        
        @execution_method = sync

        @param errorconditiontype:       type of errorcondition
        @type errorconditiontype:        string

        @param timestamp:                timestamp of errorcondition
        @type timestamp:                 int

        @param level:                    level of errorcondition
        @type level:                     int

        @param agent:                    unique id of agent
        @type agent:                     string

        @param tags:                     series of tags format
        @type tags:                      string

        @param application:              name of the application
        @type application:               string

        @param jobguid:                  guid of the job if avalailable else empty string
        @type jobguid:                   guid

        @param executionparams:          dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:           dictionary
        @returns array of array [[...]]
        
        """
        try:
            result = self._proxy.cloud_api_errorcondition.find(
                errorconditiontype, timestamp, level, agent, tags, application,
                jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 29
0
    def updateModelProperties (self, languid, name = "", description = "", gateway = "", network = "", netmask = "", startip = "", endip = "", jobguid = "", executionparams = {}):
        """
        
        Update basic properties

        @param languid:                 Guid of the LAN to update.
        @type languid:                  guid

        @param name:                    Name of the lan.
        @type name:                     string

        @param description:             Description of the lan.
        @type description:              string

        @param gateway:                 Gateway of the lan.
        @type gateway:                  string

        @param network:                 Network of the lan.
        @type network:                  string

        @param netmask:                 Netmask of the lan.
        @type netmask:                  string

        @param startip:                 Startip of the lans to include in the search criteria.
        @type startip:                  string

        @param endip:                   Endip of the lans to include in the search criteria.
        @type endip:                    string

        @param jobguid:                 Guid of the job if available else empty string
        @type jobguid:                  guid

        @param executionparams:         dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:          dictionary

        @return:                        Dictionary with lan guid as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                         dictionary

        @raise e:                       In case an error occurred, exception is raised
        
        """
        try:
            result = self._proxy.cloud_api_lan.updateModelProperties(languid,name,description,gateway,network,netmask,startip,endip,jobguid,executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)
Ejemplo n.º 30
0
    def getPMachineProcesses(self,
                             pmachineguid,
                             jobguid="",
                             executionparams={}):
        """
        
        Returns array of processes running on pmachine and details of that process like cpu & memory used.

        @execution_method = sync

        If fake output fake values, can be handy for demo purposes
        - returns a realistic overview of processes running on a typical pmachine
        - support the 3 types: cpunode, stornode, mgmtappliance

        @param pmachineguid:               guid of the host machine for which to retieve  the virtual machines' load info for
        @type pmachineguid:                guid

        @param jobguid:                    guid of the job if available else empty string
        @type jobguid:                     guid

        @param executionparams:            dictionary of job specific params e.g. userErrormsg, maxduration ...
        @type executionparams:             dictionary

        @return:                           dictionary with a dictionary as result and jobguid: {'result': guid, 'jobguid': guid}
        @rtype:                            dictionary
        @note:                             {'result':
        @note:                                   {'machineguid': '7D763680-ED8A-463F-AA25-EBF3EA7A1894',
        @note:                                    'processes':
        @note:                                       [{'name': 'apache',
        @nota:                                         'pid': 5190,
        @note:                                         'parentpid': 1,
        @note:                                         'cpu': 63.1,
        @note:                                         'cpuavg': 49.6,
        @note:                                         'memory': 6.3,
        @note:                                         'memoryavg': 5.0,
        @note:                                         'memorypeak': 300,
        @note:                                         'memorypeakavg': 100}],
                                            'jobguid': "8D763680-ED8A-463F-AA25-EBF3EA7A1894"}
        
        """
        try:
            result = self._proxy.cloud_api_machinemonitoring.getPMachineProcesses(
                pmachineguid, jobguid, executionparams)
            return result
        except Exception, ex:
            raise CloudApiException(ex)