<commit_before>---
title: CLI
category: cli
authors: j.bittner, jfenal, mgoldboi, <NAME>, val0x00ff
wiki_category: CLI
wiki_title: CLI
wiki_revision_count: 83
wiki_last_updated: 2014-03-24
---

# CLI

oVirt CLI package is a command line interface for the oVirt engine.

[Notes from workshop in November 2011](API - oVirt workshop November 2011 Notes).

__TOC__

## Concepts

*   Interactive prompt
*   Smart auto-completion
*   Smart help
*   Generic interface (list, show, add, update, action verbs).
*   Self descriptive.

## Usage

### Help

#### syntax

*   note help is dynamically created for each command respectively

       help
       
       or
       
       help `<command>` [arguments] [options]

### Auto-Completion

#### available commands

`   [oVirt shell (connected)]# `<TAB><TAB>
         EOF         clear       console     remove      echo        help        ping        show        update      
         action      connect     add      disconnect  exit        list        shell       status 

#### available options for specific command

`   [oVirt shell (connected)]# add `<TAB><TAB>
         cdrom          datacenter     group          network        permission     role           storagedomain  template       vm             
         cluster        disk           host           nic            permit         snapshot       tag            user           vmpool

#### available options for command on specific resource

`   [oVirt shell (connected)]# add vm `<TAB><TAB>
         cluster-id                               display-type                             os-boot-dev                              template-id
         cluster-name                             domain-name                              os-cmdline                               template-name
         cpu-topology-cores                       high_availability-enabled                os-initRd                                timezone
         cpu-topology-sockets                     high_availability-priority               os-kernel                                type
         custom_properties-custom_property        memory                                   os-type                                  usb-enabled
         description                              name                                     placement_policy-affinity                
         display-monitors                         origin                                   stateless

#### available options for command on specific sub-resource

         [oVirt shell (connected)]# add nic --vm-identifier xxx `<TAB><TAB>` 
         interface     mac-address   name          network-id    network-name

*   note typing beginning of the option name and then hitting <TAB>, will convert

option to appropriate option format adding prefix or suffix.

### Connect

