\
\
\
@@ -443,6 +452,10 @@ function updateHostInfo(request,host){
VM MAD | \
'+host_info.VM_MAD+' | \
\
+
\
+ VN MAD | \
+ '+host_info.VN_MAD+' | \
+
\
\
TM MAD | \
'+host_info.TM_MAD+' | \
@@ -537,6 +550,7 @@ function setupCreateHostDialog(){
"name": $('#name',this).val(),
"tm_mad": $('#tm_mad :selected',this).val(),
"vm_mad": $('#vmm_mad :selected',this).val(),
+ "vnm_mad": $('#vnm_mad :selected',this).val(),
"im_mad": $('#im_mad :selected',this).val()
}
}
diff --git a/src/template/template_syntax.cc b/src/template/template_syntax.cc
index 3aadc30534..3b547760de 100644
--- a/src/template/template_syntax.cc
+++ b/src/template/template_syntax.cc
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.2. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
- Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.2"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 17 "template_syntax.y"
#include
@@ -127,8 +126,8 @@ extern "C"
-/* Line 189 of yacc.c */
-#line 132 "template_syntax.cc"
+/* Line 268 of yacc.c */
+#line 131 "template_syntax.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -171,7 +170,7 @@ extern "C"
typedef union YYSTYPE
{
-/* Line 214 of yacc.c */
+/* Line 293 of yacc.c */
#line 74 "template_syntax.y"
char * val_str;
@@ -179,8 +178,8 @@ typedef union YYSTYPE
-/* Line 214 of yacc.c */
-#line 184 "template_syntax.cc"
+/* Line 293 of yacc.c */
+#line 183 "template_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -204,8 +203,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 209 "template_syntax.cc"
+/* Line 343 of yacc.c */
+#line 208 "template_syntax.cc"
#ifdef short
# undef short
@@ -308,11 +307,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -335,24 +334,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -383,23 +382,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -419,6 +402,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 6
/* YYLAST -- Last index in YYTABLE. */
@@ -528,8 +531,8 @@ static const yytype_uint8 yyr2[] =
0, 2, 1, 2, 3, 5, 2, 3, 5
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -560,8 +563,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -569,6 +571,12 @@ static const yytype_uint8 yytable[] =
12, 15, 17, 16, 18, 7
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-8))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_uint8 yycheck[] =
{
0, 3, 9, 9, 5, 7, 4, 8, 6, 9,
@@ -616,7 +624,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -880,7 +887,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -983,115 +989,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
{
- int yyn = yypact[yystate];
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
}
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1132,6 +1165,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, tmpl, error_msg)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1148,12 +1182,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1219,7 +1250,7 @@ YYLTYPE yylloc;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
+ YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize;
@@ -1368,7 +1399,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1399,8 +1430,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1456,7 +1487,7 @@ yyreduce:
{
case 4:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 99 "template_syntax.y"
{
Attribute * pattr;
@@ -1466,12 +1497,12 @@ yyreduce:
pattr = new SingleAttribute(name,unescape(value));
tmpl->set(pattr);
- ;}
+ }
break;
case 5:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 109 "template_syntax.y"
{
Attribute * pattr;
@@ -1484,12 +1515,12 @@ yyreduce:
tmpl->set(pattr);
delete amap;
- ;}
+ }
break;
case 6:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 122 "template_syntax.y"
{
Attribute * pattr;
@@ -1499,12 +1530,12 @@ yyreduce:
pattr = new SingleAttribute(name,value);
tmpl->set(pattr);
- ;}
+ }
break;
case 7:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 134 "template_syntax.y"
{
map* vattr;
@@ -1517,12 +1548,12 @@ yyreduce:
vattr->insert(make_pair(name,unescape(value)));
(yyval.val_attr) = static_cast(vattr);
- ;}
+ }
break;
case 8:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 147 "template_syntax.y"
{
string name((yyvsp[(3) - (5)].val_str));
@@ -1535,15 +1566,26 @@ yyreduce:
attrmap->insert(make_pair(name,unescape(value)));
(yyval.val_attr) = (yyvsp[(1) - (5)].val_attr);
- ;}
+ }
break;
-/* Line 1464 of yacc.c */
-#line 1545 "template_syntax.cc"
+/* Line 1806 of yacc.c */
+#line 1576 "template_syntax.cc"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -1572,6 +1614,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -1579,41 +1625,40 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (&yylloc, mc, tmpl, error_msg, YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (&yylloc, mc, tmpl, error_msg, yymsg);
- }
- else
- {
- yyerror (&yylloc, mc, tmpl, error_msg, YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (&yylloc, mc, tmpl, error_msg, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
- yyerror_range[0] = yylloc;
+ yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
@@ -1650,7 +1695,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- yyerror_range[0] = yylsp[1-yylen];
+ yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@@ -1669,7 +1714,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1684,7 +1729,7 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
- yyerror_range[0] = *yylsp;
+ yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, mc, tmpl, error_msg);
YYPOPSTACK (1);
@@ -1694,10 +1739,10 @@ yyerrlab1:
*++yyvsp = yylval;
- yyerror_range[1] = yylloc;
+ yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc;
/* Shift the error token. */
@@ -1733,8 +1778,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, mc, tmpl, error_msg);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, mc, tmpl, error_msg);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -1759,7 +1809,7 @@ yyreturn:
-/* Line 1684 of yacc.c */
+/* Line 2067 of yacc.c */
#line 160 "template_syntax.y"
diff --git a/src/template/template_syntax.h b/src/template/template_syntax.h
index dcef6a9d96..aa9ae6b64b 100644
--- a/src/template/template_syntax.h
+++ b/src/template/template_syntax.h
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.2. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
- Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -54,7 +53,7 @@
typedef union YYSTYPE
{
-/* Line 1685 of yacc.c */
+/* Line 2068 of yacc.c */
#line 74 "template_syntax.y"
char * val_str;
@@ -62,8 +61,8 @@ typedef union YYSTYPE
-/* Line 1685 of yacc.c */
-#line 67 "template_syntax.hh"
+/* Line 2068 of yacc.c */
+#line 66 "template_syntax.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/src/vm/History.cc b/src/vm/History.cc
index 3bef2c4eb6..f2a52ccb3c 100644
--- a/src/vm/History.cc
+++ b/src/vm/History.cc
@@ -43,6 +43,7 @@ History::History(
vm_dir(""),
hid(-1),
vmm_mad_name(""),
+ vnm_mad_name(""),
tm_mad_name(""),
stime(0),
etime(0),
@@ -63,6 +64,7 @@ History::History(
const string& _hostname,
const string& _vm_dir,
const string& _vmm,
+ const string& _vnm,
const string& _tm):
oid(_oid),
seq(_seq),
@@ -70,6 +72,7 @@ History::History(
vm_dir(_vm_dir),
hid(_hid),
vmm_mad_name(_vmm),
+ vnm_mad_name(_vnm),
tm_mad_name(_tm),
stime(0),
etime(0),
@@ -267,6 +270,7 @@ string& History::to_xml(string& xml) const
"" << stime << "" <<
"" << etime << "" <<
"" << vmm_mad_name << ""<<
+ "" << vnm_mad_name << ""<<
"" << tm_mad_name << "" <<
"" << prolog_stime << ""<<
"" << prolog_etime << ""<<
@@ -297,6 +301,7 @@ int History::rebuild_attributes()
rc += xpath(stime , "/HISTORY/STIME", 0);
rc += xpath(etime , "/HISTORY/ETIME", 0);
rc += xpath(vmm_mad_name , "/HISTORY/VMMMAD", "not_found");
+ rc += xpath(vnm_mad_name , "/HISTORY/VNMMAD", "not_found");
rc += xpath(tm_mad_name , "/HISTORY/TMMAD", "not_found");
rc += xpath(prolog_stime , "/HISTORY/PSTIME", 0);
rc += xpath(prolog_etime , "/HISTORY/PETIME", 0);
diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc
index c3737af3fd..1180c0ef93 100644
--- a/src/vm/VirtualMachine.cc
+++ b/src/vm/VirtualMachine.cc
@@ -581,6 +581,7 @@ void VirtualMachine::add_history(
const string& hostname,
const string& vm_dir,
const string& vmm_mad,
+ const string& vnm_mad,
const string& tm_mad)
{
ostringstream os;
@@ -597,7 +598,7 @@ void VirtualMachine::add_history(
previous_history = history;
}
- history = new History(oid,seq,hid,hostname,vm_dir,vmm_mad,tm_mad);
+ history = new History(oid,seq,hid,hostname,vm_dir,vmm_mad,vnm_mad,tm_mad);
history_records.push_back(history);
};
@@ -620,6 +621,7 @@ void VirtualMachine::cp_history()
history->hostname,
history->vm_dir,
history->vmm_mad_name,
+ history->vnm_mad_name,
history->tm_mad_name);
@@ -647,6 +649,7 @@ void VirtualMachine::cp_previous_history()
previous_history->hostname,
previous_history->vm_dir,
previous_history->vmm_mad_name,
+ previous_history->vnm_mad_name,
previous_history->tm_mad_name);
previous_history = history;
diff --git a/src/vm/test/VirtualMachinePoolTest.cc b/src/vm/test/VirtualMachinePoolTest.cc
index 5bcd6c1e7d..10f87c22ff 100644
--- a/src/vm/test/VirtualMachinePoolTest.cc
+++ b/src/vm/test/VirtualMachinePoolTest.cc
@@ -302,6 +302,7 @@ public:
string hostnames[] = {"A_hostname", "B_hostname", "C_hostname"};
string vm_dirs[] = {"A_vm_dir", "B_vm_dir", "C_vm_dir"};
string vmm_mads[] = {"A_vmm_mad", "B_vmm_mad", "C_vmm_mad"};
+ string vnm_mads[] = {"A_vnm_mad", "B_vnm_mad", "C_vnm_mad"};
string tm_mads[] = {"A_tm_mad", "B_tm_mad", "C_tm_mad"};
int oid, rc;
@@ -324,7 +325,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(0, hostnames[0], vm_dirs[0], vmm_mads[0], tm_mads[0]);
+ vm->add_history(0, hostnames[0], vm_dirs[0], vmm_mads[0], vnm_mads[0], tm_mads[0]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -342,7 +343,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(1, hostnames[1], vm_dirs[1], vmm_mads[1], tm_mads[1]);
+ vm->add_history(1, hostnames[1], vm_dirs[1], vmm_mads[1], vnm_mads[1], tm_mads[1]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -351,7 +352,7 @@ public:
CPPUNIT_ASSERT( rc == 0 );
// Add another history item
- vm->add_history(2, hostnames[2], vm_dirs[2], vmm_mads[2], tm_mads[2]);
+ vm->add_history(2, hostnames[2], vm_dirs[2], vmm_mads[2], vnm_mads[2], tm_mads[2]);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -408,6 +409,7 @@ public:
string new_hostname = "new_hostname";
string vm_dir = "vm_dir";
string vmm_mad = "vm_mad";
+ string vnm_mad = "vn_mad";
string tm_mad = "tm_mad";
// Allocate a VM
@@ -418,7 +420,7 @@ public:
CPPUNIT_ASSERT( vm != 0 );
// Add a history item
- vm->add_history(0, hostname, vm_dir, vmm_mad, tm_mad);
+ vm->add_history(0, hostname, vm_dir, vmm_mad, vnm_mad, tm_mad);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
@@ -426,7 +428,7 @@ public:
rc = vmp->update_history(vm);
CPPUNIT_ASSERT( rc == 0 );
- vm->add_history(0, new_hostname, vm_dir, vmm_mad, tm_mad);
+ vm->add_history(0, new_hostname, vm_dir, vmm_mad, vnm_mad, tm_mad);
rc = vmp->update(vm);
CPPUNIT_ASSERT( rc == 0 );
diff --git a/src/vm/vm_var_syntax.cc b/src/vm/vm_var_syntax.cc
index 30866385ae..6a75d06320 100644
--- a/src/vm/vm_var_syntax.cc
+++ b/src/vm/vm_var_syntax.cc
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 17 "vm_var_syntax.y"
#include
@@ -307,7 +306,7 @@ void get_network_attribute(VirtualMachine * vm,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
-/*
+
void get_user_attribute(VirtualMachine * vm,
const string& attr_name,
string& attr_value)
@@ -337,7 +336,7 @@ void get_user_attribute(VirtualMachine * vm,
user->unlock();
}
-*/
+
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@@ -408,6 +407,19 @@ void insert_vector(VirtualMachine * vm,
return;
}
+ else if (name == "USER")
+ {
+ string value;
+
+ get_user_attribute(vm, vname, value);
+
+ if (!value.empty())
+ {
+ parsed << value;
+ }
+
+ return;
+ }
else
{
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
@@ -447,8 +459,8 @@ void insert_vector(VirtualMachine * vm,
-/* Line 189 of yacc.c */
-#line 452 "vm_var_syntax.cc"
+/* Line 268 of yacc.c */
+#line 464 "vm_var_syntax.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -493,8 +505,8 @@ void insert_vector(VirtualMachine * vm,
typedef union YYSTYPE
{
-/* Line 214 of yacc.c */
-#line 395 "vm_var_syntax.y"
+/* Line 293 of yacc.c */
+#line 408 "vm_var_syntax.y"
char * val_str;
int val_int;
@@ -502,8 +514,8 @@ typedef union YYSTYPE
-/* Line 214 of yacc.c */
-#line 507 "vm_var_syntax.cc"
+/* Line 293 of yacc.c */
+#line 519 "vm_var_syntax.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -527,8 +539,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 532 "vm_var_syntax.cc"
+/* Line 343 of yacc.c */
+#line 544 "vm_var_syntax.cc"
#ifdef short
# undef short
@@ -631,11 +643,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -658,24 +670,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -706,23 +718,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -742,6 +738,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 7
/* YYLAST -- Last index in YYTABLE. */
@@ -814,7 +830,7 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 419, 419, 420, 423, 427, 440, 455
+ 0, 432, 432, 433, 436, 440, 453, 468
};
#endif
@@ -851,8 +867,8 @@ static const yytype_uint8 yyr2[] =
0, 2, 1, 2, 1, 2, 5, 9
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -883,8 +899,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -892,6 +907,12 @@ static const yytype_uint8 yytable[] =
2, 12, 13, 14, 15, 16, 8, 0, 17
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-5))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
0, 5, 4, 7, 6, -1, 9, 10, 9, 9,
@@ -939,7 +960,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -1207,7 +1227,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1310,115 +1329,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
{
- int yyn = yypact[yystate];
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
}
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1461,6 +1507,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, vm, parsed, errmsg)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1477,12 +1524,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1698,7 +1742,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1729,8 +1773,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1786,17 +1830,17 @@ yyreduce:
{
case 4:
-/* Line 1464 of yacc.c */
-#line 424 "vm_var_syntax.y"
+/* Line 1806 of yacc.c */
+#line 437 "vm_var_syntax.y"
{
(*parsed) << (yyvsp[(1) - (1)].val_str);
- ;}
+ }
break;
case 5:
-/* Line 1464 of yacc.c */
-#line 428 "vm_var_syntax.y"
+/* Line 1806 of yacc.c */
+#line 441 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (2)].val_str));
@@ -1808,13 +1852,13 @@ yyreduce:
{
(*parsed) << (yyvsp[(2) - (2)].val_char);
}
- ;}
+ }
break;
case 6:
-/* Line 1464 of yacc.c */
-#line 441 "vm_var_syntax.y"
+/* Line 1806 of yacc.c */
+#line 454 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (5)].val_str));
string vname((yyvsp[(3) - (5)].val_str));
@@ -1828,13 +1872,13 @@ yyreduce:
{
(*parsed) << (yyvsp[(5) - (5)].val_char);
}
- ;}
+ }
break;
case 7:
-/* Line 1464 of yacc.c */
-#line 456 "vm_var_syntax.y"
+/* Line 1806 of yacc.c */
+#line 469 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (9)].val_str));
string vname((yyvsp[(3) - (9)].val_str));
@@ -1851,15 +1895,26 @@ yyreduce:
{
(*parsed) << (yyvsp[(9) - (9)].val_char);
}
- ;}
+ }
break;
-/* Line 1464 of yacc.c */
-#line 1861 "vm_var_syntax.cc"
+/* Line 1806 of yacc.c */
+#line 1905 "vm_var_syntax.cc"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -1888,6 +1943,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -1895,37 +1954,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (&yylloc, mc, vm, parsed, errmsg, YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (&yylloc, mc, vm, parsed, errmsg, yymsg);
- }
- else
- {
- yyerror (&yylloc, mc, vm, parsed, errmsg, YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (&yylloc, mc, vm, parsed, errmsg, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -1985,7 +2043,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2049,8 +2107,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, mc, vm, parsed, errmsg);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, mc, vm, parsed, errmsg);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -2075,8 +2138,8 @@ yyreturn:
-/* Line 1684 of yacc.c */
-#line 474 "vm_var_syntax.y"
+/* Line 2067 of yacc.c */
+#line 487 "vm_var_syntax.y"
extern "C" void vm_var__error(
diff --git a/src/vm/vm_var_syntax.h b/src/vm/vm_var_syntax.h
index 8d099c1d0a..d40f8d1d51 100644
--- a/src/vm/vm_var_syntax.h
+++ b/src/vm/vm_var_syntax.h
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -56,8 +55,8 @@
typedef union YYSTYPE
{
-/* Line 1685 of yacc.c */
-#line 395 "vm_var_syntax.y"
+/* Line 2068 of yacc.c */
+#line 408 "vm_var_syntax.y"
char * val_str;
int val_int;
@@ -65,8 +64,8 @@ typedef union YYSTYPE
-/* Line 1685 of yacc.c */
-#line 70 "vm_var_syntax.hh"
+/* Line 2068 of yacc.c */
+#line 69 "vm_var_syntax.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/src/vm/vm_var_syntax.y b/src/vm/vm_var_syntax.y
index ae83471f07..bd75e41a02 100644
--- a/src/vm/vm_var_syntax.y
+++ b/src/vm/vm_var_syntax.y
@@ -245,7 +245,7 @@ void get_network_attribute(VirtualMachine * vm,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
-/*
+
void get_user_attribute(VirtualMachine * vm,
const string& attr_name,
string& attr_value)
@@ -275,7 +275,7 @@ void get_user_attribute(VirtualMachine * vm,
user->unlock();
}
-*/
+
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@@ -346,6 +346,19 @@ void insert_vector(VirtualMachine * vm,
return;
}
+ else if (name == "USER")
+ {
+ string value;
+
+ get_user_attribute(vm, vname, value);
+
+ if (!value.empty())
+ {
+ parsed << value;
+ }
+
+ return;
+ }
else
{
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
diff --git a/src/vmm/VirtualMachineManager.cc b/src/vmm/VirtualMachineManager.cc
index fc43d3380f..94706f35f8 100644
--- a/src/vmm/VirtualMachineManager.cc
+++ b/src/vmm/VirtualMachineManager.cc
@@ -245,12 +245,80 @@ void VirtualMachineManager::do_action(const string &action, void * arg)
/* Manager Actions */
/* ************************************************************************** */
+string * VirtualMachineManager::format_message(
+ const string& hostname,
+ const string& net_drv,
+ const string& m_hostname,
+ const string& m_net_drv,
+ const string& domain,
+ const string& ldfile,
+ const string& rdfile,
+ const string& cfile,
+ const string& tmpl)
+{
+ ostringstream oss;
+
+ oss << ""
+ << "" << hostname << ""
+ << "" << net_drv << "";
+
+ if (!m_hostname.empty())
+ {
+ oss << "" << m_hostname << ""
+ << ""<< m_net_drv << "";
+ }
+ else
+ {
+ oss << "";
+ }
+
+ if (!domain.empty())
+ {
+ oss << "" << domain << "";
+ }
+ else
+ {
+ oss << "";
+ }
+
+ if (!ldfile.empty())
+ {
+ oss << "" << ldfile << "";
+ oss << "" << rdfile << "";
+ }
+ else
+ {
+ oss << "";
+ oss << "";
+ }
+
+ if (!cfile.empty())
+ {
+ oss << "" << cfile << "";
+ }
+ else
+ {
+ oss << "";
+ }
+
+ oss << tmpl
+ << "";
+
+ return SSLTools::base64_encode(oss.str());
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
void VirtualMachineManager::deploy_action(int vid)
{
- VirtualMachine * vm;
- const VirtualMachineManagerDriver * vmd;
- int rc;
- ostringstream os;
+ VirtualMachine * vm;
+ const VirtualMachineManagerDriver * vmd;
+ int rc;
+
+ ostringstream os;
+ string vm_tmpl;
+ string * drv_msg;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -287,7 +355,20 @@ void VirtualMachineManager::deploy_action(int vid)
}
// Invoke driver method
- vmd->deploy(vid,vm->get_hostname(),vm->get_remote_deployment_file());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ "",
+ vm->get_deployment_file(),
+ vm->get_remote_deployment_file(),
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->deploy(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
@@ -326,8 +407,11 @@ void VirtualMachineManager::save_action(
{
VirtualMachine * vm;
const VirtualMachineManagerDriver * vmd;
- string hostname;
- ostringstream os;
+
+ string hostname, vnm_mad;
+ string vm_tmpl;
+ string * drv_msg;
+ ostringstream os;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -359,20 +443,32 @@ void VirtualMachineManager::save_action(
}
hostname = vm->get_previous_hostname();
+ vnm_mad = vm->get_previous_vnm_mad();
}
else
{
- hostname=vm->get_hostname();
+ hostname = vm->get_hostname();
+ vnm_mad = vm->get_vnm_mad();
}
// Invoke driver method
- vmd->save(
- vid,
+ drv_msg = format_message(
hostname,
+ vnm_mad,
+ "",
+ "",
vm->get_deploy_id(),
- vm->get_checkpoint_file());
+ "",
+ "",
+ vm->get_checkpoint_file(),
+ vm->to_xml(vm_tmpl));
+
+ vmd->save(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -406,9 +502,12 @@ error_common:
void VirtualMachineManager::shutdown_action(
int vid)
{
- VirtualMachine * vm;
- const VirtualMachineManagerDriver * vmd;
- ostringstream os;
+ VirtualMachine * vm;
+ const VirtualMachineManagerDriver * vmd;
+
+ string vm_tmpl;
+ string * drv_msg;
+ ostringstream os;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -432,9 +531,23 @@ void VirtualMachineManager::shutdown_action(
}
// Invoke driver method
- vmd->shutdown(vid,vm->get_hostname(),vm->get_deploy_id());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->shutdown(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -466,6 +579,9 @@ void VirtualMachineManager::cancel_action(
VirtualMachine * vm;
ostringstream os;
+ string vm_tmpl;
+ string * drv_msg;
+
const VirtualMachineManagerDriver * vmd;
// Get the VM from the pool
@@ -490,9 +606,23 @@ void VirtualMachineManager::cancel_action(
}
// Invoke driver method
- vmd->cancel(vid,vm->get_hostname(),vm->get_deploy_id());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->cancel(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -527,6 +657,9 @@ void VirtualMachineManager::cancel_previous_action(
VirtualMachine * vm;
ostringstream os;
+ string vm_tmpl;
+ string * drv_msg;
+
const VirtualMachineManagerDriver * vmd;
// Get the VM from the pool
@@ -551,9 +684,23 @@ void VirtualMachineManager::cancel_previous_action(
}
// Invoke driver method
- vmd->cancel(vid,vm->get_previous_hostname(),vm->get_deploy_id());
+ drv_msg = format_message(
+ vm->get_previous_hostname(),
+ vm->get_previous_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->cancel(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -579,7 +726,10 @@ void VirtualMachineManager::migrate_action(
{
VirtualMachine * vm;
const VirtualMachineManagerDriver * vmd;
- ostringstream os;
+
+ ostringstream os;
+ string vm_tmpl;
+ string * drv_msg;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -608,10 +758,20 @@ void VirtualMachineManager::migrate_action(
}
// Invoke driver method
- vmd->migrate(vid,
- vm->get_previous_hostname(),
- vm->get_deploy_id(),
- vm->get_hostname());
+ drv_msg = format_message(
+ vm->get_previous_hostname(),
+ vm->get_previous_vnm_mad(),
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->migrate(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
@@ -648,9 +808,13 @@ error_common:
void VirtualMachineManager::restore_action(
int vid)
{
- VirtualMachine * vm;
- const VirtualMachineManagerDriver * vmd;
- ostringstream os;
+ VirtualMachine * vm;
+ const VirtualMachineManagerDriver * vmd;
+
+ ostringstream os;
+
+ string vm_tmpl;
+ string * drv_msg;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -674,12 +838,23 @@ void VirtualMachineManager::restore_action(
}
// Invoke driver method
- vmd->restore(vid,
- vm->get_hostname(),
- vm->get_deploy_id(),
- vm->get_checkpoint_file());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ vm->get_checkpoint_file(),
+ vm->to_xml(vm_tmpl));
+
+ vmd->restore(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -708,9 +883,13 @@ error_common:
void VirtualMachineManager::poll_action(
int vid)
{
- VirtualMachine * vm;
- const VirtualMachineManagerDriver * vmd;
- ostringstream os;
+ VirtualMachine * vm;
+ const VirtualMachineManagerDriver * vmd;
+
+ ostringstream os;
+
+ string vm_tmpl;
+ string * drv_msg;
// Get the VM from the pool
vm = vmpool->get(vid,true);
@@ -734,9 +913,23 @@ void VirtualMachineManager::poll_action(
}
// Invoke driver method
- vmd->poll(vid,vm->get_hostname(),vm->get_deploy_id());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->poll(vid, *drv_msg);
+
+ delete drv_msg;
vm->unlock();
+
return;
error_history:
@@ -824,6 +1017,9 @@ void VirtualMachineManager::timer_action()
const VirtualMachineManagerDriver * vmd;
+ string vm_tmpl;
+ string * drv_msg;
+
mark = mark + timer_period;
if ( mark >= 600 )
@@ -874,7 +1070,20 @@ void VirtualMachineManager::timer_action()
continue;
}
- vmd->poll(*it,vm->get_hostname(),vm->get_deploy_id());
+ drv_msg = format_message(
+ vm->get_hostname(),
+ vm->get_vnm_mad(),
+ "",
+ "",
+ vm->get_deploy_id(),
+ "",
+ "",
+ "",
+ vm->to_xml(vm_tmpl));
+
+ vmd->poll(*it, *drv_msg);
+
+ delete drv_msg;
vmpool->update(vm);
diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc
index 4b58f06f2f..d20db0f5e0 100644
--- a/src/vmm/VirtualMachineManagerDriver.cc
+++ b/src/vmm/VirtualMachineManagerDriver.cc
@@ -104,13 +104,12 @@ void VirtualMachineManagerDriver::get_default(
void VirtualMachineManagerDriver::deploy (
const int oid,
- const string& host,
- const string& conf) const
+ const string& drv_msg) const
{
ostringstream os;
- os << "DEPLOY " << oid << " " << host << " " << conf << " -" << endl;
-
+ os << "DEPLOY " << oid << " " << drv_msg << endl;
+
write(os);
};
@@ -119,12 +118,11 @@ void VirtualMachineManagerDriver::deploy (
void VirtualMachineManagerDriver::shutdown (
const int oid,
- const string& host,
- const string& name) const
+ const string& drv_msg) const
{
ostringstream os;
- os << "SHUTDOWN " << oid << " " << host << " " << name << " -" << endl;
+ os << "SHUTDOWN " << oid << " " << drv_msg << endl;
write(os);
};
@@ -134,12 +132,11 @@ void VirtualMachineManagerDriver::shutdown (
void VirtualMachineManagerDriver::cancel (
const int oid,
- const string& host,
- const string& name) const
+ const string& drv_msg) const
{
ostringstream os;
- os << "CANCEL " << oid << " " << host << " " << name << " -" << endl;
+ os << "CANCEL " << oid << " " << drv_msg << endl;
write(os);
};
@@ -149,13 +146,11 @@ void VirtualMachineManagerDriver::cancel (
void VirtualMachineManagerDriver::checkpoint (
const int oid,
- const string& host,
- const string& name,
- const string& file) const
+ const string& drv_msg) const
{
ostringstream os;
- os<< "CHECKPOINT " << oid<< " "<< host<< " "<< name<< " "<< file<< endl;
+ os<< "CHECKPOINT " << oid << " " << drv_msg << endl;
write(os);
};
@@ -165,13 +160,11 @@ void VirtualMachineManagerDriver::checkpoint (
void VirtualMachineManagerDriver::save (
const int oid,
- const string& host,
- const string& name,
- const string& file) const
+ const string& drv_msg) const
{
ostringstream os;
- os<< "SAVE " << oid << " " << host << " " << name << " "<< file << endl;
+ os<< "SAVE " << oid << " " << drv_msg << endl;
write(os);
};
@@ -181,13 +174,11 @@ void VirtualMachineManagerDriver::save (
void VirtualMachineManagerDriver::restore (
const int oid,
- const string& host,
- const string& name,
- const string& file) const
+ const string& drv_msg) const
{
ostringstream os;
- os << "RESTORE " << oid << " " << host << " " << name << " " << file<< endl;
+ os << "RESTORE " << oid << " " << drv_msg << endl;
write(os);
};
@@ -197,13 +188,11 @@ void VirtualMachineManagerDriver::restore (
void VirtualMachineManagerDriver::migrate (
const int oid,
- const string& shost,
- const string& name,
- const string& dhost) const
+ const string& drv_msg) const
{
ostringstream os;
- os<< "MIGRATE " << oid << " "<< shost<< " "<< name<< " "<< dhost<< endl;
+ os<< "MIGRATE " << oid << " " << drv_msg << endl;
write(os);
};
@@ -213,12 +202,11 @@ void VirtualMachineManagerDriver::migrate (
void VirtualMachineManagerDriver::poll (
const int oid,
- const string& host,
- const string& name) const
+ const string& drv_msg) const
{
ostringstream os;
- os << "POLL " << oid << " " << host << " " << name << " -" << endl;
+ os << "POLL " << oid << " " << drv_msg << endl;
write(os);
};
diff --git a/src/vmm/XMLDriver.cc b/src/vmm/XMLDriver.cc
index 2879211e64..4329b71f30 100644
--- a/src/vmm/XMLDriver.cc
+++ b/src/vmm/XMLDriver.cc
@@ -35,9 +35,7 @@ int XMLDriver::deployment_description(
return -1;
}
- vm->template_to_xml(xml);
-
- file << xml ;
+ file << vm->template_to_xml(xml);
file.close();
diff --git a/src/vmm_mad/dummy/one_vmm_dummy.rb b/src/vmm_mad/dummy/one_vmm_dummy.rb
index 1d7b84470b..f424a12c13 100755
--- a/src/vmm_mad/dummy/one_vmm_dummy.rb
+++ b/src/vmm_mad/dummy/one_vmm_dummy.rb
@@ -39,31 +39,36 @@ class DummyDriver < VirtualMachineDriver
)
end
- def deploy(id, host, remote_dfile, not_used)
- send_message(ACTION[:deploy],RESULT[:success],id,"dummy")
+ def deploy(id, drv_message)
+ msg = decode(drv_message)
+
+ host = msg.elements["HOST"].text
+ name = msg.elements["VM/NAME"].text
+
+ send_message(ACTION[:deploy],RESULT[:success],id,"#{host}:#{name}:dummy")
end
- def shutdown(id, host, deploy_id, not_used)
+ def shutdown(id, drv_message)
send_message(ACTION[:shutdown],RESULT[:success],id)
end
- def cancel(id, host, deploy_id, not_used)
+ def cancel(id, drv_message)
send_message(ACTION[:cancel],RESULT[:success],id)
end
- def save(id, host, deploy_id, file)
+ def save(id, drv_message)
send_message(ACTION[:save],RESULT[:success],id)
end
- def restore(id, host, deploy_id , file)
+ def restore(id, drv_message)
send_message(ACTION[:restore],RESULT[:success],id)
end
- def migrate(id, host, deploy_id, dest_host)
+ def migrate(id, drv_message)
send_message(ACTION[:migrate],RESULT[:success],id)
end
- def poll(id, host, deploy_id, not_used)
+ def poll(id, drv_message)
# monitor_info: string in the form "VAR=VAL VAR=VAL ... VAR=VAL"
# known VAR are in POLL_ATTRIBUTES. VM states VM_STATES
monitor_info = "#{POLL_ATTRIBUTE[:state]}=#{VM_STATE[:active]} " \
diff --git a/src/vmm_mad/ec2/one_vmm_ec2.rb b/src/vmm_mad/ec2/one_vmm_ec2.rb
index 10441c1115..f5346e58f9 100755
--- a/src/vmm_mad/ec2/one_vmm_ec2.rb
+++ b/src/vmm_mad/ec2/one_vmm_ec2.rb
@@ -89,9 +89,12 @@ class EC2Driver < VirtualMachineDriver
end
# DEPLOY action, also sets ports and ip if needed
- def deploy(id, host, remote_dfile, not_used)
+ def deploy(id, drv_message)
+ msg = decode(drv_message)
- local_dfile = get_local_deployment_file(remote_dfile)
+ host = msg.elements["HOST"].text
+
+ local_dfile = msg.elements["LOCAL_DEPLOYMENT_FILE"].text
if !local_dfile
send_message(ACTION[:deploy],RESULT[:failure],id,
@@ -175,17 +178,31 @@ class EC2Driver < VirtualMachineDriver
end
# Shutdown a EC2 instance
- def shutdown(id, host, deploy_id, not_used)
+ def shutdown(id, drv_message)
+ msg = decode(drv_message)
+
+ host = msg.elements["HOST"].text
+ deploy_id = msg.elements["DEPLOY_ID"].text
+
ec2_terminate(ACTION[:shutdown], id, deploy_id)
end
# Cancel a EC2 instance
- def cancel(id, host, deploy_id, not_used)
+ def cancel(id, drv_message)
+ msg = decode(drv_message)
+
+ host = msg.elements["HOST"].text
+ deploy_id = msg.elements["DEPLOY_ID"].text
+
ec2_terminate(ACTION[:cancel], id, deploy_id)
end
# Get info (IP, and state) for a EC2 instance
- def poll(id, host, deploy_id, not_used)
+ def poll(id, drv_message)
+ msg = decode(drv_message)
+
+ host = msg.elements["HOST"].text
+ deploy_id = msg.elements["DEPLOY_ID"].text
info = "#{POLL_ATTRIBUTE[:usedmemory]}=0 " \
"#{POLL_ATTRIBUTE[:usedcpu]}=0 " \
diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb
index fff1872265..b16867ee56 100755
--- a/src/vmm_mad/exec/one_vmm_exec.rb
+++ b/src/vmm_mad/exec/one_vmm_exec.rb
@@ -16,7 +16,6 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-
# Set up the environment for the driver
ONE_LOCATION = ENV["ONE_LOCATION"]
@@ -32,12 +31,188 @@ end
$: << RUBY_LIB_LOCATION
require "VirtualMachineDriver"
+require 'one_vnm'
require 'getoptlong'
+require 'ssh_stream'
+
+require 'pp'
+
+class VmmAction
+ attr_reader :data
+
+ # Initialize a VmmAction object
+ # @param[OpenNebula::ExecDriver] Driver to be used for the actions
+ # @param[String] Id of the VM
+ # @param[String] name of the actions as described in the VMM protocol
+ # @param[xml_data] data sent from OpenNebula core
+ def initialize(driver, id, action, xml_data)
+ # Initialize object with xml data
+ @vmm = driver
+ @id = id
+
+ @main_action = action
+ @xml_data = @vmm.decode(xml_data)
+
+ @data = Hash.new
+
+ get_data(:host)
+ get_data(:net_drv)
+ get_data(:deploy_id)
+ get_data(:checkpoint_file)
+
+ get_data(:local_dfile, :LOCAL_DEPLOYMENT_FILE)
+ get_data(:remote_dfile, :REMOTE_DEPLOYMENT_FILE)
+
+ # For migration
+ get_data(:dest_host, :MIGR_HOST)
+ get_data(:dest_driver, :MIGR_NET_DRV)
+
+ # Initialize streams and vnm
+ @ssh_src = @vmm.get_ssh_stream(@data[:host], @id)
+ @vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
+ :local_actions => @vmm.options[:local_actions],
+ :message => @xml_data,
+ :ssh_stream => @ssh_src)
+
+ if @data[:dest_host] and !@data[:dest_host].empty?
+ @ssh_dst = @vmm.get_ssh_stream(@data[:dest_host], @id)
+ @vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
+ :local_actions => @vmm.options[:local_actions],
+ :message => @xml_data,
+ :ssh_stream => @ssh_dst)
+ end
+ end
+
+ #Execute a set of steps defined with
+ # - :driver :vmm or :vnm to execute the step
+ # - :action for the step
+ # - :parameters command line paremeters for the action
+ # - :destination use next host
+ # - :fail_action steps to be executed if steps fail
+ # - :stdin for the action
+ # @param [Array] of steps
+ def run(steps, info_on_success = nil)
+ result = execute_steps(steps)
+
+ #Prepare the info for the OpenNebula core
+ if DriverExecHelper.failed?(result)
+ info = @data[:failed_info]
+ else
+ info = @data["#{@main_action.to_s}_info".to_sym]
+ end
+
+ @vmm.send_message(VirtualMachineDriver::ACTION[@main_action],
+ result, @id, info)
+ end
+
+ private
+
+ DRIVER_NAMES = {
+ :vmm => "virtualization driver",
+ :vnm => "network driver"
+ }
+
+ # Executes a set of steps. If one step fails any recover action is performed
+ # and the step execution breaks.
+ # @param [Array] array of steps to be executed
+ # @return [String, Hash] "SUCCESS/FAILURE" for the step set, and
+ # information associated to each step (by :_info). In case of
+ # failure information is also in [:failed_info]
+ def execute_steps(steps)
+ result = DriverExecHelper.const_get(:RESULT)[:failure]
+
+ steps.each do |step|
+ # Execute Step
+ case step[:driver]
+ when :vmm
+ if step[:destination]
+ host = @data[:dest_host]
+ ssh = @ssh_dst
+ else
+ host = @data[:host]
+ ssh = @ssh_src
+ end
+
+ result, info = @vmm.do_action(get_parameters(step[:parameters]),
+ @id,
+ host,
+ step[:action],
+ :ssh_stream => ssh,
+ :respond => false,
+ :stdin => step[:stdin])
+ when :vnm
+ if step[:destination]
+ vnm = @vnm_dst
+ else
+ vnm = @vnm_src
+ end
+
+ result, info = vnm.do_action(@id, step[:action])
+ else
+ result = DriverExecHelper.const_get(:RESULT)[:failure]
+ info = "No driver in #{step[:action]}"
+ end
+
+ # Save the step info
+ @data["#{step[:action]}_info".to_sym] = info
+
+ # Roll back steps, store failed info and break steps
+ if DriverExecHelper.failed?(result)
+ execute_steps(@data[:fail_actions]) if @data[:fail_actions]
+ @data[:failed_info] = info
+
+ @vmm.log(@id,
+ "Failed to execute #{DRIVER_NAMES[step[:driver]]} " \
+ "operation: #{step[:action]}.")
+ break
+ else
+ @vmm.log(@id,
+ "Sussecfully execute #{DRIVER_NAMES[step[:driver]]} " \
+ "operation: #{step[:action]}.")
+ end
+ end
+
+ return result
+ end
+
+ # Prepare the parameters for the action step generating a blanck separated
+ # list of command arguments
+ # @param [Hash] an action step
+ def get_parameters(step_params)
+ parameters = step_params || []
+
+ parameters.map do |param|
+ if Symbol===param
+ @data[param].to_s
+ else
+ param
+ end
+ end.join(' ')
+ end
+
+ # Extracts data from the XML argument of the VMM action
+ # @param [Symbol] corresponding to a XML element
+ # @param [String] an xpath for the XML element
+ # @return [String] the element value
+ def get_data(name, xml_path=nil)
+ if xml_path
+ path=xml_path.to_s
+ else
+ path=name.to_s.upcase
+ end
+
+ @data[name]=@xml_data.elements[path].text
+ end
+end
+
# The main class for the Sh driver
class ExecDriver < VirtualMachineDriver
+ attr_reader :options
- # SshDriver constructor
+ # Initializes the VMM driver
+ # @param [String] hypervisor name identifies the plugin
+ # @param [OpenNebulaDriver::options]
def initialize(hypervisor, options={})
@options={
:threaded => true
@@ -48,9 +223,29 @@ class ExecDriver < VirtualMachineDriver
@hypervisor = hypervisor
end
+ # Creates an SshStream to execute commands on the target host
+ # @param[String] the hostname of the host
+ # @param[String] id of the VM to log messages
+ # @return [SshStreamCommand]
+ def get_ssh_stream(host, id)
+ SshStreamCommand.new(host,
+ @remote_scripts_base_path,
+ log_method(id))
+ end
+
+ #---------------------------------------------------------------------------
+ # Virtual Machine Manager Protocol Actions
+ #---------------------------------------------------------------------------
+ #
# DEPLOY action, sends the deployment file to remote host
- def deploy(id, host, remote_dfile, not_used)
- local_dfile = get_local_deployment_file(remote_dfile)
+ #
+ def deploy(id, drv_message)
+ action = VmmAction.new(self, id, :deploy, drv_message)
+
+ # ----------------------------------------------------------------------
+ # Initialization of deployment data
+ # ----------------------------------------------------------------------
+ local_dfile=action.data[:local_dfile]
if !local_dfile || File.zero?(local_dfile)
send_message(ACTION[:deploy],RESULT[:failure],id,
@@ -58,48 +253,207 @@ class ExecDriver < VirtualMachineDriver
return
end
- tmp = File.new(local_dfile)
- domain = tmp.read
- tmp.close()
+ domain = File.read(local_dfile)
if action_is_local?(:deploy)
- dfile=local_dfile
+ dfile = action.data[:local_dfile]
else
- dfile=remote_dfile
+ dfile = action.data[:remote_dfile]
end
- do_action("#{dfile} #{host}", id, host, :deploy,
- :stdin => domain)
+ # ----------------------------------------------------------------------
+ # Deployment Steps
+ # ----------------------------------------------------------------------
+
+ steps=[
+ # Execute pre-boot networking setup
+ {
+ :driver => :vnm,
+ :action => :pre
+ },
+ # Boot the Virtual Machine
+ {
+ :driver => :vmm,
+ :action => :deploy,
+ :parameters => [dfile, :host],
+ :stdin => domain
+ },
+ # Execute post-boot networking setup
+ {
+ :driver => :vnm,
+ :action => :post,
+ :fail_actions => [
+ {
+ :driver => :vmm,
+ :action => :cancel,
+ :parameters => [:deploy_info, :host]
+ }
+ ]
+ }
+ ]
+
+ action.run(steps)
end
- # Basic Domain Management Operations
+ #
+ # SHUTDOWN action, graceful shutdown and network clean up
+ #
+ def shutdown(id, drv_message)
- def shutdown(id, host, deploy_id, not_used)
- do_action("#{deploy_id} #{host}", id, host, :shutdown)
+ action = VmmAction.new(self, id, :shutdown, drv_message)
+
+ steps=[
+ # Shutdown the Virtual Machine
+ {
+ :driver => :vmm,
+ :action => :shutdown,
+ :parameters => [:deploy_id, :host]
+ },
+ # Execute networking clean up operations
+ {
+ :driver => :vnm,
+ :action => :clean
+ }
+ ]
+
+ action.run(steps)
end
- def cancel(id, host, deploy_id, not_used)
- do_action("#{deploy_id} #{host}", id, host, :cancel)
+ #
+ # CANCEL action, destroys a VM and network clean up
+ #
+ def cancel(id, drv_message)
+ action = VmmAction.new(self, id, :cancel, drv_message)
+
+ steps=[
+ # Cancel the Virtual Machine
+ {
+ :driver => :vmm,
+ :action => :cancel,
+ :parameters => [:deploy_id, :host]
+ },
+ # Execute networking clean up operations
+ {
+ :driver => :vnm,
+ :action => :clean
+ }
+ ]
+
+ action.run(steps)
end
- def save(id, host, deploy_id, file)
- do_action("#{deploy_id} #{file} #{host}", id, host, :save)
+ #
+ # SAVE action, stops the VM and saves its state, network is cleaned up
+ #
+ def save(id, drv_message)
+ action = VmmAction.new(self, id, :save, drv_message)
+
+ steps=[
+ # Save the Virtual Machine state
+ {
+ :driver => :vmm,
+ :action => :save,
+ :parameters => [:deploy_id, :checkpoint_file, :host]
+ },
+ # Execute networking clean up operations
+ {
+ :driver => :vnm,
+ :action => :clean
+ }
+ ]
+
+ action.run(steps)
end
- def restore(id, host, deploy_id, file)
- do_action("#{file} #{host}", id, host, :restore)
+ #
+ # RESTORE action, restore a VM from a previous state, and restores network
+ #
+ def restore(id, drv_message)
+ action=VmmAction.new(self, id, :restore, drv_message)
+
+ steps=[
+ # Execute pre-boot networking setup
+ {
+ :driver => :vnm,
+ :action => :pre
+ },
+ # Restore the Virtual Machine from checkpoint
+ {
+ :driver => :vmm,
+ :action => :restore,
+ :parameters => [:checkpoint_file, :host]
+ },
+ # Execute post-boot networking setup
+ {
+ :driver => :vnm,
+ :action => :post,
+ :fail_actions => [
+ {
+ :driver => :vmm,
+ :action => :cancel,
+ :parameters => [:deploy_id, :host]
+ }
+ ],
+ }
+ ]
+
+ action.run(steps)
end
- def migrate(id, host, deploy_id, dest_host)
- do_action("#{deploy_id} #{dest_host} #{host}", id, host, :migrate)
+ #
+ # MIGRATE (live) action, migrates a VM to another host creating network
+ #
+ def migrate(id, drv_message)
+ action=VmmAction.new(self, id, :migrate, drv_message)
+
+ steps=[
+ # Execute pre-boot networking setup on migrating host
+ {
+ :driver => :vnm,
+ :action => :pre,
+ :destination => true
+ },
+ # Migrate the Virtual Machine
+ {
+ :driver => :vmm,
+ :action => :migrate,
+ :parameters => [:deploy_id, :dest_host, :host]
+ },
+ # Execute networking clean up operations
+ {
+ :driver => :vnm,
+ :action => :clean
+ },
+ # Execute post-boot networking setup on migrating host
+ {
+ :driver => :vnm,
+ :action => :post,
+ :destination => :true
+ #TODO :fail_action what to do here? cancel VM?
+ },
+ ]
+
+ action.run(steps)
end
- def poll(id, host, deploy_id, not_used)
+ #
+ # POLL action, gets information of a VM
+ #
+ def poll(id, drv_message)
+ data = decode(drv_message)
+ host = data.elements['HOST'].text
+ deploy_id = data.elements['DEPLOY_ID'].text
+
do_action("#{deploy_id} #{host}", id, host, :poll)
end
end
-# SshDriver Main program
+################################################################################
+#
+# Virtual Machine Manager Execution Driver - Main Program
+#
+################################################################################
+
opts = GetoptLong.new(
[ '--retries', '-r', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ],
@@ -138,3 +492,5 @@ exec_driver = ExecDriver.new(hypervisor,
:local_actions => local_actions)
exec_driver.start_driver
+
+
diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc
index a1bdb86264..cdb5bde990 100644
--- a/src/vnm/VirtualNetwork.cc
+++ b/src/vnm/VirtualNetwork.cc
@@ -25,6 +25,8 @@
#include "AuthManager.h"
+#define TO_UPPER(S) transform(S.begin(),S.end(),S.begin(),(int(*)(int))toupper)
+
/* ************************************************************************** */
/* Virtual Network :: Constructor/Destructor */
/* ************************************************************************** */
@@ -207,6 +209,7 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
int rc;
string pub;
+ string vlan_attr;
string s_type;
unsigned int default_size = VirtualNetworkPool::default_size();
@@ -219,7 +222,7 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
// ------------ TYPE ----------------------
erase_template_attribute("TYPE",s_type);
- transform(s_type.begin(),s_type.end(),s_type.begin(),(int(*)(int))toupper);
+ TO_UPPER(s_type);
if (s_type == "RANGED")
{
@@ -255,6 +258,14 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
erase_template_attribute("VLAN_ID",vlan_id);
+ // ------------ VLAN ----------------------
+
+ erase_template_attribute("VLAN", vlan_attr);
+
+ TO_UPPER(vlan_attr);
+
+ vlan = (vlan_attr == "YES");
+
// ------------ BRIDGE --------------------
erase_template_attribute("BRIDGE",bridge);
@@ -272,7 +283,6 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
oss << "onebr" << oid;
bridge = oss.str();
- replace_template_attribute("BRIDGE",bridge);
}
}
@@ -280,7 +290,7 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
erase_template_attribute("PUBLIC", pub);
- transform (pub.begin(), pub.end(), pub.begin(), (int(*)(int))toupper);
+ TO_UPPER(pub);
public_obj = (pub == "YES");
@@ -515,7 +525,8 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended) const
"" << gname << "" <<
"" << name << "" <<
"" << type << "" <<
- "" << bridge << "";
+ "" << bridge << ""<<
+ "" << vlan << "";
if (!phydev.empty())
{
@@ -583,6 +594,7 @@ int VirtualNetwork::from_xml(const string &xml_str)
rc += xpath(int_type, "/VNET/TYPE", -1);
rc += xpath(bridge, "/VNET/BRIDGE", "not_found");
rc += xpath(public_obj, "/VNET/PUBLIC", 0);
+ rc += xpath(vlan, "/VNET/VLAN", 0);
xpath(phydev, "/VNET/PHYDEV", "");
xpath(vlan_id, "/VNET/VLAN_ID","");
@@ -653,6 +665,15 @@ int VirtualNetwork::nic_attribute(VectorAttribute *nic, int vid)
nic->replace("MAC" ,mac);
nic->replace("IP" ,ip);
+ if ( vlan == 1 )
+ {
+ nic->replace("VLAN", "YES");
+ }
+ else
+ {
+ nic->replace("VLAN", "NO");
+ }
+
if (!phydev.empty())
{
nic->replace("PHYDEV", phydev);
diff --git a/src/vnm/test/VirtualNetworkPoolTest.cc b/src/vnm/test/VirtualNetworkPoolTest.cc
index 2d5801309c..7cf06211be 100644
--- a/src/vnm/test/VirtualNetworkPoolTest.cc
+++ b/src/vnm/test/VirtualNetworkPoolTest.cc
@@ -71,18 +71,18 @@ const string templates[] =
const string xmls[] =
{
- "01230the_useroneadminNet number one1br100130.10.0.150:20:20:20:20:200-1",
+ "01230the_useroneadminNet number one1br1000130.10.0.150:20:20:20:20:200-1",
- "12610the_useroneadminA virtual network0br010",
+ "12610the_useroneadminA virtual network0br0010",
- "01330the_useroneadminNet number two1br100130.10.2.150:20:20:20:20:200-1",
+ "01330the_useroneadminNet number two1br1000130.10.2.150:20:20:20:20:200-1",
};
const string xml_dump =
- "010the_useroneadminNet number one1br100120the_useroneadminA virtual network0br010";
+ "010the_useroneadminNet number one1br1000120the_useroneadminA virtual network0br0010";
const string xml_dump_where =
- "120the_useroneadminA virtual network0br010";
+ "120the_useroneadminA virtual network0br0010";
/* ************************************************************************* */
/* ************************************************************************* */
@@ -310,8 +310,8 @@ public:
};
string phydev_xml[] = {
- "000the_useroneadminBRIDGE and PHYDEV1br0eth000130.10.0.150:20:20:20:20:200-1",
- "100the_useroneadminNo BRIDGE only PHYDEV1onebr1eth000130.10.0.150:20:20:20:20:200-1"
+ "000the_useroneadminBRIDGE and PHYDEV1br00eth000130.10.0.150:20:20:20:20:200-1",
+ "100the_useroneadminNo BRIDGE only PHYDEV1onebr10eth000130.10.0.150:20:20:20:20:200-1"
};
// test vm with bridge and phydev
diff --git a/src/vnm_mad/one_vnm.rb b/src/vnm_mad/one_vnm.rb
new file mode 100644
index 0000000000..aba0339611
--- /dev/null
+++ b/src/vnm_mad/one_vnm.rb
@@ -0,0 +1,70 @@
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+require "DriverExecHelper"
+
+# This module provides an abstraction to generate an execution context for
+# OpenNebula Drivers
+
+class VirtualNetworkDriver
+ include DriverExecHelper
+
+ # Inits the VNET Driver
+ # @param [String] name of the vnet driver to use, as listed in remotes/vnet
+ # @option ops [String] :ssh_stream to be used for command execution
+ # @option ops [String] :message from ONE
+ def initialize(directory, options={})
+
+ @options = options
+ @ssh_stream = options[:ssh_stream]
+ @message = options[:message]
+
+ @vm_encoded = Base64.encode64(@message.elements['VM'].to_s).delete("\n")
+
+ initialize_helper("vnm/#{directory}", options)
+ end
+
+ # Calls remotes or local action checking the action name and
+ # @local_actions. Optional arguments can be specified as a hash
+ #
+ # @param [Number, String] id action identifier
+ # @param [String, Symbol] aname name of the action
+ # @param [Hash] ops extra options for the command
+ # @option ops [String] :stdin text to be writen to stdin
+ def do_action(id, aname, ops = {})
+ options={
+ :stdin => nil,
+ }.merge(ops)
+
+ cmd = action_command_line(aname, @vm_encoded)
+
+ if action_is_local?(aname)
+ execution = LocalCommand.run(cmd, log_method(id))
+ else
+ if options[:stdin]
+ cmdin = "cat << EOT | #{cmd}"
+ stdin = "#{options[:stdin]}\nEOT\n"
+ else
+ cmdin = cmd
+ stdin = nil
+ end
+
+ execution = @ssh_stream.run(cmdin, stdin, cmd)
+ end
+
+ result, info = get_info_from_execution(execution)
+ end
+end
\ No newline at end of file
diff --git a/src/vnm_mad/HostManaged.rb b/src/vnm_mad/remotes/802.1Q/HostManaged.rb
similarity index 87%
rename from src/vnm_mad/HostManaged.rb
rename to src/vnm_mad/remotes/802.1Q/HostManaged.rb
index bda6286ef1..47a65a3cce 100644
--- a/src/vnm_mad/HostManaged.rb
+++ b/src/vnm_mad/remotes/802.1Q/HostManaged.rb
@@ -14,6 +14,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
+require 'OpenNebulaNetwork'
+
class OpenNebulaHM < OpenNebulaNetwork
def initialize(vm, hypervisor = nil)
super(vm,hypervisor)
@@ -48,12 +50,8 @@ class OpenNebulaHM < OpenNebulaNetwork
end
end
end
- end
- def deactivate
- vm_id = @vm['ID']
- process do |nic|
- end
+ return 0
end
def bridge_exists?(bridge)
@@ -61,16 +59,16 @@ class OpenNebulaHM < OpenNebulaNetwork
end
def create_bridge(bridge)
- system("#{COMMANDS[:brctl]} addbr #{bridge}")
+ OpenNebula.exec_and_log("#{COMMANDS[:brctl]} addbr #{bridge}")
end
def device_exists?(dev, vlan=nil)
dev = "#{dev}.#{vlan}" if vlan
- system("#{COMMANDS[:ip]} link show #{dev}")
+ OpenNebula.exec_and_log("#{COMMANDS[:ip]} link show #{dev}")
end
def create_dev_vlan(dev, vlan)
- system("#{COMMANDS[:vconfig]} add #{dev} #{vlan}")
+ OpenNebula.exec_and_log("#{COMMANDS[:vconfig]} add #{dev} #{vlan}")
end
def attached_bridge_dev?(bridge, dev, vlan=nil)
@@ -81,11 +79,11 @@ class OpenNebulaHM < OpenNebulaNetwork
def attach_brigde_dev(bridge, dev, vlan=nil)
dev = "#{dev}.#{vlan}" if vlan
- system("#{COMMANDS[:brctl]} addif #{bridge} #{dev}")
+ OpenNebula.exec_and_log("#{COMMANDS[:brctl]} addif #{bridge} #{dev}")
end
def ifup(dev, vlan=nil)
dev = "#{dev}.#{vlan}" if vlan
- system("#{COMMANDS[:ip]} link set #{dev} up")
+ OpenNebula.exec_and_log("#{COMMANDS[:ip]} link set #{dev} up")
end
end
diff --git a/src/vnm_mad/remotes/802.1Q/clean b/src/vnm_mad/remotes/802.1Q/clean
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/802.1Q/clean
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/remotes/802.1Q/post b/src/vnm_mad/remotes/802.1Q/post
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/802.1Q/post
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/remotes/802.1Q/pre b/src/vnm_mad/remotes/802.1Q/pre
new file mode 100755
index 0000000000..c7ce885d28
--- /dev/null
+++ b/src/vnm_mad/remotes/802.1Q/pre
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
+
+require 'HostManaged'
+
+hm = OpenNebulaHM.from_base64(ARGV[0])
+exit hm.activate
diff --git a/src/vnm_mad/Firewall.rb b/src/vnm_mad/remotes/Firewall.rb
similarity index 99%
rename from src/vnm_mad/Firewall.rb
rename to src/vnm_mad/remotes/Firewall.rb
index 586481ef05..2cc4f98eca 100644
--- a/src/vnm_mad/Firewall.rb
+++ b/src/vnm_mad/remotes/Firewall.rb
@@ -104,7 +104,7 @@ class OpenNebulaFirewall < OpenNebulaNetwork
def run_rules(rules)
rules.flatten.each do |rule|
- system(rule)
+ OpenNebula.exec_and_log(rule)
end
end
diff --git a/src/vnm_mad/OpenNebulaNetwork.rb b/src/vnm_mad/remotes/OpenNebulaNetwork.rb
similarity index 85%
rename from src/vnm_mad/OpenNebulaNetwork.rb
rename to src/vnm_mad/remotes/OpenNebulaNetwork.rb
index c837e88214..a944adeb8d 100644
--- a/src/vnm_mad/OpenNebulaNetwork.rb
+++ b/src/vnm_mad/remotes/OpenNebulaNetwork.rb
@@ -17,9 +17,14 @@
#--------------------------------------------------------------------------- #
$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), '..')
require 'rexml/document'
require 'OpenNebulaNic'
+require 'base64'
+
+require 'scripts_common'
+include OpenNebula
CONF = {
:start_vlan => 2
@@ -28,7 +33,7 @@ CONF = {
COMMANDS = {
:ebtables => "sudo /sbin/ebtables",
:iptables => "sudo /sbin/iptables",
- :brctl => "sudo /usr/sbin/brctl",
+ :brctl => "sudo /sbin/brctl",
:ip => "sudo /sbin/ip",
:vconfig => "sudo /sbin/vconfig",
:virsh => "virsh -c qemu:///system",
@@ -37,11 +42,8 @@ COMMANDS = {
:lsmod => "/sbin/lsmod"
}
-#
-#
-#
class VM
- attr_accessor :nics, :filtered_nics, :vm_info
+ attr_accessor :nics, :vm_info
def initialize(vm_root, hypervisor)
@vm_root = vm_root
@@ -50,7 +52,7 @@ class VM
nics = Nics.new(@hypervisor)
- @vm_root.elements.each("TEMPLATE/NIC") do |nic_element|
+ @vm_root.elements.each("TEMPLATE/NIC[VLAN='YES']") do |nic_element|
nic = nics.new_nic
nic_element.elements.each('*') do |nic_attribute|
@@ -64,21 +66,12 @@ class VM
nics << nic
end
- @nics = nics
- @filtered_nics = nics
- end
-
- def filter(*filter)
- @filtered_nics = @nics.get(*filter)
- end
-
- def unfilter
- @filtered_nics = @nics
+ @nics = nics
end
def each_nic(block)
- if @filtered_nics != nil
- @filtered_nics.each do |the_nic|
+ if @nics != nil
+ @nics.each do |the_nic|
block.call(the_nic)
end
end
@@ -98,9 +91,14 @@ end
class OpenNebulaNetwork
attr_reader :hypervisor, :vm
+ def self.from_base64(vm_64, hypervisor=nil)
+ vm_xml = Base64::decode64(vm_64)
+ self.new(vm_xml, hypervisor)
+ end
+
def initialize(vm_tpl, hypervisor=nil)
if !hypervisor
- @hypervisor = detect_hypervisor
+ @hypervisor = detect_hypervisor
else
@hypervisor = hypervisor
end
@@ -108,16 +106,6 @@ class OpenNebulaNetwork
@vm = VM.new(REXML::Document.new(vm_tpl).root, @hypervisor)
end
- def filter(*filter)
- @vm.filter(*filter)
- self
- end
-
- def unfilter
- @vm.unfilter
- self
- end
-
def process(&block)
@vm.each_nic(block)
end
diff --git a/src/vnm_mad/OpenNebulaNic.rb b/src/vnm_mad/remotes/OpenNebulaNic.rb
similarity index 72%
rename from src/vnm_mad/OpenNebulaNic.rb
rename to src/vnm_mad/remotes/OpenNebulaNic.rb
index d2916a91bd..84214bd154 100644
--- a/src/vnm_mad/OpenNebulaNic.rb
+++ b/src/vnm_mad/remotes/OpenNebulaNic.rb
@@ -28,59 +28,11 @@ class Nics < Array
def new_nic
@nicClass.new
end
-
- # finds nics that match 'args'
- # 'args' can be a Hash, or an array
- # args example:
- # {:mac => "02:00:C0:A8:01:01", :bridge => "br0"}
- # :mac, "02:00:C0:A8:01:01"
- # key values may also be an array:
- # {:mac => "02:00:C0:A8:01:01", :bridge => ["br0","br1"]}
- def get(*args)
- if args.length == 2
- dict = Hash.new
- dict[args[0]] = args[1]
- elsif args.length == 1
- dict = args[0]
- else
- return nil
- end
-
- matching = Array.new
- self.each do |e|
- e_filter = Hash.new
- dict.each_key{|k| e_filter[k] = e[k]}
- if compare(e_filter,dict)
- matching << e
- end
- end
-
- if matching.empty?
- nil
- else
- matching
- end
- end
-
- def compare(hash1, hash2)
- #hash1 has a single value per key
- #hash2 may contain an array of values
- hash1.each do |k,v|
- return false if !hash2[k]
- v2 = hash2[k]
- if hash2[k].kind_of?(Array)
- return false if !v2.include? v
- else
- return false if v != v2
- end
- end
- true
- end
end
-# A NIC using KVM. This class implements functions to get the physical interface
-# that the NIC is using
+# A NIC using KVM. This class implements functions to get the physical interface
+# that the NIC is using
class NicKVM < Hash
def initialize
super(nil)
@@ -118,8 +70,8 @@ class NicKVM < Hash
end
-# A NIC using Xen. This class implements functions to get the physical interface
-# that the NIC is using
+# A NIC using Xen. This class implements functions to get the physical interface
+# that the NIC is using
class NicXen < Hash
def initialize
super(nil)
diff --git a/src/vnm_mad/remotes/dummy/clean b/src/vnm_mad/remotes/dummy/clean
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/dummy/clean
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/remotes/dummy/post b/src/vnm_mad/remotes/dummy/post
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/dummy/post
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/remotes/dummy/pre b/src/vnm_mad/remotes/dummy/pre
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/dummy/pre
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/Ebtables.rb b/src/vnm_mad/remotes/ebtables/Ebtables.rb
similarity index 91%
rename from src/vnm_mad/Ebtables.rb
rename to src/vnm_mad/remotes/ebtables/Ebtables.rb
index 71f9bb1e8e..c22ad69340 100644
--- a/src/vnm_mad/Ebtables.rb
+++ b/src/vnm_mad/remotes/ebtables/Ebtables.rb
@@ -14,15 +14,19 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
+require 'OpenNebulaNetwork'
+
class EbtablesVLAN < OpenNebulaNetwork
def initialize(vm, hypervisor = nil)
super(vm,hypervisor)
end
def ebtables(rule)
- system("#{COMMANDS[:ebtables]} -A #{rule}")
+ OpenNebula.exec_and_log("#{COMMANDS[:ebtables]} -A #{rule}")
end
+ # Activates ebtables rules
+ #
def activate
process do |nic|
tap = nic[:tap]
@@ -42,6 +46,8 @@ class EbtablesVLAN < OpenNebulaNetwork
ebtables(out_rule)
end
end
+
+ return 0
end
def deactivate
@@ -59,6 +65,8 @@ class EbtablesVLAN < OpenNebulaNetwork
end
remove_rules(tap)
end
+
+ return 0
end
def rules
@@ -74,6 +82,6 @@ class EbtablesVLAN < OpenNebulaNetwork
end
def remove_rule(rule)
- system("#{COMMANDS[:ebtables]} -D FORWARD #{rule}")
+ OpenNebula.exec_and_log("#{COMMANDS[:ebtables]} -D FORWARD #{rule}")
end
end
diff --git a/src/vnm_mad/firewall b/src/vnm_mad/remotes/ebtables/clean
similarity index 83%
rename from src/vnm_mad/firewall
rename to src/vnm_mad/remotes/ebtables/clean
index ca5507d7f9..0aaefc7e02 100755
--- a/src/vnm_mad/firewall
+++ b/src/vnm_mad/remotes/ebtables/clean
@@ -17,21 +17,12 @@
#--------------------------------------------------------------------------- #
$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
-require 'base64'
-require 'OpenNebulaNetwork'
-require 'Firewall'
+require 'Ebtables'
-action = ARGV[0]
-template = ARGV[1]
+template = ARGV[0]
-vm_xml = Base64::decode64(template)
+onevlan = EbtablesVLAN.from_base64(template)
-fw = OpenNebulaFirewall.new(vm_xml)
-
-case action
-when "on"
- fw.activate
-when "off"
- fw.deactivate
-end
+exit onevlan.deactivate
diff --git a/src/vnm_mad/ebtables-vlan b/src/vnm_mad/remotes/ebtables/post
similarity index 75%
rename from src/vnm_mad/ebtables-vlan
rename to src/vnm_mad/remotes/ebtables/post
index d4e72abe34..c142e41a2f 100755
--- a/src/vnm_mad/ebtables-vlan
+++ b/src/vnm_mad/remotes/ebtables/post
@@ -17,24 +17,9 @@
#--------------------------------------------------------------------------- #
$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
-require 'base64'
-require 'OpenNebulaNetwork'
require 'Ebtables'
-action = ARGV[0]
-template = ARGV[1]
-
-# Uncomment to act only on the listed bridges.
-#FILTERED_BRIDGES = ['br0']
-
-vm_xml = Base64::decode64(template)
-onevlan = EbtablesVLAN.new(vm_xml)
-
-case action
-when "on"
- onevlan.filter(:bridge => FILTERED_BRIDGES) if defined? FILTERED_BRIDGES
- onevlan.activate
-when "off"
- onevlan.deactivate
-end
+onevlan = EbtablesVLAN.from_base64(ARGV[0])
+exit onevlan.activate
diff --git a/src/vnm_mad/remotes/ebtables/pre b/src/vnm_mad/remotes/ebtables/pre
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/ebtables/pre
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/hm-vlan b/src/vnm_mad/remotes/fw/clean
similarity index 89%
rename from src/vnm_mad/hm-vlan
rename to src/vnm_mad/remotes/fw/clean
index 63f1dc53e1..95c11359c4 100755
--- a/src/vnm_mad/hm-vlan
+++ b/src/vnm_mad/remotes/fw/clean
@@ -17,13 +17,11 @@
#--------------------------------------------------------------------------- #
$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
-require 'base64'
require 'OpenNebulaNetwork'
-require 'HostManaged'
+require 'Firewall'
-template = ARGV[0]
-vm_xml = Base64::decode64(template)
+fw = OpenNebulaFirewall.from_base64(ARGV[0])
-hm = OpenNebulaHM.new(vm_xml)
-hm.activate
+fw.deactivate
diff --git a/src/vnm_mad/openvswitch-vlan b/src/vnm_mad/remotes/fw/post
similarity index 89%
rename from src/vnm_mad/openvswitch-vlan
rename to src/vnm_mad/remotes/fw/post
index 1cd64fcf1b..6458772e86 100755
--- a/src/vnm_mad/openvswitch-vlan
+++ b/src/vnm_mad/remotes/fw/post
@@ -17,13 +17,11 @@
#--------------------------------------------------------------------------- #
$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
-require 'base64'
require 'OpenNebulaNetwork'
-require 'OpenvSwitch'
+require 'Firewall'
-template = ARGV[0]
-vm_xml = Base64::decode64(template)
+fw = OpenNebulaFirewall.from_base64(ARGV[0])
-onevlan = OpenvSwitchVLAN.new(vm_xml)
-onevlan.activate
+fw.activate
diff --git a/src/vnm_mad/remotes/fw/pre b/src/vnm_mad/remotes/fw/pre
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/fw/pre
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/OpenvSwitch.rb b/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb
similarity index 94%
rename from src/vnm_mad/OpenvSwitch.rb
rename to src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb
index 2ba84ca1ea..9716d99f8a 100644
--- a/src/vnm_mad/OpenvSwitch.rb
+++ b/src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb
@@ -14,6 +14,8 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
+require 'OpenNebulaNetwork'
+
class OpenvSwitchVLAN < OpenNebulaNetwork
def initialize(vm, hypervisor = nil)
super(vm,hypervisor)
@@ -30,7 +32,9 @@ class OpenvSwitchVLAN < OpenNebulaNetwork
cmd = "#{COMMANDS[:ovs_vsctl]} set Port #{nic[:tap]} "
cmd << "tag=#{vlan}"
- system(cmd)
+ OpenNebula.exec_and_log(cmd)
end
+
+ return 0
end
end
diff --git a/src/vnm_mad/remotes/ovswitch/clean b/src/vnm_mad/remotes/ovswitch/clean
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/ovswitch/clean
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/remotes/ovswitch/post b/src/vnm_mad/remotes/ovswitch/post
new file mode 100755
index 0000000000..e59bd2ead6
--- /dev/null
+++ b/src/vnm_mad/remotes/ovswitch/post
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), "..")
+
+require 'OpenvSwitch'
+
+onevlan = OpenvSwitchVLAN.from_base64(ARGV[0])
+exit onevlan.activate()
diff --git a/src/vnm_mad/remotes/ovswitch/pre b/src/vnm_mad/remotes/ovswitch/pre
new file mode 100755
index 0000000000..44337c50d2
--- /dev/null
+++ b/src/vnm_mad/remotes/ovswitch/pre
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+exit 0
\ No newline at end of file
diff --git a/src/vnm_mad/test/OpenNebulaNetwork_spec.rb b/src/vnm_mad/remotes/test/OpenNebulaNetwork_spec.rb
similarity index 67%
rename from src/vnm_mad/test/OpenNebulaNetwork_spec.rb
rename to src/vnm_mad/remotes/test/OpenNebulaNetwork_spec.rb
index c8e7c14ccd..c06453ffb0 100644
--- a/src/vnm_mad/test/OpenNebulaNetwork_spec.rb
+++ b/src/vnm_mad/remotes/test/OpenNebulaNetwork_spec.rb
@@ -1,18 +1,24 @@
#!/usr/bin/env ruby
-$: << File.dirname(__FILE__) + '/..' \
- << './'
+$: << File.dirname(__FILE__) + '/..'
+$: << File.dirname(__FILE__) + '/../ebtables'
+$: << File.dirname(__FILE__) + '/../802.1Q'
+$: << File.dirname(__FILE__) + '/../ovswitch'
+$: << File.dirname(__FILE__) + '/../../../mad/ruby'
+$: << './'
+$: << File.dirname(__FILE__)
+$: << File.join(File.dirname(__FILE__), '..')
+$: << File.join(File.dirname(__FILE__),'../../../mad/ruby/')
require 'rubygems'
require 'rspec'
-require 'SystemMock'
require 'pp'
require 'OpenNebulaNetwork'
-require 'Ebtables'
+require 'ebtables/Ebtables'
require 'Firewall'
-require 'HostManaged'
-require 'OpenvSwitch'
+require '802.1Q/HostManaged'
+require 'ovswitch/OpenvSwitch'
OUTPUT = Hash.new
Dir[File.dirname(__FILE__) + "/output/**"].each do |f|
@@ -20,6 +26,9 @@ Dir[File.dirname(__FILE__) + "/output/**"].each do |f|
OUTPUT[key] = File.read(f)
end
+require 'scripts_common'
+require 'SystemMock'
+include OpenNebula
include SystemMock
RSpec.configure do |config|
@@ -36,40 +45,28 @@ describe 'networking' do
}
onevlan = OpenNebulaNetwork.new(OUTPUT[:onevm_show],"kvm")
nics_expected = [{:bridge=>"br0",
- :ip=>"172.16.0.100",
- :mac=>"02:00:ac:10:00:64",
- :network=>"Small network",
- :network_id=>"0",
- :tap=>"vnet0"},
- {:bridge=>"br1",
- :ip=>"10.1.1.1",
- :mac=>"02:00:0a:01:01:01",
- :network=>"r1",
- :network_id=>"1",
- :tap=>"vnet1"},
- {:bridge=>"br2",
- :ip=>"10.1.2.1",
- :mac=>"02:00:0a:01:02:01",
- :network=>"r2",
- :network_id=>"2",
- :tap=>"vnet2"}]
- onevlan.vm.nics.should == nics_expected
- end
-
- it "filter nics in kvm" do
- $capture_commands = {
- /virsh.*dumpxml/ => OUTPUT[:virsh_dumpxml]
- }
- onevlan = OpenNebulaNetwork.new(OUTPUT[:onevm_show],"kvm")
- onevlan.filter(:bridge => "br1")
- nics_expected = [{:bridge=>"br1",
+ :ip=>"172.16.0.100",
+ :mac=>"02:00:ac:10:00:64",
+ :network=>"Small network",
+ :network_id=>"0",
+ :vlan=>"YES",
+ :tap=>"vnet0"},
+ {:bridge=>"br1",
:ip=>"10.1.1.1",
:mac=>"02:00:0a:01:01:01",
:network=>"r1",
:network_id=>"1",
- :tap=>"vnet1"}]
-
- onevlan.vm.filtered_nics.should == nics_expected
+ :vlan=>"YES",
+ :tap=>"vnet1"},
+ {:bridge=>"br2",
+ :ip=>"10.1.2.1",
+ :mac=>"02:00:0a:01:02:01",
+ :network=>"r2",
+ :network_id=>"2",
+ :vlan=>"YES",
+ :tap=>"vnet2"}]
+
+ onevlan.vm.nics.should == nics_expected
end
end
@@ -88,7 +85,10 @@ describe 'ebtables' do
"sudo /sbin/ebtables -A FORWARD -s ! 02:00:0a:01:01:01 -i vnet1 -j DROP",
"sudo /sbin/ebtables -A FORWARD -s ! 02:00:0a:01:02:00/ff:ff:ff:ff:ff:00 -o vnet2 -j DROP",
"sudo /sbin/ebtables -A FORWARD -s ! 02:00:0a:01:02:01 -i vnet2 -j DROP"]
- $collector[:system].should == ebtables_cmds
+
+ ebtables_cmds.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
end
@@ -106,7 +106,9 @@ describe 'openvswitch' do
"sudo /usr/local/bin/ovs-vsctl set Port vnet2 tag=4"
]
- $collector[:system].should == openvswitch_tags
+ openvswitch_tags.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
it "force VLAN_ID for Open vSwitch vlans in kvm" do
@@ -117,12 +119,14 @@ describe 'openvswitch' do
}
onevlan = OpenvSwitchVLAN.new(OUTPUT[:onevm_show_vlan_id_kvm],"kvm")
onevlan.activate
-
+
onevlan_rules = ["sudo /usr/local/bin/ovs-vsctl set Port vnet0 tag=6",
"sudo /usr/local/bin/ovs-vsctl set Port vnet1 tag=50",
"sudo /usr/local/bin/ovs-vsctl set Port vnet1 tag=51"]
- $collector[:system].should == onevlan_rules
+ onevlan_rules.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
end
@@ -146,7 +150,9 @@ describe 'firewall' do
"sudo /sbin/iptables -A one-36-3 -p icmp -m state --state ESTABLISHED -j ACCEPT",
"sudo /sbin/iptables -A one-36-3 -p icmp -j DROP"]
- $collector[:system].should == fw_activate_rules
+ fw_activate_rules.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
end
@@ -155,20 +161,23 @@ describe 'host-managed' do
$capture_commands = {
/virsh.*dumpxml/ => OUTPUT[:virsh_dumpxml_phydev],
/brctl show/ => OUTPUT[:brctl_show],
- /brctl add/ => nil,
- /vconfig/ => nil,
- /ip link/ => nil
+ /brctl add/ => nil,
+ /vconfig/ => nil,
+ /ip link/ => nil
}
hm = OpenNebulaHM.new(OUTPUT[:onevm_show_phydev_kvm],"kvm")
hm.activate
- hm_activate_rules = ["sudo /usr/sbin/brctl addbr onebr6",
+ hm_activate_rules = ["sudo /sbin/brctl addbr onebr6",
"sudo /sbin/ip link set onebr6 up",
"sudo /sbin/ip link show eth0.8",
"sudo /sbin/vconfig add eth0 8",
"sudo /sbin/ip link set eth0.8 up",
- "sudo /usr/sbin/brctl addif onebr6 eth0.8"]
- $collector[:system].should == hm_activate_rules
+ "sudo /sbin/brctl addif onebr6 eth0.8"]
+
+ hm_activate_rules.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
it "force VLAN_ID for vlans in kvm" do
@@ -182,19 +191,21 @@ describe 'host-managed' do
hm = OpenNebulaHM.new(OUTPUT[:onevm_show_vlan_id_kvm],"kvm")
hm.activate
- hm_vlan_id = ["sudo /usr/sbin/brctl addbr onebr10",
+ hm_vlan_id = ["sudo /sbin/brctl addbr onebr10",
"sudo /sbin/ip link set onebr10 up",
"sudo /sbin/ip link show eth0.50",
"sudo /sbin/vconfig add eth0 50",
"sudo /sbin/ip link set eth0.50 up",
- "sudo /usr/sbin/brctl addif onebr10 eth0.50",
- "sudo /usr/sbin/brctl addbr specialbr",
+ "sudo /sbin/brctl addif onebr10 eth0.50",
+ "sudo /sbin/brctl addbr specialbr",
"sudo /sbin/ip link set specialbr up",
"sudo /sbin/ip link show eth0.51",
"sudo /sbin/vconfig add eth0 51",
"sudo /sbin/ip link set eth0.51 up",
- "sudo /usr/sbin/brctl addif specialbr eth0.51"]
+ "sudo /sbin/brctl addif specialbr eth0.51"]
- $collector[:system].should == hm_vlan_id
+ hm_vlan_id.map{|c| c + " 2>&1 1>/dev/null"}.each do |cmd|
+ $collector[:backtick].include?(cmd).should == true
+ end
end
end
diff --git a/src/vnm_mad/test/SystemMock.rb b/src/vnm_mad/remotes/test/SystemMock.rb
similarity index 88%
rename from src/vnm_mad/test/SystemMock.rb
rename to src/vnm_mad/remotes/test/SystemMock.rb
index 9c2d122d47..6e83e85411 100644
--- a/src/vnm_mad/test/SystemMock.rb
+++ b/src/vnm_mad/remotes/test/SystemMock.rb
@@ -1,14 +1,15 @@
module SystemMock
- require 'open3'
+
def execute_cmd(cmd)
if $capture_commands
$capture_commands.each do |regex, output|
if cmd.match(regex)
+ Kernel.send(:`,":;exit 0")
return output
end
end
end
- Open3.popen3(cmd){|stdin, stdout, stderr| stdout.read}
+ Kernel.send(:`,cmd)
end
def `(cmd)
diff --git a/src/vnm_mad/test/output/brctl_show b/src/vnm_mad/remotes/test/output/brctl_show
similarity index 100%
rename from src/vnm_mad/test/output/brctl_show
rename to src/vnm_mad/remotes/test/output/brctl_show
diff --git a/src/vnm_mad/test/output/kvm_lsmod b/src/vnm_mad/remotes/test/output/kvm_lsmod
similarity index 100%
rename from src/vnm_mad/test/output/kvm_lsmod
rename to src/vnm_mad/remotes/test/output/kvm_lsmod
diff --git a/src/vnm_mad/test/output/kvm_uname_a b/src/vnm_mad/remotes/test/output/kvm_uname_a
similarity index 100%
rename from src/vnm_mad/test/output/kvm_uname_a
rename to src/vnm_mad/remotes/test/output/kvm_uname_a
diff --git a/src/vnm_mad/test/output/onevm_show b/src/vnm_mad/remotes/test/output/onevm_show
similarity index 95%
rename from src/vnm_mad/test/output/onevm_show
rename to src/vnm_mad/remotes/test/output/onevm_show
index ec56cbf225..28b962f202 100644
--- a/src/vnm_mad/test/output/onevm_show
+++ b/src/vnm_mad/remotes/test/output/onevm_show
@@ -37,6 +37,7 @@
+
@@ -44,6 +45,7 @@
+
@@ -51,6 +53,7 @@
+
diff --git a/src/vnm_mad/test/output/onevm_show_phydev_kvm b/src/vnm_mad/remotes/test/output/onevm_show_phydev_kvm
similarity index 96%
rename from src/vnm_mad/test/output/onevm_show_phydev_kvm
rename to src/vnm_mad/remotes/test/output/onevm_show_phydev_kvm
index 610bcb9d74..5a7541662f 100644
--- a/src/vnm_mad/test/output/onevm_show_phydev_kvm
+++ b/src/vnm_mad/remotes/test/output/onevm_show_phydev_kvm
@@ -37,6 +37,7 @@
+
@@ -45,6 +46,7 @@
+
diff --git a/src/vnm_mad/test/output/onevm_show_vlan_id_kvm b/src/vnm_mad/remotes/test/output/onevm_show_vlan_id_kvm
similarity index 95%
rename from src/vnm_mad/test/output/onevm_show_vlan_id_kvm
rename to src/vnm_mad/remotes/test/output/onevm_show_vlan_id_kvm
index e70880289d..637838f3b5 100644
--- a/src/vnm_mad/test/output/onevm_show_vlan_id_kvm
+++ b/src/vnm_mad/remotes/test/output/onevm_show_vlan_id_kvm
@@ -37,6 +37,7 @@
+
@@ -45,6 +46,7 @@
+
@@ -54,6 +56,7 @@
+
diff --git a/src/vnm_mad/test/output/onevm_show_xen b/src/vnm_mad/remotes/test/output/onevm_show_xen
similarity index 96%
rename from src/vnm_mad/test/output/onevm_show_xen
rename to src/vnm_mad/remotes/test/output/onevm_show_xen
index bff85d160a..9f0685ad44 100644
--- a/src/vnm_mad/test/output/onevm_show_xen
+++ b/src/vnm_mad/remotes/test/output/onevm_show_xen
@@ -33,6 +33,7 @@
+
@@ -42,6 +43,7 @@
+
diff --git a/src/vnm_mad/test/output/virsh_dumpxml b/src/vnm_mad/remotes/test/output/virsh_dumpxml
similarity index 100%
rename from src/vnm_mad/test/output/virsh_dumpxml
rename to src/vnm_mad/remotes/test/output/virsh_dumpxml
diff --git a/src/vnm_mad/test/output/virsh_dumpxml_phydev b/src/vnm_mad/remotes/test/output/virsh_dumpxml_phydev
similarity index 100%
rename from src/vnm_mad/test/output/virsh_dumpxml_phydev
rename to src/vnm_mad/remotes/test/output/virsh_dumpxml_phydev
diff --git a/src/vnm_mad/test/output/virsh_dumpxml_vlan_id b/src/vnm_mad/remotes/test/output/virsh_dumpxml_vlan_id
similarity index 100%
rename from src/vnm_mad/test/output/virsh_dumpxml_vlan_id
rename to src/vnm_mad/remotes/test/output/virsh_dumpxml_vlan_id
diff --git a/src/vnm_mad/test/output/xen_lsmod b/src/vnm_mad/remotes/test/output/xen_lsmod
similarity index 100%
rename from src/vnm_mad/test/output/xen_lsmod
rename to src/vnm_mad/remotes/test/output/xen_lsmod
diff --git a/src/vnm_mad/test/output/xen_uname_a b/src/vnm_mad/remotes/test/output/xen_uname_a
similarity index 100%
rename from src/vnm_mad/test/output/xen_uname_a
rename to src/vnm_mad/remotes/test/output/xen_uname_a
diff --git a/src/vnm_mad/test/output/xm_domid b/src/vnm_mad/remotes/test/output/xm_domid
similarity index 100%
rename from src/vnm_mad/test/output/xm_domid
rename to src/vnm_mad/remotes/test/output/xm_domid
diff --git a/src/vnm_mad/test/output/xm_network_list b/src/vnm_mad/remotes/test/output/xm_network_list
similarity index 100%
rename from src/vnm_mad/test/output/xm_network_list
rename to src/vnm_mad/remotes/test/output/xm_network_list
diff --git a/src/xml/expr_arith.cc b/src/xml/expr_arith.cc
index b8c9394fbf..a27aa8c15b 100644
--- a/src/xml/expr_arith.cc
+++ b/src/xml/expr_arith.cc
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 17 "expr_arith.y"
#include
@@ -130,8 +129,8 @@ extern "C"
-/* Line 189 of yacc.c */
-#line 135 "expr_arith.cc"
+/* Line 268 of yacc.c */
+#line 134 "expr_arith.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -170,7 +169,7 @@ extern "C"
typedef union YYSTYPE
{
-/* Line 214 of yacc.c */
+/* Line 293 of yacc.c */
#line 78 "expr_arith.y"
char * val_str;
@@ -179,8 +178,8 @@ typedef union YYSTYPE
-/* Line 214 of yacc.c */
-#line 184 "expr_arith.cc"
+/* Line 293 of yacc.c */
+#line 183 "expr_arith.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -204,8 +203,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 209 "expr_arith.cc"
+/* Line 343 of yacc.c */
+#line 208 "expr_arith.cc"
#ifdef short
# undef short
@@ -308,11 +307,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -335,24 +334,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -383,23 +382,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -419,6 +402,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 10
/* YYLAST -- Last index in YYTABLE. */
@@ -532,8 +535,8 @@ static const yytype_uint8 yyr2[] =
3, 2, 3
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -564,8 +567,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -574,6 +576,12 @@ static const yytype_uint8 yytable[] =
4, 5, 11, 12, 13, 14
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-5))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
1, 5, 6, -1, 5, 0, 3, 4, 5, 6,
@@ -622,7 +630,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -890,7 +897,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -993,115 +999,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
{
- int yyn = yypact[yystate];
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
}
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1144,6 +1177,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1160,12 +1194,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1381,7 +1412,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1412,8 +1443,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1469,21 +1500,21 @@ yyreduce:
{
case 2:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 100 "expr_arith.y"
- { result = static_cast((yyvsp[(1) - (1)].val_float));;}
+ { result = static_cast((yyvsp[(1) - (1)].val_float));}
break;
case 3:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 101 "expr_arith.y"
- { result = 0; ;}
+ { result = 0; }
break;
case 4:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 104 "expr_arith.y"
{ float val = 0.0;
@@ -1509,71 +1540,82 @@ yyreduce:
}
(yyval.val_float) = val;
- ;}
+ }
break;
case 5:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 129 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(1) - (1)].val_float); ;}
+ { (yyval.val_float) = (yyvsp[(1) - (1)].val_float); }
break;
case 6:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 130 "expr_arith.y"
- { (yyval.val_float) = static_cast((yyvsp[(1) - (1)].val_int)); ;}
+ { (yyval.val_float) = static_cast((yyvsp[(1) - (1)].val_int)); }
break;
case 7:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 131 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);;}
+ { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);}
break;
case 8:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 132 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);;}
+ { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);}
break;
case 9:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 133 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);;}
+ { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);}
break;
case 10:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 134 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);;}
+ { (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);}
break;
case 11:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 135 "expr_arith.y"
- { (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);;}
+ { (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);}
break;
case 12:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 136 "expr_arith.y"
- { (yyval.val_float) = (yyvsp[(2) - (3)].val_float);;}
+ { (yyval.val_float) = (yyvsp[(2) - (3)].val_float);}
break;
-/* Line 1464 of yacc.c */
-#line 1575 "expr_arith.cc"
+/* Line 1806 of yacc.c */
+#line 1606 "expr_arith.cc"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -1602,6 +1644,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -1609,37 +1655,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (&yylloc, mc, oxml, result, error_msg, yymsg);
- }
- else
- {
- yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (&yylloc, mc, oxml, result, error_msg, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -1699,7 +1744,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1763,8 +1808,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, mc, oxml, result, error_msg);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, mc, oxml, result, error_msg);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -1789,7 +1839,7 @@ yyreturn:
-/* Line 1684 of yacc.c */
+/* Line 2067 of yacc.c */
#line 139 "expr_arith.y"
diff --git a/src/xml/expr_arith.h b/src/xml/expr_arith.h
index 66cd7ebbb4..8dec688916 100644
--- a/src/xml/expr_arith.h
+++ b/src/xml/expr_arith.h
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,7 +49,7 @@
typedef union YYSTYPE
{
-/* Line 1685 of yacc.c */
+/* Line 2068 of yacc.c */
#line 78 "expr_arith.y"
char * val_str;
@@ -59,8 +58,8 @@ typedef union YYSTYPE
-/* Line 1685 of yacc.c */
-#line 64 "expr_arith.hh"
+/* Line 2068 of yacc.c */
+#line 63 "expr_arith.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/src/xml/expr_bool.cc b/src/xml/expr_bool.cc
index 0d9c80598f..be3802607f 100644
--- a/src/xml/expr_bool.cc
+++ b/src/xml/expr_bool.cc
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -74,7 +73,7 @@
/* Copy the first part of user declarations. */
-/* Line 189 of yacc.c */
+/* Line 268 of yacc.c */
#line 17 "expr_bool.y"
#include
@@ -135,8 +134,8 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
-/* Line 189 of yacc.c */
-#line 140 "expr_bool.cc"
+/* Line 268 of yacc.c */
+#line 139 "expr_bool.cc"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -175,7 +174,7 @@ void get_xml_attribute(ObjectXML * oxml, const char* attr, string& val);
typedef union YYSTYPE
{
-/* Line 214 of yacc.c */
+/* Line 293 of yacc.c */
#line 83 "expr_bool.y"
char * val_str;
@@ -184,8 +183,8 @@ typedef union YYSTYPE
-/* Line 214 of yacc.c */
-#line 189 "expr_bool.cc"
+/* Line 293 of yacc.c */
+#line 188 "expr_bool.cc"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -209,8 +208,8 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 214 "expr_bool.cc"
+/* Line 343 of yacc.c */
+#line 213 "expr_bool.cc"
#ifdef short
# undef short
@@ -313,11 +312,11 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -340,24 +339,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -388,23 +387,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -424,6 +407,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 12
/* YYLAST -- Last index in YYTABLE. */
@@ -540,8 +543,8 @@ static const yytype_uint8 yyr2[] =
3, 3, 3, 4, 3, 3, 2, 3
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -574,8 +577,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -584,6 +586,12 @@ static const yytype_uint8 yytable[] =
16, 17, 18, 26, 27, 28, 19, 21, 20, 22
};
+#define yypact_value_is_default(yystate) \
+ ((yystate) == (-6))
+
+#define yytable_value_is_error(yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
1, 3, 3, 0, 9, 7, 4, 5, 4, 5,
@@ -633,7 +641,6 @@ do \
{ \
yychar = (Token); \
yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -901,7 +908,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1004,115 +1010,142 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
{
- int yyn = yypact[yystate];
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = 0;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
}
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1155,6 +1188,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, mc, oxml, result, error_msg)
}
}
+
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -1171,12 +1205,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */
-
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1392,7 +1423,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1423,8 +1454,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1480,152 +1511,163 @@ yyreduce:
{
case 2:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 103 "expr_bool.y"
- { result=(yyvsp[(1) - (1)].val_int); ;}
+ { result=(yyvsp[(1) - (1)].val_int); }
break;
case 3:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 104 "expr_bool.y"
- { result=true; ;}
+ { result=true; }
break;
case 4:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 107 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);;}
+ (yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);}
break;
case 5:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 112 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
- (yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);;}
+ (yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);}
break;
case 6:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 117 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);;}
+ (yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);}
break;
case 7:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 122 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);;}
+ (yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);}
break;
case 8:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 127 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val == (yyvsp[(3) - (3)].val_float);;}
+ (yyval.val_int) = val == (yyvsp[(3) - (3)].val_float);}
break;
case 9:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 132 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
- (yyval.val_int) = val != (yyvsp[(4) - (4)].val_float);;}
+ (yyval.val_int) = val != (yyvsp[(4) - (4)].val_float);}
break;
case 10:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 137 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val > (yyvsp[(3) - (3)].val_float);;}
+ (yyval.val_int) = val > (yyvsp[(3) - (3)].val_float);}
break;
case 11:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 142 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = val < (yyvsp[(3) - (3)].val_float);;}
+ (yyval.val_int) = val < (yyvsp[(3) - (3)].val_float);}
break;
case 12:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 147 "expr_bool.y"
{ string val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
- (yyval.val_int) = (val.empty() || (yyvsp[(3) - (3)].val_str)==0) ? false : fnmatch((yyvsp[(3) - (3)].val_str),val.c_str(),0)==0;;}
+ (yyval.val_int) = (val.empty() || (yyvsp[(3) - (3)].val_str)==0) ? false : fnmatch((yyvsp[(3) - (3)].val_str),val.c_str(),0)==0;}
break;
case 13:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 152 "expr_bool.y"
{ string val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
- (yyval.val_int) = (val.empty() || (yyvsp[(4) - (4)].val_str)==0) ? false : fnmatch((yyvsp[(4) - (4)].val_str),val.c_str(),0)!=0;;}
+ (yyval.val_int) = (val.empty() || (yyvsp[(4) - (4)].val_str)==0) ? false : fnmatch((yyvsp[(4) - (4)].val_str),val.c_str(),0)!=0;}
break;
case 14:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 157 "expr_bool.y"
- { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); ;}
+ { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); }
break;
case 15:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 158 "expr_bool.y"
- { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;}
+ { (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); }
break;
case 16:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 159 "expr_bool.y"
- { (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;}
+ { (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); }
break;
case 17:
-/* Line 1464 of yacc.c */
+/* Line 1806 of yacc.c */
#line 160 "expr_bool.y"
- { (yyval.val_int) = (yyvsp[(2) - (3)].val_int); ;}
+ { (yyval.val_int) = (yyvsp[(2) - (3)].val_int); }
break;
-/* Line 1464 of yacc.c */
-#line 1627 "expr_bool.cc"
+/* Line 1806 of yacc.c */
+#line 1658 "expr_bool.cc"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -1654,6 +1696,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -1661,37 +1707,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (&yylloc, mc, oxml, result, error_msg, yymsg);
- }
- else
- {
- yyerror (&yylloc, mc, oxml, result, error_msg, YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (&yylloc, mc, oxml, result, error_msg, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -1751,7 +1796,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1815,8 +1860,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, mc, oxml, result, error_msg);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, mc, oxml, result, error_msg);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -1841,7 +1891,7 @@ yyreturn:
-/* Line 1684 of yacc.c */
+/* Line 2067 of yacc.c */
#line 163 "expr_bool.y"
diff --git a/src/xml/expr_bool.h b/src/xml/expr_bool.h
index 3e0c95e1f6..0f561150f4 100644
--- a/src/xml/expr_bool.h
+++ b/src/xml/expr_bool.h
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.5. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,7 +49,7 @@
typedef union YYSTYPE
{
-/* Line 1685 of yacc.c */
+/* Line 2068 of yacc.c */
#line 83 "expr_bool.y"
char * val_str;
@@ -59,8 +58,8 @@ typedef union YYSTYPE
-/* Line 1685 of yacc.c */
-#line 64 "expr_bool.hh"
+/* Line 2068 of yacc.c */
+#line 63 "expr_bool.hh"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */