Example #1
0
def create_image_store_backup_storage(bs_name, bs_hostname, bs_username, bs_password, bs_url, bs_sshport, session_uuid=None):
    action = api_actions.AddImageStoreBackupStorageAction()
    action.name = bs_name
    action.url = bs_url
    action.hostname = bs_hostname
    action.username = bs_username
    action.password = bs_password
    action.sshPort = bs_sshport
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Create Sftp Backup Storage [uuid:] %s [name:] %s' % \
            (evt.inventory.uuid, action.name))
    return evt.inventory
Example #2
0
def create_image_store_backup_storage(backup_storage_option, session_uuid=None):
    action = api_actions.AddImageStoreBackupStorageAction()
    action.timeout = 300000
    action.name = backup_storage_option.get_name()
    action.description = backup_storage_option.get_description()
    action.type = backup_storage_option.get_type()
    action.url = backup_storage_option.get_url()
    action.hostname = backup_storage_option.get_hostname()
    action.username = backup_storage_option.get_username()
    action.password = backup_storage_option.get_password()
    action.sshPort = backup_storage_option.get_sshport()
    action.resourceUuid = backup_storage_option.get_resource_uuid()
    evt = account_operations.execute_action_with_session(action, session_uuid)
    test_util.action_logger('Create Sftp Backup Storage [uuid:] %s [name:] %s' % \
            (evt.inventory.uuid, action.name))
    return evt.inventory
def add_backup_storage(deployConfig, session_uuid):
    if xmlobject.has_element(deployConfig, 'backupStorages.sftpBackupStorage'):
        for bs in xmlobject.safe_list(deployConfig.backupStorages.sftpBackupStorage):
            action = api_actions.AddSftpBackupStorageAction()
            action.sessionUuid = session_uuid
            action.name = bs.name_
            action.description = bs.description__
            action.url = bs.url_
            action.username = bs.username_
            action.password = bs.password_
            action.hostname = bs.hostname_
            if hasattr(bs, 'sshPort_'):
                action.port = bs.sshPort_
            action.timeout = AddKVMHostTimeOut  # for some platform slowly salt execution
            action.type = inventory.SFTP_BACKUP_STORAGE_TYPE
            if bs.uuid__:
                action.resourceUuid = bs.uuid__
            thread = threading.Thread(target=_thread_for_action, args=(action,))
            wait_for_thread_queue()
            thread.start()

    if xmlobject.has_element(deployConfig, 'backupStorages.cephBackupStorage'):
        for bs in xmlobject.safe_list(deployConfig.backupStorages.cephBackupStorage):
            action = api_actions.AddCephBackupStorageAction()
            action.sessionUuid = session_uuid
            action.name = bs.name_
            action.description = bs.description__
            action.monUrls = bs.monUrls_.split(';')
            if bs.poolName__:
                action.poolName = bs.poolName_
            action.timeout = AddKVMHostTimeOut  # for some platform slowly salt execution
            action.type = inventory.CEPH_BACKUP_STORAGE_TYPE
            thread = threading.Thread(target=_thread_for_action, args=(action,))
            wait_for_thread_queue()
            thread.start()

    if xmlobject.has_element(deployConfig, 'backupStorages.fusionStorBackupStorage'):
        for bs in xmlobject.safe_list(deployConfig.backupStorages.fusionStorBackupStorage):
            action = api_actions.AddFusionstorBackupStorageAction()
            action.sessionUuid = session_uuid
            action.name = bs.name_
            action.description = bs.description__
            action.monUrls = bs.monUrls_.split(';')
            if bs.poolName__:
                action.poolName = bs.poolName_
            action.timeout = AddKVMHostTimeOut  # for some platform slowly salt execution
            action.type = inventory.FUSIONSTOR_BACKUP_STORAGE_TYPE
            thread = threading.Thread(target=_thread_for_action, args=(action,))
            wait_for_thread_queue()
            thread.start()

    if xmlobject.has_element(deployConfig, 'backupStorages.imageStoreBackupStorage'):
        for bs in xmlobject.safe_list(deployConfig.backupStorages.imageStoreBackupStorage):
            action = api_actions.AddImageStoreBackupStorageAction()
            action.sessionUuid = session_uuid
            action.name = bs.name_
            action.description = bs.description__
            action.url = bs.url_
            action.username = bs.username_
            action.password = bs.password_
            action.hostname = bs.hostname_
            if hasattr(bs, 'sshPort_'):
                action.port = bs.sshPort_
            action.timeout = AddKVMHostTimeOut  # for some platform slowly salt execution
            action.type = inventory.FUSIONSTOR_BACKUP_STORAGE_TYPE
            thread = threading.Thread(target=_thread_for_action, args=(action,))
            wait_for_thread_queue()
            thread.start()

    if xmlobject.has_element(deployConfig, 'backupStorages.simulatorBackupStorage'):
        for bs in xmlobject.safe_list(deployConfig.backupStorages.simulatorBackupStorage):
            action = api_actions.AddSimulatorBackupStorageAction()
            action.sessionUuid = session_uuid
            action.name = bs.name_
            action.description = bs.description__
            action.url = bs.url_
            action.type = inventory.SIMULATOR_BACKUP_STORAGE_TYPE
            action.totalCapacity = sizeunit.get_size(bs.totalCapacity_)
            action.availableCapacity = sizeunit.get_size(bs.availableCapacity_)
            thread = threading.Thread(target=_thread_for_action, args=(action,))
            wait_for_thread_queue()
            thread.start()

    wait_for_thread_done()