def _connect(self): logger.debug("connecting to endpoint") try: self.client = XCLIClient.connect_multiendpoint_ssl( self.user, self.password, self.endpoint) except xcli_errors.CredentialsError: raise controller_errors.CredentialsError(self.endpoint) except xcli_errors.XCLIError: raise controller_errors.CredentialsError(self.endpoint)
#!/usr/bin/python3.6 import os from pyxcli.client import XCLIClient user = os.environ["USERNAME"] password = os.environ["PASSWORD"] endpoint = os.environ["STORAGE_ARRAYS"] pool = os.environ["POOL_NAME"] client = XCLIClient.connect_multiendpoint_ssl(user, password, endpoint) vol_list = client.cmd.vol_list(pool=pool).as_list for vol in vol_list: print("deleting volume : {}".format(vol)) client.cmd.vol_delete(vol=vol.name)