#### get help for connect

      [mpastern@ovirt-engine-cli (master)]$ ovirt-shell --help
       
      Usage: ovirt-shell [options]
             ovirt-shell [options] command...
      This program is a command-line interface to oVirt Virtualization.
      Options:
       -h, --help            show this help message and exit
       -l URL, --url=URL     specifies the API entry point URL
                             (http[s]://server[:port]/api)
       -u USERNAME, --username=USERNAME
                             connect as this user
       -K KEY_FILE, --key-file=KEY_FILE
                             specify client PEM key-file
       -C CERT_FILE, --cert-file=CERT_FILE
                             specify client PEM cert-file
       -A CA_FILE, --ca-file=CA_FILE
                             specify server CA cert-file
       -I, --insecure        allow connecting to SSL sites without certificates
       -F, --filter          enables user permission based filtering
       -P PORT, --port=PORT  specify port
       -T TIMEOUT, --timeout=TIMEOUT
                             specify timeout
       -c, --connect         automatically connect
       -f FILE, --file=FILE  read commands from FILE instead of stdin

#### connect from ovirt-shell

       [mpastern@ovirt-engine-cli (master)]$ ovirt-shell
        
        ++++++++++++++++++++++++++++++++++++++++++
        
                  Welcome to oVirt shell
        
        ++++++++++++++++++++++++++++++++++++++++++
       
       [oVirt shell (disconnected)]# connect --url "`[`http://server:8080/api`](http://server:8080/api)`" --user "user@domain" --password 'password'
       
       ==========================================
       >>> connected to oVirt manager 3.2.0.0 <<<
       ==========================================
       
       [oVirt shell (connected)]# 
       

#### connect from linux shell

##### configuration file based login

       1. vi ~/.ovirtshellrc
       
       2. set args:
          [ovirt-shell]
          username = "user@domain"
          url = "http[s]://server[:port]/api"
          #insecure = False
          #filter = False
          #timeout = -1
          password = ******
          
          * NOTE: if url/username/password is not configured/commented in .ovirtshellrc
                  and ovirt-shell executed in auto-connect mode (ovirt-shell -c/--connect), 
                  you will be prompted to specify it upon login
          
       3. run ovirt-shell 
          
          [mpastern@ovirt-engine-cli (master)]$ ovirt-shell -c
           
           ==========================================
           >>> connected to oVirt manager 3.2.0.0 <<<
           ==========================================
           ++++++++++++++++++++++++++++++++++++++++++
           
                     Welcome to oVirt shell
           
           ++++++++++++++++++++++++++++++++++++++++++
          [oVirt shell (connected)]# 
         

##### cli options based login

       ovirt-shell -c -l "`[`http://server:8080/api`](http://server:8080/api)`" -u "user@domain"
       Password: ****
       ==========================================
       >>> connected to oVirt manager 3.1.0.0 <<<
       ==========================================
              
       ++++++++++++++++++++++++++++++++++++++++++
       
                 Welcome to oVirt shell
       
       ++++++++++++++++++++++++++++++++++++++++++
               
           
       [oVirt shell (connected)]# <commit_msg>Updated CLI<commit_after>---
title: CLI
category: cli
authors: j.bittner, jfenal, mgoldboi, <NAME>, val0x00ff
wiki_category: CLI
wiki_title: CLI
wiki_revision_count: 83
wiki_last_updated: 2014-03-24
---

# CLI

oVirt CLI package is a command line interface for the oVirt engine.

[Notes from workshop in November 2011](API - oVirt workshop November 2011 Notes).

__TOC__

## Concepts

*   Interactive prompt
*   Smart auto-completion
*   Smart help
*   Generic interface (list, show, add, update, action verbs).
*   Self descriptive.

## Usage

### Help

#### syntax

*   note help is dynamically created for each command respectively

       help
       
       or
       
       help `<command>` [arguments] [options]

### Auto-Completion

#### available commands

`   [oVirt shell (connected)]# `<TAB><TAB>
         EOF         clear       console     remove      echo        help        ping        show        update      
         action      connect     add      disconnect  exit        list        shell       status 

#### available options for specific command

`   [oVirt shell (connected)]# add `<TAB><TAB>
         cdrom          datacenter     group          network        permission     role           storagedomain  template       vm             
         cluster        disk           host           nic            permit         snapshot       tag            user           vmpool

#### available options for command on specific resource

`   [oVirt shell (connected)]# add vm `<TAB><TAB>
         cluster-id                               display-type                             os-boot-dev                              template-id
         cluster-name                             domain-name                              os-cmdline                               template-name
         cpu-topology-cores                       high_availability-enabled                os-initRd                                timezone
         cpu-topology-sockets                     high_availability-priority               os-kernel                                type
         custom_properties-custom_property        memory                                   os-type                                  usb-enabled
         description                              name                                     placement_policy-affinity                
         display-monitors                         origin                                   stateless

#### available options for command on specific sub-resource

         [oVirt shell (connected)]# add nic --vm-identifier xxx `<TAB><TAB>` 
         interface     mac-address   name          network-id    network-name

*   note typing beginning of the option name and then hitting <TAB>, will convert

option to appropriate option format adding prefix or suffix.

### Connect

#### get help for connect

      [mpastern@ovirt-engine-cli (master)]$ ovirt-shell --help
       
      Usage: ovirt-shell [options]
             ovirt-shell [options] command...
      This program is a command-line interface to oVirt Virtualization.
      Options:
       -h, --help            show this help message and exit
       -l URL, --url=URL     specifies the API entry point URL
                             (http[s]://server[:port]/api)
       -u USERNAME, --username=USERNAME
                             connect as this user
       -K KEY_FILE, --key-file=KEY_FILE
                             specify client PEM key-file
       -C CERT_FILE, --cert-file=CERT_FILE
                             specify client PEM cert-file
       -A CA_FILE, --ca-file=CA_FILE
                             specify server CA cert-file
       -I, --insecure        allow connecting to SSL sites without certificates
       -F, --filter          enables user permission based filtering
       -P PORT, --port=PORT  specify port
       -T TIMEOUT, --timeout=TIMEOUT
                             specify timeout
       -c, --connect         automatically connect
       -f FILE, --file=FILE  read commands from FILE instead of stdin

#### connect from ovirt-shell

       [mpastern@ovirt-engine-cli (master)]$ ovirt-shell
        
        ++++++++++++++++++++++++++++++++++++++++++
        
                  Welcome to oVirt shell
        
        ++++++++++++++++++++++++++++++++++++++++++
       
       [oVirt shell (disconnected)]# connect --url "`[`http://server:8080/api`](http://server:8080/api)`" --user "user@domain" --password 'password'
       
       ==========================================
       >>> connected to oVirt manager 3.2.0.0 <<<
       ==========================================
       
       [oVirt shell (connected)]# 
       

#### connect from linux shell

##### configuration file based login

       1. vi ~/.ovirtshellrc
       
       2. set args:
          [ovirt-shell]
          username = "<EMAIL>"
          url = "http[s]://server[:port]/api"
          #insecure = False
          #filter = False
          #timeout = -1
          password = ******
          
          * NOTE: if url/username/password is not configured/commented in .ovirtshellrc
                  and ovirt-shell executed in auto-connect mode (ovirt-shell -c/--connect), 
                  you will be prompted to specify it upon login
          
       3. run ovirt-shell 
          
          [mpastern@ovirt-engine-cli (master)]$ ovirt-shell -c
           
           ==========================================
           >>> connected to oVirt manager 3.2.0.0 <<<
           ==========================================
           ++++++++++++++++++++++++++++++++++++++++++
           
                     Welcome to oVirt shell
           
           ++++++++++++++++++++++++++++++++++++++++++
          [oVirt shell (connected)]# 
         

##### cli options based login

       [mpastern@ovirt-engine-cli (master)]$ ovirt-shell -c -l "`[`http://server:8080/api`](http://server:8080/api)`" -u "user@domain"
       Password: ****
       ==========================================
       >>> connected to oVirt manager 3.1.0.0 <<<
       ==========================================
              
       ++++++++++++++++++++++++++++++++++++++++++
       
                 Welcome to oVirt shell
       
       ++++++++++++++++++++++++++++++++++++++++++
               
           
       [oVirt shell (connected)]# 
{'fraction_non_alphanumeric': 0.15504181789490296, 'fraction_numerical': 0.008363578980590185, 'mean_word_length': 1.4611650485436893, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5287980', 'n_tokens_mistral': 4369, 'n_tokens_neox': 3659, 'n_words': 891}