Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
media_agent (str) -- media agent on which new partition is to be hosted
Raises:
SDKException:
if type of input parameters is not string
"""
if not (isinstance(copy_id, basestring) and
isinstance(sidb_store_id, basestring) and
isinstance(sidb_new_path, basestring) and
isinstance(media_agent, basestring)):
raise SDKException('Storage', '101')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
request_xml = """
""".format(copy_id, sidb_store_id, media_agent.media_agent_id,
media_agent.media_agent_name, sidb_new_path)
self._commcell_object._qoperation_execute(request_xml)
# elif isinstance(library, basestring):
# disk_library = DiskLibrary(self._commcell_object, library)
# else:
# raise SDKException('Storage', '104')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
if isinstance(ddb_ma, MediaAgent):
ddb_ma = ddb_ma
elif isinstance(ddb_ma, basestring):
ddb_ma = MediaAgent(self._commcell_object, ddb_ma)
else:
raise SDKException('Storage', '103')
request_json = {
"storagePolicyName": storage_pool_name,
"type": 1,
"copyName": "Primary",
"numberOfCopies": 1,
"storage": [
{
"path": mountpath,
"mediaAgent": {
"mediaAgentId": int(media_agent.media_agent_id),
"mediaAgentName": media_agent.media_agent_name
},
"credentials": {}
args:
media_agents (List) -- List of 3 media agents with name's(str)
or instance of media agent's(object)
Example: ["ma1","ma2","ma3"]
Raises:
SDKException:
if add nodes to an existing storage pool fails
"""
if not isinstance(media_agents, list):
raise SDKException('Storage', '101')
mediagent_obj = []
for media_agent in media_agents:
if isinstance(media_agent, MediaAgent):
mediagent_obj.append(media_agent)
elif isinstance(media_agent, basestring):
mediagent_obj.append(self._commcell_object.media_agents.get(media_agent))
else:
raise SDKException('Storage', '103')
if len(mediagent_obj) <= 2:
raise SDKException('Storage', '102', "Minimum 3 MediaAgents required")
request_json = {
"scaleoutOperationType": 2,
"StoragePolicy": {
"storagePolicyName": "{0}".format(self.storage_pool_name),
},
"storage": [
# if isinstance(library, DiskLibrary):
# disk_library = library
# elif isinstance(library, basestring):
# disk_library = DiskLibrary(self._commcell_object, library)
# else:
# raise SDKException('Storage', '104')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
if isinstance(ddb_ma, MediaAgent):
ddb_ma = ddb_ma
elif isinstance(ddb_ma, basestring):
ddb_ma = MediaAgent(self._commcell_object, ddb_ma)
else:
raise SDKException('Storage', '103')
request_json = {
"storagePolicyName": storage_pool_name,
"type": 1,
"copyName": "Primary",
"numberOfCopies": 1,
"storage": [
{
"path": mountpath,
"mediaAgent": {
"mediaAgentId": int(media_agent.media_agent_id),
if type of the media agent argument is not either string or MediaAgent instance
if failed to create disk library
if response is empty
if response is not success
"""
if not (isinstance(library_name, basestring) and
isinstance(mount_path, basestring) and
isinstance(username, basestring) and
isinstance(password, basestring)):
raise SDKException('Storage', '101')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
request_json = {
"isConfigRequired": 1,
"library": {
"mediaAgentId": int(media_agent.media_agent_id),
"libraryName": library_name,
"mountPath": mount_path,
"loginName": username,
"password": b64encode(password.encode()).decode(),
"opType": 1
}
if failed to create disk library
if response is empty
if response is not success
"""
if not (isinstance(library_name, basestring) and
isinstance(mount_path, basestring) and
isinstance(username, basestring) and
isinstance(password, basestring)):
raise SDKException('Storage', '101')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
request_json = {
"isConfigRequired": 1,
"library": {
"mediaAgentId": int(media_agent.media_agent_id),
"libraryName": library_name,
"mountPath": mount_path,
"loginName": username,
"password": b64encode(password.encode()).decode(),
"opType": 1
}
}
if servertype > 0:
"mediaAgent": {
"mediaAgentId": int(media_agent.media_agent_id)
},
"retentionRules": {
"retainBackupDataForDays": retention_period
}
},
"storagePolicyName": storage_policy_name,
"type": sp_type
}
if dedup_path:
if dedup_media_agent is None:
dedup_media_agent = media_agent
elif self._commcell_object.media_agents.has_media_agent(dedup_media_agent):
dedup_media_agent = MediaAgent(self._commcell_object, dedup_media_agent)
else:
raise SDKException('Storage', '103')
dedup_info = {
"storagePolicyCopyInfo": {
"dedupeFlags": {
"enableDeduplication": 1
},
"DDBPartitionInfo": {
"maInfoList": [{
"mediaAgent": {
"mediaAgentName": dedup_media_agent.media_agent_name
},
"subStoreList": [{
"accessPath": {
"path": dedup_path
extra_arguments.update(kwargs)
if ((dedup_path is not None and not isinstance(dedup_path, basestring)) or
(not (isinstance(storage_policy_name, basestring) and
isinstance(retention_period, int))) or
(incremental_sp is not None and not isinstance(incremental_sp, basestring))):
raise SDKException('Storage', '101')
if isinstance(library, DiskLibrary):
disk_library = library
elif isinstance(library, basestring):
disk_library = DiskLibrary(self._commcell_object, library)
else:
raise SDKException('Storage', '104')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
sp_type = 2 if dr_sp else 1
request_json = {
"storagePolicyCopyInfo": {
"library": {
"libraryId": int(disk_library.library_id)
},
"mediaAgent": {
"mediaAgentId": int(media_agent.media_agent_id)
},
(not (isinstance(storage_policy_name, basestring) and
isinstance(retention_period, int))) or
(incremental_sp is not None and not isinstance(incremental_sp, basestring))):
raise SDKException('Storage', '101')
if isinstance(library, DiskLibrary):
disk_library = library
elif isinstance(library, basestring):
disk_library = DiskLibrary(self._commcell_object, library)
else:
raise SDKException('Storage', '104')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
sp_type = 2 if dr_sp else 1
request_json = {
"storagePolicyCopyInfo": {
"library": {
"libraryId": int(disk_library.library_id)
},
"mediaAgent": {
"mediaAgentId": int(media_agent.media_agent_id)
},
"retentionRules": {
"retainBackupDataForDays": retention_period
}
if ((dedup_path is not None and not isinstance(dedup_path, basestring)) or
not (isinstance(storage_pool_name, basestring) or not isinstance(mountpath, basestring))):
raise SDKException('Storage', '101')
# if isinstance(library, DiskLibrary):
# disk_library = library
# elif isinstance(library, basestring):
# disk_library = DiskLibrary(self._commcell_object, library)
# else:
# raise SDKException('Storage', '104')
if isinstance(media_agent, MediaAgent):
media_agent = media_agent
elif isinstance(media_agent, basestring):
media_agent = MediaAgent(self._commcell_object, media_agent)
else:
raise SDKException('Storage', '103')
if isinstance(ddb_ma, MediaAgent):
ddb_ma = ddb_ma
elif isinstance(ddb_ma, basestring):
ddb_ma = MediaAgent(self._commcell_object, ddb_ma)
else:
raise SDKException('Storage', '103')
request_json = {
"storagePolicyName": storage_pool_name,
"type": 1,
"copyName": "Primary",
"numberOfCopies": 1,
"storage": [