Exemplo n.º 1
0
def validates_disk(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    """ TODO
    # sparse

    # disk
    if is_param(obj.input, 'disk_size'):
        check = checker.check_number(_('Disk Size (MB)'),
                                     obj.input.disk_size,
                                     CHECK_EMPTY | CHECK_VALID | CHECK_MIN,
                                     min = DISK_MIN_SIZE,
                                     ) and check

    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Disk Size (MB)'))

    """
    obj.view.alert = checker.errors

    return check
Exemplo n.º 2
0
def validates_nic(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    # nic_type - [phydev, virnet]
    if is_param(obj.input, 'nic_type'):
        if (obj.input.nic_type in ['phydev', 'virnet']) is False:
            check = False
            checker.add_error(_(""))
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Interface Type'))

    # mac_address
    if is_param(obj.input, 'mac_address'):
        check = checker.check_macaddr(_('MAC Address'), obj.input.mac_address,
                                      CHECK_EMPTY | CHECK_VALID) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('MAC Address'))

    obj.view.alert = checker.errors

    return check
Exemplo n.º 3
0
def validates_uriguest_status(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'status'):
        check = checker.check_status(
                _('Status'),
                obj.input.status,
                CHECK_EMPTY | CHECK_VALID,
                [GUEST_ACTION_CREATE, 
                GUEST_ACTION_SHUTDOWN,
                GUEST_ACTION_DESTROY,
                GUEST_ACTION_SUSPEND,
                GUEST_ACTION_RESUME,
                GUEST_ACTION_REBOOT,
                GUEST_ACTION_ENABLE_AUTOSTART,
                GUEST_ACTION_DISABLE_AUTOSTART]
            ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Status'))

    obj.view.alert = checker.errors

    return check
Exemplo n.º 4
0
def validates_cpu(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'max_vcpus'):
        check = checker.check_number(
            _('Maximum Allocatable Virtual CPUs'),
            obj.input.max_vcpus,
            CHECK_EMPTY | CHECK_VALID | CHECK_MIN,
            min=VCPUS_MIN_SIZE,
        ) and check
    else:
        check = False
        checker.add_error(
            _('"%s" is required.') % _('Maximum Allocatable Virtual CPUs'))

    if is_param(obj.input, 'vcpus'):
        check = checker.check_number(
            _("Number of Virtual CPUs to Allocate"),
            obj.input.vcpus,
            CHECK_EMPTY | CHECK_VALID | CHECK_MIN,
            min=VCPUS_MIN_SIZE,
        ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 5
0
def validates_policy(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'input_policy'):
        check = False
        checker.add_error(_('"%s" is required.') % _('INPUT Chain'))
    else:
        check = checker.check_firewall_policy(
            _('INPUT Chain'), obj.input.input_policy,
            CHECK_EMPTY | CHECK_VALID) and check

    if not is_param(obj.input, 'output_policy'):
        check = False
        checker.add_error(_('"%s" is required.') % _('OUTPUT Chain'))
    else:
        check = checker.check_firewall_policy(
            _('OUTPUT Chain'), obj.input.output_policy,
            CHECK_EMPTY | CHECK_VALID) and check

    if not is_param(obj.input, 'forward_policy'):
        check = False
        checker.add_error(_('"%s" is required.') % _('FORWARD Chain'))
    else:
        check = checker.check_firewall_policy(
            _('FORWARD Chain'), obj.input.input_policy,
            CHECK_EMPTY | CHECK_VALID) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 6
0
def validates_staticroute(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'target'):
        check = False
        checker.add_error(_('Specify target address for the route.'))
    else:
        check = checker.check_ipaddr(
            _('Target'),
            obj.input.target,
            CHECK_EMPTY | CHECK_VALID,
        ) and check

    if not is_param(obj.input, 'gateway'):
        check = False
        checker.add_error(_('Specify gateway address for the route.'))
    else:
        check = checker.check_ipaddr(
            _('Gateway'),
            obj.input.gateway,
            CHECK_VALID,
        ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 7
0
def validates_user(obj):
    checker = Checker()
    check = True
          
    _ = obj._ 
    checker.errors = []

    if not is_param(obj.input, 'nickname'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Nickname'))
    else:
        check = checker.check_username(
                _('Nickname'),
                obj.input.nickname,
                CHECK_EMPTY | CHECK_LENGTH | CHECK_ONLYSPACE,
                min = USER_MIN_LENGTH,
                max = USER_MAX_LENGTH,
                ) and check

    if not is_param(obj.input, 'email'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Mail Address'))
    else:
        check = checker.check_mailaddress(
                _('Mail Address'), 
                obj.input.email,
                CHECK_EMPTY | CHECK_LENGTH | CHECK_VALID,
                min = EMAIL_MIN_LENGTH,
                max = EMAIL_MAX_LENGTH,
                ) and check 
    
    _password_flag = True
    if not is_param(obj.input, 'new_password'):
        _password_flag = False
        checker.add_error(_('"%s" is required.') % _('New Password'))
    if not is_param(obj.input, 'retype'):
        check = False
        _password_flag = False
        checker.add_error(_('"%s" is required.') % _('Retype'))

    if _password_flag == True:
        check = checker.check_password(
                _('Password'),
                obj.input.new_password,
                obj.input.retype,
                CHECK_VALID | CHECK_LENGTH | CHECK_EMPTY,
                min = PASSWORD_MIN_LENGTH,
                max = PASSWORD_MAX_LENGTH,
                ) and check

    check = checker.check_languages(
            _('Language'),
            obj.input.languages,
            CHECK_EMPTY | CHECK_VALID | CHECK_LENGTH,
            min = LANGUAGES_MIN_LENGTH,
            max = LANGUAGES_MAX_LENGTH,
            ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 8
0
def validates_mail(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'hostname'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Server Name'))
    else:
        check_server = checker.check_domainname(_('Server Name'),
                        obj.input.hostname,
                        CHECK_VALID,
                       ) or \
                       checker.check_ipaddr(_('Server Name'),
                        obj.input.hostname,
                        CHECK_VALID,
                       )
        check = check_server and check

    if not is_param(obj.input, 'port'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Port Number'))
    else:
        check = checker.check_number(
            _('Port Number'),
            obj.input.port,
            CHECK_VALID | CHECK_MIN | CHECK_MAX,
            PORT_MIN_NUMBER,
            PORT_MAX_NUMBER,
        ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 9
0
def validates_snapshot(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'title'):
        check = checker.check_string(
            _('Title'),
            obj.input.title,
            CHECK_LENGTH | CHECK_ONLYSPACE,
            None,
            min=NOTE_TITLE_MIN_LENGTH,
            max=NOTE_TITLE_MAX_LENGTH,
        ) and check

    if is_param(obj.input, 'value'):
        check = checker.check_string(
            _('Note'),
            obj.input.value,
            CHECK_ONLYSPACE,
            None,
            None,
            None,
        ) and check

    obj.view.alert = checker.errors

    return check
Exemplo n.º 10
0
def validates_jobsearch(obj):
    checker = Checker()
    _ = obj._
    checker.errors = []
    
    check = True
    edit = False
    
    if is_param(obj.input, "name", True) is True:
        edit = True
        check = checker.check_string(
            _('Machine Name'),
            obj.input.name,
            CHECK_LENGTH | CHECK_ONLYSPACE | CHECK_VALID,
            '[%_]',
            min = MACHINE_NAME_MIN_LENGTH,
            max = MACHINE_NAME_MAX_LENGTH,
            ) and check

    if is_param(obj.input, "user", True) is True:
        edit = True
        check = checker.check_string(
            _('Create User'),
            obj.input.user,
            CHECK_LENGTH | CHECK_ONLYSPACE | CHECK_VALID,
            '[%_]',
            min = USER_MIN_LENGTH,
            max = USER_MAX_LENGTH,
            ) and check

    if is_param(obj.input, "status", True) is True:
        edit = True
        check = checker.check_status(
            _('Status'), 
            obj.input.status, 
            CHECK_VALID, 
            JOBGROUP_STATUS.values()
            ) and check

    if is_param(obj.input, "start", True) is True:
        edit = True
        check = checker.check_datetime_string(
            _('Created'),
            obj.input.start,
            CHECK_VALID,
            obj.me.languages
            ) and check
            
    if is_param(obj.input, "end", True) is True:
        edit = True
        check = checker.check_datetime_string(
            _('Created'),
            obj.input.end,
            CHECK_VALID,
            obj.me.languages
            ) and check

    obj.view.alert = checker.errors
    return check, edit
Exemplo n.º 11
0
def validates_guest_import(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []
    # TODO UUID check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 12
0
def validates_network_storage(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'iqn'):
        check = checker.check_string(
            _('Target IQN'),
            obj.input.iqn,
            CHECK_EMPTY | CHECK_ONLYSPACE,
            None,
            None,
            None,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Target IQN'))

    if is_param(obj.input, 'status'):
        check = checker.check_empty(
            _('Action Status'),
            obj.input.status,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Action Status'))

    if is_param(obj.input, 'host'):
        check = checker.check_domainname(
            _('Target Hostname'),
            obj.input.host,
            CHECK_EMPTY | CHECK_VALID,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Target Hostname'))

    if is_param(obj.input, 'port'):
        check = checker.check_number(
            _('Target Port Number'),
            obj.input.port,
            CHECK_VALID | CHECK_MIN | CHECK_MAX,
            PORT_MIN_NUMBER,
            PORT_MAX_NUMBER,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Target Port Number'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 13
0
def validates_guest_edit(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'm_name'):
        check = False
        checker.add_error(_('Parameter m_name does not exist.'))
    else:
        check = checker.check_string(
            _('Machine Name'),
            obj.input.m_name,
            CHECK_EMPTY | CHECK_LENGTH | CHECK_ONLYSPACE,
            None,
            min=MACHINE_NAME_MIN_LENGTH,
            max=MACHINE_NAME_MAX_LENGTH,
        ) and check

    if is_param(obj.input, 'note_title'):
        check = checker.check_string(
            _('Title'),
            obj.input.note_title,
            CHECK_LENGTH | CHECK_ONLYSPACE,
            None,
            min=NOTE_TITLE_MIN_LENGTH,
            max=NOTE_TITLE_MAX_LENGTH,
        ) and check

    if is_param(obj.input, 'note_value'):
        check = checker.check_string(
            _('Note'),
            obj.input.note_value,
            CHECK_ONLYSPACE,
            None,
            None,
            None,
        ) and check

    if is_param(obj.input, 'tags'):
        for tag in comma_split(obj.input.tags):
            check = checker.check_string(
                _('Tag'),
                tag,
                CHECK_LENGTH | CHECK_ONLYSPACE,
                None,
                min=TAG_MIN_LENGTH,
                max=TAG_MAX_LENGTH,
            ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 14
0
def compare_password(obj, user):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not sha1compare(user.password, obj.input.password, user.salt):
        check = False
        checker.add_error(_('%s is mismatched.') % _('Current Password'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 15
0
def validates_nic(obj):
    checker = Checker()
    check = True
    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'bootproto'):
        if obj.input.bootproto == "static":
            if is_param(obj.input, 'ipaddr'):
                check = checker.check_ipaddr(
                    _('IP Address'),
                    obj.input.ipaddr,
                    CHECK_EMPTY | CHECK_VALID,
                ) and check
            else:
                check = False
                checker.add_error(_('"%s" is required.') % _('IP Address'))

            if is_param(obj.input, 'netmask'):
                check = checker.check_netmask(
                    _('Netmask'),
                    obj.input.netmask,
                    CHECK_EMPTY | CHECK_VALID,
                ) and check
            else:
                check = False
                checker.add_error(_('"%s" is required.') % _('Netmask'))

        else:
            if is_param(obj.input, 'ipaddr'):
                check = checker.check_ipaddr(
                    _('IP Address'),
                    obj.input.ipaddr,
                    CHECK_VALID,
                ) and check

            if is_param(obj.input, 'netmask'):
                check = checker.check_netmask(
                    _('Netmask'),
                    obj.input.netmask,
                    CHECK_VALID,
                ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Boot-time Protocol'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 16
0
def validates_general(obj):
    checker = Checker()
    check = True
    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'gateway'):
        check = checker.check_ipaddr(
            _('Default Gateway'),
            obj.input.gateway,
            CHECK_EMPTY | CHECK_VALID,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Default Gateway'))

    if is_param(obj.input, 'fqdn'):
        check = checker.check_domainname(
            _('FQDN'),
            obj.input.fqdn,
            CHECK_EMPTY | CHECK_VALID | CHECK_LENGTH,
            FQDN_MIN_LENGTH,
            FQDN_MAX_LENGTH,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('FQDN'))

    if is_param(obj.input, 'nameserver'):
        nameservers = obj.input.nameserver.strip().split()
        if len(nameservers) != 0:
            for name_server in nameservers:
                if name_server == "":
                    continue
                check = checker.check_ipaddr(
                    _('Nameserver'),
                    name_server,
                    CHECK_VALID,
                ) and check
        else:
            check = False
            checker.add_error(_('"%s" is required.') % _('Nameserver'))
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Nameserver'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 17
0
def validates_tag(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    check = check and checker.check_length(
        _('Tag'),
        obj.input.name,
        TAG_MIN_LENGTH,
        TAG_MAX_LENGTH,
    )

    obj.view.alert = checker.errors
    return check
Exemplo n.º 18
0
def validates_watch(obj, target, lang):
    checker = Checker()
    check = True
    _ = obj._
    checker.errors = []

    if target not in WATCH_PLUGINS.values():
        check = False
        checker.add_error(_('"%s" is not watch target.') % _(target))

    if lang not in DEFAULT_LANGS:
        check = False
        checker.add_error(_('"%s" is not supported language.') % _(lang))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 19
0
def validates_sid(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'sid'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Copy Source'))
    else:
        check = checker.check_number(
            _('Copy Source'), obj.input.sid, CHECK_EMPTY | CHECK_VALID
            | CHECK_MIN | CHECK_MAX, ID_MIN_LENGTH, ID_MAX_LENGTH) and check

        obj.view.alert = checker.errors
    return check
Exemplo n.º 20
0
def validates_param_id(obj, tag_id):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    check = checker.check_number(
        _('Tag ID'),
        tag_id,
        CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,
        min=ID_MIN_LENGTH,
        max=ID_MAX_LENGTH,
    ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 21
0
def validates_mail(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if not is_param(obj.input, 'server'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Mail Server Name'))
    else:
        check_server = checker.check_domainname(_('Mail Server Name'),
                        obj.input.server,
                        CHECK_EMPTY | CHECK_VALID,
                       ) or \
                       checker.check_ipaddr(_('Mail Server Name'),
                        obj.input.server,
                        CHECK_EMPTY | CHECK_VALID,
                       ) 
        check = check_server and check
    
    if not is_param(obj.input, 'port'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Port Number'))
    else:
        check = checker.check_number(_('Port Number'),
                    obj.input.port,
                    CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,
                    PORT_MIN_NUMBER,
                    PORT_MAX_NUMBER,
                    ) and check
    
    if not is_param(obj.input, 'email'):
        check = False
        checker.add_error(_('"%s" is required.') % _('Recipient Mail Address'))
    else:
        check = checker.check_mailaddress(_('Recipient Mail Address'),
                    obj.input.email,
                    CHECK_EMPTY | CHECK_VALID | CHECK_LENGTH,
                    min = EMAIL_MIN_LENGTH,
                    max = EMAIL_MAX_LENGTH
                    ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 22
0
def validates_query(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'q'):
        check = checker.check_string(_('Search Query'),
                obj.input.q,
                CHECK_EMPTY | CHECK_LENGTH | CHECK_VALID,
                '[%_]',
                min = SEARCH_MIN_LENGTH,
                max = SEARCH_MAX_LENGTH,
                ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 23
0
def validates_fw_status(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'status'):
        check = checker.check_status(_('Status'), obj.input.status,
                                     CHECK_EMPTY | CHECK_VALID,
                                     FIREWALL_STATUS.values()) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Status'))

    obj.view.alert = checker.errors

    return check
Exemplo n.º 24
0
def validates_icon(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'multi_icon'):
        check = checker.check_image(
            _('Machine Icon'),
            obj.input.multi_icon.value,
            CHECK_EMPTY | CHECK_VALID,
            None,
            None,
        ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 25
0
def validates_page(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'p'):
        check = checker.check_number(
            _('Page Number'),
            obj.input.p,
            CHECK_EMPTY | CHECK_VALID | CHECK_MIN | CHECK_MAX,
            min=PAGE_MIN_SIZE,
            max=PAGE_MAX_SIZE,
        ) and check

    obj.view.alert = checker.errors
    return check
Exemplo n.º 26
0
def validates_storage_pool(obj, uuid=None):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if uuid:
        check = checker.check_unique_key(
            _('Target UUID'),
            uuid,
            CHECK_EMPTY | CHECK_VALID,
        ) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Target UUID'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 27
0
def validates_pool_iscsi(obj, now_pools):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'pool_name'):
        check = checker.check_string(_('Storage Pool Name'),
                                     obj.input.pool_name,
                                     CHECK_EMPTY | CHECK_ONLYSPACE,
                                     None,
                                     ) and check
        if obj.input.pool_name in now_pools:
            check = False
            checker.add_error(_('%s "%s" already exists.') % (_('Storage Pool Name'), obj.input.pool_name))
    else:
        check = False
        checker.add_error(_('"%s" is required.') %_('Storage Pool Name'))

    if is_param(obj.input, 'pool_target_iscsi'):
        check = checker.check_string(_('iSCSI Target'),
                                        obj.input.pool_target_iscsi,
                                        CHECK_EMPTY | CHECK_ONLYSPACE,
                                        None,
                                        ) and check
        try:
            kvc = KaresansuiVirtConnection()

            for pool_name in now_pools:
                pool_iqn = kvc.get_storage_pool_sourcedevicepath(pool_name)
                if obj.input.pool_target_iscsi == pool_iqn:
                    check = False
                    checker.add_error(_('Storagepool iSCSI target IQN "%s" is already being used.') % (obj.input.pool_target_iscsi))
        finally:
            kvc.close()

    else:
        check = False
        checker.add_error(_('"%s" is required.') %_('iSCSI Target'))

    obj.view.alert = checker.errors
    return check
Exemplo n.º 28
0
def validates_nicby1(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []
    
    # mac_address
    if is_param(obj.input, 'mac_address'):
        check = checker.check_macaddr(
            _('MAC Address'),
            obj.input.mac_address,
            CHECK_EMPTY | CHECK_VALID
            ) and check
    

    obj.view.alert = checker.errors

    return check
Exemplo n.º 29
0
def validates_nw_status(obj):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'status'):
        status = int(obj.input.status)
        check = checker.check_status(
            _('Status'), status, CHECK_EMPTY | CHECK_VALID,
            [NETWORK_ACTIVE, NETWORK_INACTIVE]) and check
    else:
        check = False
        checker.add_error(_('"%s" is required.') % _('Status'))

    obj.view.alert = checker.errors

    return check
Exemplo n.º 30
0
def validates_pool_dir(obj, now_pools):
    checker = Checker()
    check = True

    _ = obj._
    checker.errors = []

    if is_param(obj.input, 'pool_name'):
        check = checker.check_string(_('Storage Pool Name'),
                                     obj.input.pool_name,
                                     CHECK_EMPTY | CHECK_ONLYSPACE,
                                     None,
                                     ) and check
        if obj.input.pool_name in now_pools:
            check = False
            checker.add_error(_('%s "%s" already exists.') % (_('Storage Pool Name'), obj.input.pool_name))
    else:
        check = False
        checker.add_error(_('"%s" is required.') %_('Storage Pool Name'))

    if is_param(obj.input, 'pool_target_path'):
        check = checker.check_directory(_('Directory Path'),
                                        obj.input.pool_target_path,
                                        CHECK_EMPTY | CHECK_STARTROOT | CHECK_NOTROOT
                                        ) and check
        try:
            kvc = KaresansuiVirtConnection()

            for pool_name in now_pools:
                target_path = kvc.get_storage_pool_targetpath(pool_name)
                if obj.input.pool_target_path == target_path:
                    check = False
                    checker.add_error(_('Storagepool target path "%s" is already being used.') % (obj.input.pool_target_path))
        finally:
            kvc.close()

    else:
        check = False
        checker.add_error(_('"%s" is required.') %_('Directory Path'))

    obj.view.alert = checker.errors
    return check