Use the viocli inventory-admin command to compare the compute and block storage inventories against the vSphere inventory, discover and remove orphaned objects, and manage tenant virtual data centers.

Orphaned objects are defined as follows:

  • Orphaned Nova instances are those for which a corresponding virtual machine does not exist in vSphere.
  • Orphaned virtual machines are those for which a corresponding instance does not exist in the OpenStack database.
  • Orphaned shadow virtual machines are those for which a corresponding Cinder volume does not exist in the OpenStack database.

The viocli inventory-admin command collects vCenter Server and OpenStack credentials from internal inventories. This command requires that you authenticate as an OpenStack administrator. The domain and user name of this account are set in /root/cloudadmin.rc as the OS_PROJECT_DOMAIN_NAME, OS_USERNAME, and OS_USER_DOMAIN_NAME variables. You can also set the password for this account as the OS_PASSWORD environment variable to avoid entering this password every time you run the command.

The viocli inventory-admin command supports a variety of actions to perform different tasks. The following parameters apply to all actions.

Parameter Mandatory or Optional Description

-d NAME or --deployment NAME

Optional

Name of the deployment to use.

If you do not enter a value, the default deployment is used.

--json

--pretty

Optional

Displays output in JSON format or as formatted text.

If you do not enter a value, --pretty is used when the command is run interactively and --json is used when the command is run noninteractively.

--all

Optional

Shows all objects instead of only orphaned objects.

--force

Optional

Runs the command without prompting for confirmation.

--no-grace-period

Optional

Ignores the grace period when determining whether objects are orphaned. Objects modified in the past 30 minutes are included in the results only when this parameter is set.

--verbose

Optional

Displays output in verbose mode.

You can run viocli inventory-admin -h or viocli inventory-admin --help to display the parameters for the command. You can also use the -h or --help option on any action to display parameters for the action. For example, viocli inventory-admin show-instances -h will show parameters for the show-instances action.

The actions that viocli inventory-admin supports are listed as follows.

viocli inventory-admin show-instances [-d NAME] [--nova-state {ERROR | SHUTOFF} [--vc-state {poweredOn | poweredOff | suspended}]] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists orphaned Nova instances. You can also use the following additional parameters to list Nova instances that are in the specified state.

Parameter Mandatory or Optional Description

--nova-state {ERROR | SHUTOFF}

Optional

Displays Nova instances in the ERROR or SHUTOFF state.

Orphaned and non-orphaned instances are all displayed regardless of the --all parameter.

--vc-state {poweredOn | poweredOff | suspended}

Optional

Displays Nova instances in the specified state that are powered on, powered off, or suspended in vCenter Server.

If you use this parameter, you must also include the --nova-state parameter.

Orphaned and non-orphaned instances are all displayed regardless of the --all parameter.

 

viocli inventory-admin show-instance-vms [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists orphaned vSphere virtual machines.

 

viocli inventory-admin show-shadow-vms [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists orphaned shadow virtual machines.

 

viocli inventory-admin clean-instances [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Removes orphaned vSphere virtual machines.

 

viocli inventory-admin clean-instance-vms [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Removes orphaned vSphere virtual machines.

 

viocli inventory-admin clean-shadow-vms [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Removes orphaned shadow virtual machines.

 

viocli inventory-admin reset-instances-state [-d NAME] --nova-state {ERROR | SHUTOFF} --vc-state poweredOn [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Resets instances in the ERROR or SHUTOFF state that are powered on in vCenter Server.

Parameter Mandatory or Optional Description

--nova-state {ERROR | SHUTOFF} --vc-state poweredOn

Mandatory

Resets Nova instances in the ERROR or SHUTOFF state that are powered on in vCenter Server.

 

viocli inventory-admin show-hypervisors [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists hypervisors with detailed information.

 

viocli inventory-admin show-availability-zones [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists availability zones and the hosts located in them.

 

viocli inventory-admin sync-availability-zones [-d NAME] [--filename ZONE-MAP] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Synchronizes the availability zones in the environment with the specified map. The following additional parameters are supported.

Parameter Mandatory or Optional Description

--filename ZONE-MAP

Optional

Path to the file containing the availability zone map. The file must be in JSON format.

 

viocli inventory-admin create-tenant-vdc [-d NAME] --compute COMPUTE-NODE --name VDC-NAME --project-id ID [--cpu-reserve CPU-MIN] [--cpu-limit CPU-MAX] [--mem-reserve MEMORY-MIN] [--mem-limit MEMORY-MAX] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Create a tenant virtual data center (VDC) with the specified settings. The following additional parameters are supported.

Parameter Mandatory or Optional Description

--compute COMPUTE-NODE

Mandatory

Compute node on which to create the VDC.

--name VDC-NAME

Mandatory

Name of the tenant VDC.

--project-id ID

Mandatory

Project ID for the task.

--cpu-reserve CPU-MIN

Optional

CPU cycles in MHz to reserve for the VDC.

If you do not enter a value, 0 is used by default.

--cpu-limit CPU-MAX

Optional

Maximum limit for CPU usage on the VDC (in MHz).

If you do not enter a value, CPU usage is not limited.

--mem-reserve MEMORY-MIN

Optional

Memory in megabytes to reserve for the VDC.

If you do not enter a value, 0 is used by default.

--mem-limit MEMORY-MAX

Optional

Maximum limit for memory consumption on the VDC (in megabytes).

If you do not enter a value, memory consumption is not limited.

 

viocli inventory-admin list-tenant-vdcs [-d NAME] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Lists tenant VDCs.

 

viocli inventory-admin show-tenant-vdc [-d NAME] --id ID [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Displays detailed information about the specified tenant VDC. The following additional parameters are supported.

Parameter Mandatory or Optional Description

--id ID

Mandatory

Identifier of a tenant VDC.

 

viocli inventory-admin delete-tenant-vdc [-d NAME] --id ID [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Deletes the specified tenant VDC. The following additional parameters are supported.

Parameter Mandatory or Optional Description

--id ID

Mandatory

Identifier of a tenant VDC.

--compute COMPUTE-NODE

Optional

Compute node from which to delete the VDC.

If you do not enter a value, the VDC is deleted from all compute nodes.

 

viocli inventory-admin update-tenant-vdc [-d NAME] --compute COMPUTE-NODE --name VDC-NAME --project-id ID [--cpu-reserve CPU-MIN] [--cpu-limit CPU-MAX] [--mem-reserve MEMORY-MIN] [--mem-limit MEMORY-MAX] [--json | --pretty] [--all] [--force] [--no-grace-period] [--verbose]

Updates the configuration of the specified tenant VDC. The following additional parameters are supported.

Parameter Mandatory or Optional Description

--compute COMPUTE-NODE

Mandatory

Compute node on which the VDC is running.

--id VDC-ID

Mandatory

Identifier of the tenant VDC.

--cpu-reserve CPU-MIN

Optional

CPU cycles in MHz to reserve for the VDC.

--cpu-limit CPU-MAX

Optional

Maximum limit for CPU usage on the VDC (in MHz).

The value -1 indicates that CPU usage is not limited.

--mem-reserve MEMORY-MIN

Optional

Memory in megabytes to reserve for the VDC.

--mem-limit MEMORY-MAX

Optional

Maximum limit for memory consumption on the VDC (in megabytes).

The value -1 indicates that memory usage is not limited.