changed logging order
This commit is contained in:
@@ -35,13 +35,18 @@ Example Usage:
|
|||||||
--client_secret "your-secret-here" \
|
--client_secret "your-secret-here" \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -57,8 +62,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
client = ZVMLClient(
|
client = ZVMLClient(
|
||||||
|
|||||||
@@ -36,12 +36,17 @@ Example Usage:
|
|||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -57,12 +62,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -5,12 +5,18 @@
|
|||||||
# The author and Zerto further disclaim all implied warranties including, without limitation,
|
# The author and Zerto further disclaim all implied warranties including, without limitation,
|
||||||
# any implied warranties of merchantability or of fitness for a particular purpose.
|
# any implied warranties of merchantability or of fitness for a particular purpose.
|
||||||
|
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import paramiko
|
import paramiko
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
from zvml.client import Client
|
from zvml.client import Client
|
||||||
from zvml.encryptiondetection import EncryptionDetection
|
from zvml.encryptiondetection import EncryptionDetection
|
||||||
@@ -77,12 +83,6 @@ def main():
|
|||||||
parser.add_argument("--vm_password", required=True, help="Linux VM password")
|
parser.add_argument("--vm_password", required=True, help="Linux VM password")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Setup client
|
# Setup client
|
||||||
client = setup_client(args)
|
client = setup_client(args)
|
||||||
|
|||||||
@@ -38,13 +38,18 @@ Example Usage:
|
|||||||
--client_secret <client_secret> \
|
--client_secret <client_secret> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -61,12 +66,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
# Legal Disclaimer
|
||||||
|
# This script is an example script and is not supported under any Zerto support program or service.
|
||||||
|
# The author and Zerto further disclaim all implied warranties including, without limitation,
|
||||||
|
# any implied warranties of merchantability or of fitness for a particular purpose.
|
||||||
|
# In no event shall Zerto, its authors or anyone else involved in the creation,
|
||||||
|
# production or delivery of the scripts be liable for any damages whatsoever (including,
|
||||||
|
# without limitation, damages for loss of business profits, business interruption, loss of business
|
||||||
|
# information, or other pecuniary loss) arising out of the use of or the inability to use the sample
|
||||||
|
# scripts or documentation, even if the author or Zerto has been advised of the possibility of such damages.
|
||||||
|
# The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
|
||||||
|
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -38,13 +38,18 @@ Example Usage:
|
|||||||
--license_key <license_key> \
|
--license_key <license_key> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -61,12 +66,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -40,13 +40,17 @@ Example Usage:
|
|||||||
--client_secret <client_secret> \
|
--client_secret <client_secret> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -62,12 +66,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -43,13 +43,17 @@ Example Usage:
|
|||||||
--site2_client_secret <secret2> \
|
--site2_client_secret <secret2> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
@@ -69,12 +73,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Initialize the site 1 client
|
# Initialize the site 1 client
|
||||||
site1_client = ZVMLClient(
|
site1_client = ZVMLClient(
|
||||||
|
|||||||
@@ -37,13 +37,17 @@ Example Usage:
|
|||||||
--client_secret <client_secret> \
|
--client_secret <client_secret> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
from zvml.server_date_time import DateTimeFormat
|
from zvml.server_date_time import DateTimeFormat
|
||||||
@@ -59,12 +63,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -42,11 +42,16 @@ Example Usage:
|
|||||||
--site_identifier <site_id> \
|
--site_identifier <site_id> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import urllib3
|
import urllib3
|
||||||
@@ -65,12 +70,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -40,8 +40,13 @@ Example Usage:
|
|||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
# Configure logging BEFORE any imports
|
||||||
import logging
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
@@ -135,12 +140,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Setup client
|
# Setup client
|
||||||
client = setup_client(args)
|
client = setup_client(args)
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ Example Usage:
|
|||||||
--client_secret <client_secret> \
|
--client_secret <client_secret> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
import argparse
|
|
||||||
import logging
|
import logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
)
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -44,13 +44,16 @@ Example Usage:
|
|||||||
--client_secret <client_secret> \
|
--client_secret <client_secret> \
|
||||||
--ignore_ssl
|
--ignore_ssl
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -66,12 +69,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Initialize the client
|
# Initialize the client
|
||||||
client = ZVMLClient(
|
client = ZVMLClient(
|
||||||
|
|||||||
@@ -56,13 +56,17 @@ Note: VM restore functionality is commented out in this example as it may return
|
|||||||
# NOTE
|
# NOTE
|
||||||
# this example assumes that at least one VPG exists on the ZVM and protected VMs exist in the VPG
|
# this example assumes that at least one VPG exists on the ZVM and protected VMs exist in the VPG
|
||||||
# the vm restore is commnted out as it fails with a 500
|
# the vm restore is commnted out as it fails with a 500
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -79,12 +83,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -46,14 +46,17 @@ Example Usage:
|
|||||||
Note: This script focuses on volume operations and requires only Site 1 credentials
|
Note: This script focuses on volume operations and requires only Site 1 credentials
|
||||||
since it performs read-only operations on the protected site.
|
since it performs read-only operations on the protected site.
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
|
|
||||||
@@ -68,9 +71,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Initialize the client
|
# Initialize the client
|
||||||
client = ZVMLClient(args.zvm_address, args.client_id, args.client_secret, not args.ignore_ssl)
|
client = ZVMLClient(args.zvm_address, args.client_id, args.client_secret, not args.ignore_ssl)
|
||||||
|
|||||||
@@ -69,13 +69,17 @@ Script Flow:
|
|||||||
8. Generates test reports
|
8. Generates test reports
|
||||||
9. Cleans up by deleting both VPGs
|
9. Cleans up by deleting both VPGs
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -223,8 +227,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vpg_structure = [
|
vpg_structure = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,12 +71,13 @@ Note: This script requires only protected site credentials. It's designed for VP
|
|||||||
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
|
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
|
||||||
with identical settings after changes or in disaster recovery situations.
|
with identical settings after changes or in disaster recovery situations.
|
||||||
"""
|
"""
|
||||||
import argparse
|
# Configure logging BEFORE any imports
|
||||||
import logging
|
import logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.INFO,
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
)
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -69,12 +69,13 @@ Note: This script requires only protected site credentials. It's designed for VP
|
|||||||
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
|
configuration backup and restore scenarios, allowing you to quickly recreate VPGs
|
||||||
with identical settings after changes or in disaster recovery situations.
|
with identical settings after changes or in disaster recovery situations.
|
||||||
"""
|
"""
|
||||||
import argparse
|
# Configure logging BEFORE any imports
|
||||||
import logging
|
import logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
)
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
import argparse
|
# Legal Disclaimer
|
||||||
|
# This script is an example script and is not supported under any Zerto support program or service.
|
||||||
|
# The author and Zerto further disclaim all implied warranties including, without limitation,
|
||||||
|
# any implied warranties of merchantability or of fitness for a particular purpose.
|
||||||
|
# In no event shall Zerto, its authors or anyone else involved in the creation,
|
||||||
|
# production or delivery of the scripts be liable for any damages whatsoever (including,
|
||||||
|
# without limitation, damages for loss of business profits, business interruption, loss of business
|
||||||
|
# information, or other pecuniary loss) arising out of the use of or the inability to use the sample
|
||||||
|
# scripts or documentation, even if the author or Zerto has been advised of the possibility of such damages.
|
||||||
|
# The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
|
||||||
|
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
import logging
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -57,13 +57,12 @@ Script Flow:
|
|||||||
8. Cleans up by deleting both VPGs
|
8. Cleans up by deleting both VPGs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
import logging
|
import logging
|
||||||
# Configure logging before any other imports or code
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
)
|
)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
@@ -106,6 +105,8 @@ def main():
|
|||||||
parser.add_argument("--vm2", required=True, help="Name of second VM to protect")
|
parser.add_argument("--vm2", required=True, help="Name of second VM to protect")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
logging.warning("TEST TEST TEST")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Setup clients and get site identifiers
|
# Setup clients and get site identifiers
|
||||||
client1 = setup_clients(args)
|
client1 = setup_clients(args)
|
||||||
|
|||||||
@@ -59,10 +59,13 @@ confirmation. It demonstrates proper error handling and logging for VRA manageme
|
|||||||
operations.
|
operations.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#!/usr/bin/python3
|
# Configure logging BEFORE any imports
|
||||||
import argparse
|
|
||||||
import logging
|
import logging
|
||||||
# logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
|
import argparse
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
@@ -206,12 +209,6 @@ def main():
|
|||||||
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
parser.add_argument("--ignore_ssl", action="store_true", help="Ignore SSL certificate verification")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Setup client
|
# Setup client
|
||||||
client = setup_client(args)
|
client = setup_client(args)
|
||||||
|
|||||||
@@ -60,13 +60,17 @@ Script Flow:
|
|||||||
Note: This script demonstrates basic ZORG management capabilities and can be used
|
Note: This script demonstrates basic ZORG management capabilities and can be used
|
||||||
as a foundation for more complex ZORG operations and automation.
|
as a foundation for more complex ZORG operations and automation.
|
||||||
"""
|
"""
|
||||||
|
# Configure logging BEFORE any imports
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||||
|
)
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import urllib3
|
import urllib3
|
||||||
import json
|
import json
|
||||||
from zvml import ZVMLClient
|
from zvml import ZVMLClient
|
||||||
@@ -83,12 +87,6 @@ def main():
|
|||||||
parser.add_argument("--zorg_id", help="Optional: Specific ZORG ID to query")
|
parser.add_argument("--zorg_id", help="Optional: Specific ZORG ID to query")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure logging
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Connect to ZVM
|
# Connect to ZVM
|
||||||
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
logging.info(f"Connecting to ZVM at {args.zvm_address}")
|
||||||
|
|||||||
@@ -13,13 +13,6 @@ import requests
|
|||||||
import logging
|
import logging
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
# Configure logging with timestamp format
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
|
||||||
datefmt='%Y-%m-%d %H:%M:%S'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Import all necessary classes
|
# Import all necessary classes
|
||||||
from .tasks import Tasks
|
from .tasks import Tasks
|
||||||
from .vpgs import VPGs
|
from .vpgs import VPGs
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ def main():
|
|||||||
parser.add_argument("--password", required=True, help="Password")
|
parser.add_argument("--password", required=True, help="Password")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = ZVMLClient(zvm_address=args.zvm_address, username=args.username, password=args.password)
|
client = ZVMLClient(zvm_address=args.zvm_address, username=args.username, password=args.password)
|
||||||
# Example usage
|
# Example usage
|
||||||
|
|||||||
+126
-123
@@ -12,6 +12,9 @@
|
|||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
# Create module-specific logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class VirtualizationSites:
|
class VirtualizationSites:
|
||||||
def __init__(self, client):
|
def __init__(self, client):
|
||||||
self.client = client
|
self.client = client
|
||||||
@@ -34,9 +37,9 @@ class VirtualizationSites:
|
|||||||
url = f"https://{self.client.zvm_address}/v1/virtualizationsites"
|
url = f"https://{self.client.zvm_address}/v1/virtualizationsites"
|
||||||
if site_identifier:
|
if site_identifier:
|
||||||
url = f"{url}/{site_identifier}"
|
url = f"{url}/{site_identifier}"
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_sites: Fetching site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_sites: Fetching site {site_identifier}...")
|
||||||
else:
|
else:
|
||||||
logging.info("VirtualizationSites.get_virtualization_sites: Fetching all virtualization sites...")
|
logger.info("VirtualizationSites.get_virtualization_sites: Fetching all virtualization sites...")
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -49,14 +52,14 @@ class VirtualizationSites:
|
|||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_vms(self, site_identifier):
|
def get_virtualization_site_vms(self, site_identifier):
|
||||||
@@ -81,21 +84,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_vms: Fetching VMs for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_vms: Fetching VMs for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_vcd_vapps(self, site_identifier):
|
def get_virtualization_site_vcd_vapps(self, site_identifier):
|
||||||
@@ -120,21 +123,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_vcd_vapps: Fetching VCD vApps for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_vcd_vapps: Fetching VCD vApps for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_datastores(self, site_identifier):
|
def get_virtualization_site_datastores(self, site_identifier):
|
||||||
@@ -159,21 +162,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_datastores: Fetching datastores for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_datastores: Fetching datastores for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_folders(self, site_identifier):
|
def get_virtualization_site_folders(self, site_identifier):
|
||||||
@@ -198,21 +201,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_folders: Fetching folders for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_folders: Fetching folders for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_datastore_clusters(self, site_identifier):
|
def get_virtualization_site_datastore_clusters(self, site_identifier):
|
||||||
@@ -237,21 +240,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_datastore_clusters: Fetching datastore clusters for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_datastore_clusters: Fetching datastore clusters for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_resource_pools(self, site_identifier):
|
def get_virtualization_site_resource_pools(self, site_identifier):
|
||||||
@@ -276,21 +279,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_resource_pools: Fetching resource pools for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_resource_pools: Fetching resource pools for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_org_vdcs(self, site_identifier):
|
def get_virtualization_site_org_vdcs(self, site_identifier):
|
||||||
@@ -315,21 +318,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_org_vdcs: Fetching org VDCs for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_org_vdcs: Fetching org VDCs for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_networks(self, site_identifier):
|
def get_virtualization_site_networks(self, site_identifier):
|
||||||
@@ -354,21 +357,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_networks: Fetching networks for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_networks: Fetching networks for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_hosts(self, site_identifier, host_identifier=None):
|
def get_virtualization_site_hosts(self, site_identifier, host_identifier=None):
|
||||||
@@ -393,9 +396,9 @@ class VirtualizationSites:
|
|||||||
url = f"https://{self.client.zvm_address}/v1/virtualizationsites/{site_identifier}/hosts"
|
url = f"https://{self.client.zvm_address}/v1/virtualizationsites/{site_identifier}/hosts"
|
||||||
if host_identifier:
|
if host_identifier:
|
||||||
url = f"{url}/{host_identifier}"
|
url = f"{url}/{host_identifier}"
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_hosts: Fetching host {host_identifier} from site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_hosts: Fetching host {host_identifier} from site {site_identifier}...")
|
||||||
else:
|
else:
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_hosts: Fetching all hosts for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_hosts: Fetching all hosts for site {site_identifier}...")
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -408,14 +411,14 @@ class VirtualizationSites:
|
|||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_repositories(self, site_identifier):
|
def get_virtualization_site_repositories(self, site_identifier):
|
||||||
@@ -440,21 +443,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_repositories: Fetching repositories for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_repositories: Fetching repositories for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_host_clusters(self, site_identifier):
|
def get_virtualization_site_host_clusters(self, site_identifier):
|
||||||
@@ -479,21 +482,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_host_clusters: Fetching host clusters for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_host_clusters: Fetching host clusters for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_org_vdc_networks(self, site_identifier, org_vdc_identifier):
|
def get_virtualization_site_org_vdc_networks(self, site_identifier, org_vdc_identifier):
|
||||||
@@ -519,21 +522,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_org_vdc_networks: Fetching networks for org VDC {org_vdc_identifier} in site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_org_vdc_networks: Fetching networks for org VDC {org_vdc_identifier} in site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_org_vdc_storage_policies(self, site_identifier, org_vdc_identifier):
|
def get_virtualization_site_org_vdc_storage_policies(self, site_identifier, org_vdc_identifier):
|
||||||
@@ -559,21 +562,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_org_vdc_storage_policies: Fetching storage policies for org VDC {org_vdc_identifier} in site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_org_vdc_storage_policies: Fetching storage policies for org VDC {org_vdc_identifier} in site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_devices(self, site_identifier, host_identifier=None, device_name=None):
|
def get_virtualization_site_devices(self, site_identifier, host_identifier=None, device_name=None):
|
||||||
@@ -612,21 +615,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_devices: Fetching devices for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_devices: Fetching devices for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, params=params, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, params=params, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_networks(self, site_identifier):
|
def get_virtualization_site_public_cloud_networks(self, site_identifier):
|
||||||
@@ -651,21 +654,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_networks: Fetching public cloud virtual networks for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_networks: Fetching public cloud virtual networks for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_subnets(self, site_identifier):
|
def get_virtualization_site_public_cloud_subnets(self, site_identifier):
|
||||||
@@ -690,21 +693,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_subnets: Fetching public cloud subnets for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_subnets: Fetching public cloud subnets for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_security_groups(self, site_identifier):
|
def get_virtualization_site_public_cloud_security_groups(self, site_identifier):
|
||||||
@@ -729,21 +732,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_security_groups: Fetching public cloud security groups for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_security_groups: Fetching public cloud security groups for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_vm_instance_types(self, site_identifier):
|
def get_virtualization_site_public_cloud_vm_instance_types(self, site_identifier):
|
||||||
@@ -768,21 +771,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_vm_instance_types: Fetching VM instance types for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_vm_instance_types: Fetching VM instance types for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_resource_groups(self, site_identifier):
|
def get_virtualization_site_public_cloud_resource_groups(self, site_identifier):
|
||||||
@@ -807,21 +810,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_resource_groups: Fetching resource groups for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_resource_groups: Fetching resource groups for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_keys_containers(self, site_identifier):
|
def get_virtualization_site_public_cloud_keys_containers(self, site_identifier):
|
||||||
@@ -846,21 +849,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_keys_containers: Fetching keys containers for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_keys_containers: Fetching keys containers for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_encryption_keys(self, site_identifier, encryption_key_id=None):
|
def get_virtualization_site_public_cloud_encryption_keys(self, site_identifier, encryption_key_id=None):
|
||||||
@@ -885,9 +888,9 @@ class VirtualizationSites:
|
|||||||
url = f"https://{self.client.zvm_address}/v1/virtualizationsites/{site_identifier}/publiccloud/encryptionkeys"
|
url = f"https://{self.client.zvm_address}/v1/virtualizationsites/{site_identifier}/publiccloud/encryptionkeys"
|
||||||
if encryption_key_id:
|
if encryption_key_id:
|
||||||
url = f"{url}/{encryption_key_id}"
|
url = f"{url}/{encryption_key_id}"
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_encryption_keys: Fetching encryption key {encryption_key_id} for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_encryption_keys: Fetching encryption key {encryption_key_id} for site {site_identifier}...")
|
||||||
else:
|
else:
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_encryption_keys: Fetching all encryption keys for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_encryption_keys: Fetching all encryption keys for site {site_identifier}...")
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -900,14 +903,14 @@ class VirtualizationSites:
|
|||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_managed_identities(self, site_identifier):
|
def get_virtualization_site_public_cloud_managed_identities(self, site_identifier):
|
||||||
@@ -932,21 +935,21 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_managed_identities: Fetching managed identities for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_managed_identities: Fetching managed identities for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def get_virtualization_site_public_cloud_disk_encryption_keys(self, site_identifier):
|
def get_virtualization_site_public_cloud_disk_encryption_keys(self, site_identifier):
|
||||||
@@ -971,19 +974,19 @@ class VirtualizationSites:
|
|||||||
'Authorization': f'Bearer {self.client.token}'
|
'Authorization': f'Bearer {self.client.token}'
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.info(f"VirtualizationSites.get_virtualization_site_public_cloud_disk_encryption_keys: Fetching disk encryption keys for site {site_identifier}...")
|
logger.info(f"VirtualizationSites.get_virtualization_site_public_cloud_disk_encryption_keys: Fetching disk encryption keys for site {site_identifier}...")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
response = requests.get(url, headers=headers, verify=self.client.verify_certificate)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
if e.response is not None:
|
if e.response is not None:
|
||||||
logging.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
logger.error(f"HTTPError: {e.response.status_code} - {e.response.reason}")
|
||||||
try:
|
try:
|
||||||
error_details = e.response.json()
|
error_details = e.response.json()
|
||||||
logging.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
logger.error(f"Error Message: {error_details.get('Message', 'No detailed error message available')}")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error(f"Response content: {e.response.text}")
|
logger.error(f"Response content: {e.response.text}")
|
||||||
else:
|
else:
|
||||||
logging.error("HTTPError occurred with no response attached.")
|
logger.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
+1
-1
@@ -136,7 +136,7 @@ class VPGs:
|
|||||||
logging.error("HTTPError occurred with no response attached.")
|
logging.error("HTTPError occurred with no response attached.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def commit_vpg(self, vpg_settings_id, vpg_name, sync=False, expected_status=ZertoVPGStatus.Initializing, timeout=30, interval=5):
|
def commit_vpg(self, vpg_settings_id, vpg_name, sync=False, expected_status=ZertoVPGStatus.Initializing, timeout=60, interval=5):
|
||||||
logging.info(f'VPGs.commit_vpg(zvm_address={self.client.zvm_address}, vpg_settings_id={vpg_settings_id}, vpg_name={vpg_name}, sync={sync})')
|
logging.info(f'VPGs.commit_vpg(zvm_address={self.client.zvm_address}, vpg_settings_id={vpg_settings_id}, vpg_name={vpg_name}, sync={sync})')
|
||||||
commit_uri = f"https://{self.client.zvm_address}/v1/vpgSettings/{vpg_settings_id}/commit"
|
commit_uri = f"https://{self.client.zvm_address}/v1/vpgSettings/{vpg_settings_id}/commit"
|
||||||
headers = {
|
headers = {
|
||||||
|
|||||||
@@ -12,14 +12,6 @@
|
|||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
# Configure logging with timestamp format
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
|
||||||
datefmt='%Y-%m-%d %H:%M:%S'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Import all necessary classes
|
# Import all necessary classes
|
||||||
from .tasks import Tasks
|
from .tasks import Tasks
|
||||||
from .vpgs import VPGs
|
from .vpgs import VPGs
|
||||||
|
|||||||
Reference in New Issue
Block a user