Using the command-line interface

To manage Virtuozzo Hybrid Infrastructure from console and automate such management tasks, you can use the vinfra command-line tool. To get a list of all the supported commands and their descriptions, run vinfra help. For help on a specific command, either run vinfra help <command> or vinfra <command> --help.

Note that the following operations should not be done from the command line:

  • Setting custom paths for Virtuozzo Hybrid Infrastructure services, in particular:
    • Creating S3 clusters only in /mnt/vstorage/vols/s3
    • Creating iSCSI targets only in /mnt/vstorage/vols/iscsi
  • Mounting clusters or change cluster mount options
  • Configuring firewall with firewall-cmd
  • Renaming network connections
  • Managing metadata and storage services
  • Managing partitions, LVMs, or software RAID
  • Modifying files in /mnt/vstorage/vols and /mnt/vstorage/webcp/backup directories
  • Setting encoding or replication of cluster root

Providing credentials to vinfra

The vinfra tool requires the following information:

  • IP address or hostname of the management node (set to backend-api.svc.vstoragedomain by default)
  • User name (admin by default)
  • Password (created during installation of Virtuozzo Hybrid Infrastructure)
  • Domain name to authenticate with (Default by default)
  • Project ID to authenticate with (admin by default)

This information can be supplied by using the following command-line parameters with each command:

  • --vinfra-portal <portal>
  • --vinfra-username <username>
  • --vinfra-password <password>
  • --vinfra-domain <domain>
  • --vinfra-project <project>

Alternatively, you can supply custom credentials by setting the following environment variables (for example, in your ~/.bash_profile): VINFRA_PORTAL, VINFRA_USERNAME, VINFRA_PASSWORD, VINFRA_DOMAIN, and VINFRA_PROJECT. In this case, you will be able to run the CLI tool without the aforementioned command-line parameters.

As you typically run vinfra from the management node as admin, the only variable you usually need to set is the password. For example:

# export VINFRA_PASSWORD=12345

If you installed vinfra on a remote machine and/or run it as a different system administartor, you will need to set VINFRA_PORTAL and/or VINFRA_USERNAME on that machine in addition to VINFRA_PASSWORD.

In addition, if you want to authenticate within a different project or/and domain, you will need to set two more environment variables: VINFRA_PROJECT and/or VINFRA_DOMAIN.

Managing vinfra tasks

The vinfra tool executes some commands immediately, while for other commands (that may take some time to complete) it creates system tasks that are queued. Examples of actions performed via tasks are creating the storage or compute cluster and adding nodes to it.

To keep track of tasks performed by vinfra, use the vinfra task list and vinfra task show commands. For example:

# vinfra task list
| task_id        | state   | name                                    |
| 8fc27e7a-<...> | success | backend.tasks.cluster.CreateNewCluster  |
| e61377db-<...> | success | backend.tasks.disks.ApplyDiskRoleTask   |
| a005b748-<...> | success | backend.tasks.node.AddNodeInClusterTask |
# vinfra task show 8fc27e7a-ba73-471d-9134-e351e1137cf4
| Field   | Value                                  |
| args    | - stor1                                |
|         | - 7ffa9540-5a20-41d1-b203-e3f349d62565 |
|         | - null                                 |
|         | - null                                 |
| kwargs  | {}                                     |
| name    | backend.tasks.cluster.CreateNewCluster |
| result  | cluster_id: 1                          |
| state   | success                                |
| task_id | 8fc27e7a-ba73-471d-9134-e351e1137cf4   |