Nutanix Storage Container Management via ncli

Introduction

Storage containers are a foundational part of Nutanix architecture, defining policy boundaries for deduplication, compression, and performance tiers. With ncli, you can automate the creation, resizing, and deletion of containers to match lifecycle events, DR plans, or capacity upgrades. This guide shows how to script it all with Bash.


My Personal Repository on GitHub

Nutanix Repository on GitHub


Diagram: Container Management Flow


Script 1: Create a Storage Container

#!/usr/bin/env bash
set -euo pipefail

container_name="prod-container"
storage_pool="default-storage-pool"

echo "Creating container: $container_name"
ncli container create name="$container_name" sp-name="$storage_pool" compression-enabled=true deduplication-enabled=false

Script 2: Modify a Container (e.g., enable deduplication)

ncli container edit name="prod-container" compression-enabled=true deduplication-enabled=true

Script 3: Delete a Container

ncli container rm name="test-container"

Warning: Only delete containers not in use or mapped to VMs.


Example Bash Tool: container_lifecycle.sh

#!/usr/bin/env bash
set -euo pipefail

case "$1" in
create)
ncli container create name="$2" sp-name="$3" compression-enabled=true
;;
edit)
ncli container edit name="$2" deduplication-enabled=true
;;
delete)
ncli container rm name="$2"
;;
*)
echo "Usage: $0 {create|edit|delete} container_name [storage_pool]"
exit 1
;;
esac

Logging and Cron Example

Add logs for auditing:

./container_lifecycle.sh create report-container default-pool >> /var/log/nutanix_storage.log 2>&1

Schedule regular audits or policy checks via cron:

30 4 * * 0 /usr/local/bin/container_lifecycle.sh audit

Summary

Automating storage container management in Nutanix allows for policy consistency, faster provisioning, and smoother storage scaling. Use ncli to ensure storage automation aligns with infrastructure goals and operations cadence.

External Documentation:

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading