~ubuntu-branches/ubuntu/raring/libvirt/raring

« back to all changes in this revision

Viewing changes to src/conf/nwfilter_params.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-11-19 10:41:02 UTC
  • mfrom: (1.2.15) (223.1.2 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121119104102-l6ewdppikysbzztu
Tags: 1.0.0-0ubuntu2
debian/patches/add-armhf-sysinfo-infomration.patch: Disable
to fix FTBFS on arm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * Lesser General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU Lesser General Public
18
 
 * License along with this library; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
18
 * License along with this library.  If not, see
 
19
 * <http://www.gnu.org/licenses/>.
20
20
 *
21
21
 * Author: Stefan Berger <stefanb@us.ibm.com>
22
22
 */
113
113
    virNWFilterVarValuePtr val;
114
114
 
115
115
    if (!isValidVarValue(value)) {
116
 
        virNWFilterReportError(VIR_ERR_INVALID_ARG,
117
 
                               _("Variable value contains invalid character"));
 
116
        virReportError(VIR_ERR_INVALID_ARG, "%s",
 
117
                       _("Variable value contains invalid character"));
118
118
        return NULL;
119
119
    }
120
120
 
324
324
 
325
325
    varValue = virHashLookup(hash->hashTable, varName);
326
326
    if (varValue == NULL) {
327
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
328
 
                               _("Could not find value for variable '%s'"),
329
 
                               varName);
 
327
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
328
                       _("Could not find value for variable '%s'"),
 
329
                       varName);
330
330
        return -1;
331
331
    }
332
332
 
349
349
        cie->curValue = minValue;
350
350
    } else {
351
351
        if (cie->maxValue != maxValue) {
352
 
            virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
353
 
                                   _("Cardinality of list items must be "
354
 
                                     "the same for processing them in "
355
 
                                     "parallel"));
 
352
            virReportError(VIR_ERR_INTERNAL_ERROR,
 
353
                           _("Cardinality of list items must be "
 
354
                             "the same for processing them in "
 
355
                             "parallel"));
356
356
            return -1;
357
357
        }
358
358
    }
541
541
        iterId = virNWFilterVarAccessGetIterId(vap);
542
542
        iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
543
543
        if (iterIndex < 0) {
544
 
            virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
545
 
                                   _("Could not get iterator index for "
546
 
                                     "iterator ID %u"), iterId);
 
544
            virReportError(VIR_ERR_INTERNAL_ERROR,
 
545
                           _("Could not get iterator index for "
 
546
                             "iterator ID %u"), iterId);
547
547
            return NULL;
548
548
        }
549
549
        break;
551
551
        iterId = virNWFilterVarAccessGetIntIterId(vap);
552
552
        iterIndex = virNWFilterVarCombIterGetIndexByIterId(ci, iterId);
553
553
        if (iterIndex < 0) {
554
 
            virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
555
 
                                   _("Could not get iterator index for "
556
 
                                     "(internal) iterator ID %u"), iterId);
 
554
            virReportError(VIR_ERR_INTERNAL_ERROR,
 
555
                           _("Could not get iterator index for "
 
556
                             "(internal) iterator ID %u"), iterId);
557
557
            return NULL;
558
558
        }
559
559
        break;
569
569
    }
570
570
 
571
571
    if (!found) {
572
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
573
 
                               _("Could not find variable '%s' in iterator"),
574
 
                               varName);
 
572
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
573
                       _("Could not find variable '%s' in iterator"),
 
574
                       varName);
575
575
        return NULL;
576
576
    }
577
577
 
578
578
    value = virHashLookup(ci->hashTable->hashTable, varName);
579
579
    if (!value) {
580
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
581
 
                               _("Could not find value for variable '%s'"),
582
 
                               varName);
 
580
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
581
                       _("Could not find value for variable '%s'"),
 
582
                       varName);
583
583
        return NULL;
584
584
    }
585
585
 
586
586
    res = virNWFilterVarValueGetNthValue(value, ci->iter[iterIndex].curValue);
587
587
    if (!res) {
588
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
589
 
                               _("Could not get nth (%u) value of "
590
 
                               "variable '%s'"),
591
 
                               ci->iter[iterIndex].curValue, varName);
 
588
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
589
                       _("Could not get nth (%u) value of "
 
590
                         "variable '%s'"),
 
591
                       ci->iter[iterIndex].curValue, varName);
592
592
        return NULL;
593
593
    }
594
594
 
736
736
    }
737
737
 
738
738
    if (virNWFilterHashTablePut(atts->target, (const char *)name, val, 1) < 0){
739
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
740
 
                               _("Could not put variable '%s' into hashmap"),
741
 
                               (const char *)name);
 
739
        virReportError(VIR_ERR_INTERNAL_ERROR,
 
740
                       _("Could not put variable '%s' into hashmap"),
 
741
                       (const char *)name);
742
742
        atts->errOccurred = 1;
743
743
        virNWFilterVarValueFree(val);
744
744
    }
863
863
    numKeys = virHashSize(table->hashTable);
864
864
 
865
865
    if (numKeys < 0) {
866
 
        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
867
 
                               _("missing filter parameter table"));
 
866
        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
 
867
                       _("missing filter parameter table"));
868
868
        return -1;
869
869
    }
870
870
 
998
998
        }
999
999
        if (parseError) {
1000
1000
            if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT)
1001
 
                virNWFilterReportError(VIR_ERR_INVALID_ARG,
1002
 
                                       _("Malformatted array index"));
 
1001
                virReportError(VIR_ERR_INVALID_ARG, "%s",
 
1002
                               _("Malformatted array index"));
1003
1003
            else
1004
 
                virNWFilterReportError(VIR_ERR_INVALID_ARG,
1005
 
                                       _("Malformatted iterator id"));
 
1004
                virReportError(VIR_ERR_INVALID_ARG, "%s",
 
1005
                               _("Malformatted iterator id"));
1006
1006
            goto err_exit;
1007
1007
        }
1008
1008
 
1013
1013
            break;
1014
1014
        case VIR_NWFILTER_VAR_ACCESS_ITERATOR:
1015
1015
            if (result > VIR_NWFILTER_MAX_ITERID) {
1016
 
                virNWFilterReportError(VIR_ERR_INVALID_ARG,
1017
 
                                       _("Iterator ID exceeds maximum ID "
1018
 
                                         "of %u"), VIR_NWFILTER_MAX_ITERID);
 
1016
                virReportError(VIR_ERR_INVALID_ARG,
 
1017
                               _("Iterator ID exceeds maximum ID "
 
1018
                                 "of %u"), VIR_NWFILTER_MAX_ITERID);
1019
1019
                goto err_exit;
1020
1020
            }
1021
1021
            dest->u.iterId = result;
1026
1026
 
1027
1027
        return dest;
1028
1028
    } else {
1029
 
        virNWFilterReportError(VIR_ERR_INVALID_ARG,
1030
 
                               _("Malformatted variable"));
 
1029
        virReportError(VIR_ERR_INVALID_ARG, "%s",
 
1030
                       _("Malformatted variable"));
1031
1031
    }
1032
1032
 
1033
1033
err_exit: