Enterprise Integration

 
 
 

ConVirt has an exhaustive setup of CLI as well as XML-RPC based APIs which can be used via python. Most of the common operations available via ConVirt UI are also available via CLI for use in automation.


Preparing ConVirt CLI package To use the command line interface, use the make-cli command to generate the cli tarball.

For example,

cd ~/convirt-enterprise
./make-cli

This will generate a convirt-cli.tar.gz tarball containing files required by the CLI. This now can be deployed on any machine on the network that can access the CMS via http.


Setting up ConVirt CLI

On the machine you want to do setup:

 mkdir cli
 copy the tarball generated in the previous step. 
 tar -xzf convirt-cli.tar.gz 
 

Now create a file required by convirt-cli that would contain the information to connect to CMS.

 Using your favorite editor create convirt-cli.conf containing following information pertaining to your environment.
 For example, /home/automation/convirt-cli.conf file. 
 cms_url=http://192.168.1.100:8091
 cms_username=Joe
 cms_password=r0cks

Make sure that the file is only readable by owner

 chmod go-rwx convirt-cli.conf
 

Using convirt-cli

To use the CLI from the shell, setup the following environment variables.

 export auth_type='FILE'
 export cms_config_filename=/home/automation/convirt-cli.conf
 ./convirt-cli list_server_pools

To see list of operations available,

 ./convirt-cli

To see syntax about particular operation,

./convirt-cli --help migrate_vm
Usage for migrate_vm
 (1) Short options: migrate_vm  -v <vm_name> -n <node_name> -N <dest_node_name> -w<waittime>
 (2) Long options : migrate_vm --vm_name <vm_name> --node <src_node_name> --destnode_name <dest_node_name> --wait <waittime>


API documentation

The ConVirt API allows you to invoke most features of ConVirt using programmatic API. For more details refer to Media:convirt-api.doc

ConVirt CLI Documentation

   Usage: convirt-cli operation parameters
          convirt cli --help operation
       CLI Setup Details:
           For CLI to work, the following information is required.
           * CMS url
           * CMS username
           * CMS pasword
           You can provide this information via  environment variables,
           from a file or command line.
           For using environment variables :
             export auth_type='ENV'
             export the cms_url,cms_username and cms_password...
           For using a file :
             export auth_type='FILE'
             and
             cms_config_filename='path to config file.'
             The file content should have ...
               cms_url=
               cms_username=
               cms_password=
           For using commandline:
             export auth_type='STDIN'
             and
             give username,password and url when prompted for.
           To login as  LDAP user , you need to provide the ldap_user
             parameter in addition to url,username and password.
             set ldap_user to True/False as required.
   Data Center operations:
       list_server_pools                          Lists all Server Pools
       add_server_pool                            Adds a Server Pool
   Server Pool operations:
       remove_server_pool                         Removes a Server Pool
       list_servers                               Lists all Managed Servers
       add_server                                 Adds a server
   Server operations:
       connect_server                             Connect to the Server
       edit_server                                Edits Server details
       remove_server                              Removes a Server
       kill_all_vms                               Kill all vms
       start_all_vms                              Start all vms
       shutdown_all_vms                           Shutdown all vms
       list_vms                                   Listing Virtual Machines
       transfer_node                              Transfering a node
       provision_vm                               Creates a vm
       import_vm                                  Imports a vmconfig to a Server
       change_server_password                     Changes Server password
   Virtual Machine operations:
       remove_vm                                  Deletes a vm
       migrate_vm                                 Migrates a vm
       start_vm                                   Starts a vm
       pause_vm                                   Pauses a vm
       resume_vm                                  Resumes a paused vm
       shutdown_vm                                Shuts a vm down
       kill_vm                                    Kills a vm
       edit_vm_settings                           Edit the memory and cpu of
                                                                virtual machine
       snapshot_vm                                Snapshots a virtual machine
   Template Library operations:
      add_template_group                          Adds a Template Group
      list_template_groups                        Lists Template Groups
      scan_for_templates                          Scan for new Templates in
                                                  default template store
                                                  location or given directory
      create_template                             Creates a new Template from
                                                                 disk reference
   Templategroup operations:
       remove_template_group                      Removes a Template Group
       rename_template_group                      Renames Template Group
       list_templates                             Lists all Templates
   Template operations:
       remove_template                            Removes a Template
       rename_template                            Renames a Template
       clone_template                             Creates a Similar Template
   Task:
       task_status                                Returns details of a Task
       cancel_task                                Cancels a running task
       cancel_backup                              Cancels a running backup policy
       
   Metrics operations:
       datacenter_summary_info                    Summary for Data Center
       serverpool_summary_info                    Summary for Server Pool
       server_summary_info                        Summary information for
                                                                        Server
       vm_summary_info                            Summary infromation for
                                                                Virtual Machine
       server_metric_info                         Metric information for server
       vm_metric_info                             Metric information for
                                                           virtual Machine
       get_vm_metrics                             The cpu /Memory Usage for
                                                           Virtual Machine
       get_server_metrics                         The cpu /Memory Usage for
                                                           Virtual Machine
   User Permissions:
      list_user_operations                        Lists permitted Operations
                                                               for the Entity
      has_permission                              Checks the user's Privilege
   User Model:
       list_users                                 Listing Users
       user_info                                  User Information
       add_user                                   Adds a User
       remove_user                                Deletes a Usergroup
       change_password                            Change Password
       list_groups                                List of Groups
       group_info                                 Group Information
       add_group                                  Adds a Usergroup
       remove_group                               Deletes a Group
       add_group_user                             Adds a  User to Group
       remove_group_user                          Delete a  User from Group
       assign_role                                Assign a Role to Group
       list_roles                                 The list of Roles
       add_role                                   Adds a Role
       remove_role                                Deletes a Role
       assign_entity_privilege                    Assign a Privilege for the Role on the Entity
       remove_entity_privilege                    Remove a Privilege for the Role on the Entity
       create_like_role                           Creates a Similar Role
       list_privileges                            List of Privileges
       add_privilege                              Add Privilege
       remove_privilege                           Deleting a Privilege
       list_operations                            List of Operations
       list_opgroups                              List of Operations Groups
       add_opgroup                                Add an Operations Group
       remove_opgroup                             Deletes an Operation Group
       add_operation                              Add an Operation to Operations Group
       remove_operation                           Delete an Operation from Operations Group
       create_like_opgroup                        Creates a similar Operations_Group
       assign_opgroup_privilege                   Assign a Privilege to the Operations Group
       remove_opgroup_privilege                   Removes the privilege of Operations Group
   High Availability:
       standby_servers                            List Standby servers for HA under a serverpool
       get_ha_details                             Detail whether HA or Not
       fencing_details                            The available fencing Configurations
       vm_priority                                The Virtual Machine priority
       enable_ha                                  Enable/Disable High Availability
   Storage Management:
   
       list_storages                              Lists defined storages        
       list_storage_disks                         Lists Storage Disks
       add_storage                                Add a new storage
       remove_storage                             Removes a storage
       add_storage_disk                           Adds a storage disk
       remove_storage_disk                        Removes a disk from a storage
       associate_storage_defns                    Associate storage definition to serverpool
       dissociate_storage_defns                   Remove storage form the serverpool
       mark_sorage_disk                           Define disk as allocated 
 Backup and Restore:
       list_backup_info                           Backup Informations associated with a Virtual Machine
       list_backups                               The policies defined with backup details
       backup_vm                                  Virtual Machine backup       
       restore_vm                                 Restores a Virtual Machine from a recent Backup
 Cache:
       list_cache_details                         List all cache details
 
Tem mais dúvidas? Submeter um pedido

Comentários

 
Adding comment, please wait....

Provide Feedback on Article:

Subject:
Comments:*
Powered by Zendesk