initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Exercise 6: Failover Testing
|
||||
|
||||
## Overview
|
||||
In this exercise, you'll learn how to perform and manage failover tests for your VPGs. You'll understand the testing process and how to monitor test status.
|
||||
|
||||
## Objectives
|
||||
- Initiate failover tests
|
||||
- Monitor test status
|
||||
- Stop running tests
|
||||
- Handle test results
|
||||
|
||||
## Time
|
||||
10 minutes
|
||||
|
||||
## Prerequisites
|
||||
- Completed Exercise 5
|
||||
- Working VPG
|
||||
- Access to test resources
|
||||
|
||||
## Exercise Steps
|
||||
1. Select a VPG for testing
|
||||
2. Initiate a failover test
|
||||
3. Monitor test progress
|
||||
4. Stop the test
|
||||
5. Review test results
|
||||
|
||||
## Working Directory
|
||||
The `working` directory contains:
|
||||
- `failover.py` - Template to complete
|
||||
|
||||
## Solution
|
||||
The `solution` directory contains:
|
||||
- `failover.py` - Complete working example
|
||||
|
||||
## Key Concepts
|
||||
- Failover testing
|
||||
- Test monitoring
|
||||
- Test management
|
||||
- Status tracking
|
||||
|
||||
## Common Issues
|
||||
- Test initiation failures
|
||||
- Resource conflicts
|
||||
- Test timeout
|
||||
- Cleanup issues
|
||||
|
||||
## Next Steps
|
||||
Proceed to Exercise 7: Bulk Operations to learn about managing multiple VMs.
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Exercise 6: Failover Testing
|
||||
This script demonstrates how to perform and manage failover tests.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Add the parent directory to the Python path to import the SDK
|
||||
sys.path.append(str(Path(__file__).parent.parent.parent.parent))
|
||||
|
||||
# Import the SDK modules
|
||||
from zvml import ZertoClient
|
||||
from zvml.vpgs import VPG
|
||||
from zvml.common import ZertoVPGError
|
||||
|
||||
# Import configuration
|
||||
try:
|
||||
from prerequisites.config import (
|
||||
ZVM_HOST,
|
||||
ZVM_PORT,
|
||||
ZVM_SSL_VERIFY,
|
||||
KEYCLOAK_SERVER_URL,
|
||||
KEYCLOAK_REALM,
|
||||
CLIENT_ID,
|
||||
CLIENT_SECRET
|
||||
)
|
||||
except ImportError:
|
||||
print("Error: Please copy config.example.py to config.py and update with your values")
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
"""
|
||||
Main function to demonstrate failover testing.
|
||||
"""
|
||||
# Step 1: Create and authenticate ZertoClient
|
||||
# TODO: Initialize ZertoClient and authenticate
|
||||
# Hint: Reuse the authentication code from previous exercises
|
||||
|
||||
# Step 2: Get the VPG
|
||||
# TODO: Find and get the VPG you want to test
|
||||
# Hint: Use client.vpgs.list() and client.vpgs.get()
|
||||
|
||||
# Step 3: Initiate failover test
|
||||
# TODO: Start a failover test for the VPG
|
||||
# Required steps:
|
||||
# - Configure test settings
|
||||
# - Start the test
|
||||
# Hint: Use vpg.start_test() method
|
||||
|
||||
# Step 4: Monitor test progress
|
||||
# TODO: Monitor the test status until completion
|
||||
# Required steps:
|
||||
# - Get test status
|
||||
# - Check for completion
|
||||
# - Handle any errors
|
||||
# Hint: Use vpg.get_test_status() method
|
||||
|
||||
# Step 5: Stop the test
|
||||
# TODO: Stop the running test
|
||||
# Hint: Use vpg.stop_test() method
|
||||
|
||||
# Step 6: Clean up
|
||||
# TODO: Ensure proper cleanup after the test
|
||||
# Hint: Check if any cleanup is needed
|
||||
|
||||
# Step 7: Handle errors
|
||||
# TODO: Add error handling for test operations
|
||||
# Hint: Use try/except blocks for ZertoVPGError
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user