Added support for automatically mounting NFS storage as the home directory when creating new VMs with azlin new.
Added --nfs-storage option to:
azlin newcommandazlin vmcommand (alias)azlin createcommand (alias)
CLIOrchestrator Changes:
- Added
nfs_storageparameter to constructor - Added
_mount_nfs_storage()method to handle NFS mounting - Modified
run()workflow to:- Mount NFS storage after cloud-init completes
- Skip home directory sync when using NFS storage
- Mount NFS before GitHub setup
Workflow Logic:
VM Provisioning → Cloud-init → NFS Mount (if specified) → GitHub Setup → SSH Connect
OR
Home Dir Sync (if no NFS)
README.md Updates:
- Added NFS storage provisioning section
- Added usage examples showing multi-VM shared storage workflow
- Added to "Creating VMs" section examples
- Updated help text with NFS examples
# Create storage once
azlin storage create team-shared --size 100 --tier Premium
# Create VMs with shared home directory
azlin new --nfs-storage team-shared --name worker-1
azlin new --nfs-storage team-shared --name worker-2- VM is provisioned with standard tools
- After cloud-init completes, NFS client tools are installed
- Storage is mounted at
/home/azureuser - If there were files in
~/.azlin/home, they're copied to shared storage on first mount - All subsequent VMs mounting the same storage share the home directory
- Ease of Use: Single command to create VM with shared storage
- No Manual Steps: No need to run separate mount commands
- Automatic Backup: Existing home directory backed up before mounting
- Immediate Sharing: Files shared across all VMs instantly
- Clean Integration: Works seamlessly with existing features (GitHub clone, repos, etc.)
- Mount point:
/home/azureuser - NFS version: 4.1
- Options: Auto-configured by NFSMountManager
- Storage not found: Clear error message with creation instructions
- Mount failure: Exception raised with detailed error
- Automatic rollback on failure (handled by NFSMountManager)
- Storage is VNet-only (no public access)
- Uses existing Azure authentication
- SSH keys managed by azlin
Verified:
- ✓
--nfs-storageoption appears in help text - ✓ CLIOrchestrator accepts nfs_storage parameter
- ✓ Storage commands are available
- ✓ Main help includes storage commands section
- ✓ Python syntax is valid
- ✓ Ruff formatting applied
-
src/azlin/cli.py- Added
nfs_storageparameter tonew_command()and aliases - Added
nfs_storageto CLIOrchestrator__init__() - Added
_mount_nfs_storage()method - Modified VM provisioning workflow in
run() - Updated help text and examples
- Added
-
README.md- Added "Provisioning VMs with Shared Storage" section
- Updated "Creating VMs" section with NFS examples
- Enhanced shared storage documentation
commit 5bf50a3
feat: Add --nfs-storage option to azlin new command
- Add --nfs-storage option to 'azlin new' command and its aliases (vm, create)
- Automatically mount NFS storage as /home/azureuser during VM provisioning
- Skip home directory sync when using NFS storage (shared storage provides home)
- Mount storage after cloud-init completes but before GitHub setup
- Add _mount_nfs_storage method to CLIOrchestrator
- Update README with NFS storage provisioning examples
- Add usage examples showing multi-VM shared storage workflow
- Default Storage: Add config option for default storage account
- Storage Name Mapping: Allow friendly names for storage accounts
- Multiple Storage: Support multiple storage accounts per VM
- Auto-Creation: Offer to create storage if it doesn't exist
- Storage Templates: Pre-configured storage layouts
- Storage must be created before provisioning VMs
- Only supports one storage account per VM home directory
- Storage must be in the same resource group as VM
- Manual unmount required if switching between storage accounts
- User-facing: See README.md "Shared Storage" section
- Architecture: See AZURE_FILES_NFS_REQUIREMENTS.md
- Storage commands: Run
azlin storage --help - New command: Run
azlin new --help