> > A dry run with your syntax seems to work for me e.g. :
> > xl -N block-attach 0
''file:/hvm-guest/win2008.img,ioemu:hda,w''
>
>
> This also crashes for me but works for me with c/s 25727:a8d708fcb347
> reverted.
I can somehow repro this morning too.
It looks like 25727:a8d708fcb347 is missing some bits of my original
patch got missed during application, specifically the changes to the
iscsi/nbd/enbd prefix handling rule.
Putting that back fixes the issue, although I can''t exactly see why, so
I''m suspicious of IanJ''s flex rerun (as noted in the commit
log). We
both typically use Debian Squeeze and my patch included the regenerated
files so I would have expected no change.
8<------------------------------------------------------------
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1344244364 -3600
# Node ID 0dd09d4825a685f1f02560e6201533220ecbfa1f
# Parent 923a7fd08d5e6647a1ed91fcfdeecd9f59aa54fc
libxl: re-apply missing bits of 25739:1781892b19f8 (block script support)
The parts of this patch relating to the following changes were some
how missed during application
This highlighted two bugs in the libxlu disk parser handling of the
deprecated "<script>:" prefix:
- It was failing to prefix with "block-" to construct the actual
script name
- The regex for matching iscsi or drdb or e?nbd was incorrect
For some reason this seems to have caused xl to segfault although I
can''t see why this would be the case.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
diff -r 923a7fd08d5e -r 0dd09d4825a6 tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c Mon Aug 06 10:04:59 2012 +0100
+++ b/tools/libxl/libxlu_disk_l.c Mon Aug 06 10:12:44 2012 +0100
@@ -370,7 +370,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_acclist[456] +static yyconst flex_int16_t
yy_acclist[447] { 0,
24, 24, 26, 22, 23, 25, 8193, 22, 23, 25,
16385, 8193, 22, 25,16385, 22, 23, 25, 23, 25,
@@ -1188,14 +1188,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 256 )
+ if ( yy_current_state >= 251 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
*yyg->yy_state_ptr++ = yy_current_state;
++yy_cp;
}
- while ( yy_current_state != 255 );
+ while ( yy_current_state != 250 );
yy_find_action:
yy_current_state = *--yyg->yy_state_ptr;
@@ -1245,72 +1245,72 @@ do_action: /* This label is used only to
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 155 "libxlu_disk_l.l"
+#line 159 "libxlu_disk_l.l"
{ /* ignore whitespace before parameters */ }
YY_BREAK
/* ordinary parameters setting enums or strings */
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 159 "libxlu_disk_l.l"
+#line 163 "libxlu_disk_l.l"
{ STRIP('',''); setformat(DPC, FROMEQUALS); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 161 "libxlu_disk_l.l"
+#line 165 "libxlu_disk_l.l"
{ DPC->disk->is_cdrom = 1; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 162 "libxlu_disk_l.l"
+#line 166 "libxlu_disk_l.l"
{ DPC->disk->is_cdrom = 1; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 163 "libxlu_disk_l.l"
+#line 167 "libxlu_disk_l.l"
{ DPC->disk->is_cdrom = 0; }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 164 "libxlu_disk_l.l"
+#line 168 "libxlu_disk_l.l"
{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
-#line 166 "libxlu_disk_l.l"
+#line 170 "libxlu_disk_l.l"
{ STRIP('',''); setaccess(DPC, FROMEQUALS); }
YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
-#line 167 "libxlu_disk_l.l"
+#line 171 "libxlu_disk_l.l"
{ STRIP('',''); setbackendtype(DPC,FROMEQUALS); }
YY_BREAK
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
-#line 169 "libxlu_disk_l.l"
+#line 173 "libxlu_disk_l.l"
{ STRIP('',''); SAVESTRING("vdev", vdev, FROMEQUALS);
}
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 170 "libxlu_disk_l.l"
+#line 174 "libxlu_disk_l.l"
{ STRIP('',''); SAVESTRING("script", script,
FROMEQUALS); }
YY_BREAK
/* the target magic parameter, eats the rest of the string */
case 11:
YY_RULE_SETUP
-#line 174 "libxlu_disk_l.l"
+#line 178 "libxlu_disk_l.l"
{ STRIP('',''); SAVESTRING("target", pdev_path,
FROMEQUALS); }
YY_BREAK
/* unknown parameters */
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 178 "libxlu_disk_l.l"
+#line 182 "libxlu_disk_l.l"
{ xlu__disk_err(DPC,yytext,"unknown parameter"); }
YY_BREAK
/* deprecated prefixes */
@@ -1327,24 +1327,31 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 191 "libxlu_disk_l.l"
+#line 195 "libxlu_disk_l.l"
{
- STRIP('':'');
+ char *newscript;
+ STRIP('':'');
DPC->had_depr_prefix=1; DEPRECATE("use
`script=...''");
- SAVESTRING("script", script, yytext);
- }
+ if (asprintf(&newscript, "block-%s", yytext)
< 0) {
+ xlu__disk_err(DPC,yytext,"unable to format
script");
+ return 0;
+ }
+ savestring(DPC, "script respecified",
+ &DPC->disk->script, newscript);
+ free(newscript);
+ }
YY_BREAK
case 15:
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 197 "libxlu_disk_l.l"
+#line 208 "libxlu_disk_l.l"
{ DPC->had_depr_prefix=1; DEPRECATE(0); }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 198 "libxlu_disk_l.l"
+#line 209 "libxlu_disk_l.l"
{ DPC->had_depr_prefix=1; DEPRECATE(0); }
YY_BREAK
case 17:
@@ -1376,13 +1383,13 @@ case 20:
yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 202 "libxlu_disk_l.l"
+#line 213 "libxlu_disk_l.l"
{ DPC->had_depr_prefix=1; DEPRECATE(0); }
YY_BREAK
case 21:
/* rule 21 can match eol */
YY_RULE_SETUP
-#line 204 "libxlu_disk_l.l"
+#line 215 "libxlu_disk_l.l"
{
xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
return 0;
@@ -1429,17 +1436,17 @@ YY_RULE_SETUP
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 241 "libxlu_disk_l.l"
+#line 252 "libxlu_disk_l.l"
{
xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0;
}
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 244 "libxlu_disk_l.l"
+#line 255 "libxlu_disk_l.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1445 "libxlu_disk_l.c"
+#line 1450 "libxlu_disk_l.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(LEXERR):
yyterminate();
@@ -1703,7 +1710,7 @@ static int yy_get_next_buffer (yyscan_t
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 256 )
+ if ( yy_current_state >= 251 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1727,11 +1734,11 @@ static int yy_get_next_buffer (yyscan_t
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 256 )
+ if ( yy_current_state >= 251 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 255);
+ yy_is_jam = (yy_current_state == 250);
if ( ! yy_is_jam )
*yyg->yy_state_ptr++ = yy_current_state;
diff -r 923a7fd08d5e -r 0dd09d4825a6 tools/libxl/libxlu_disk_l.l
--- a/tools/libxl/libxlu_disk_l.l Mon Aug 06 10:04:59 2012 +0100
+++ b/tools/libxl/libxlu_disk_l.l Mon Aug 06 10:12:44 2012 +0100
@@ -192,11 +192,18 @@ target=.* { STRIP('','');
SAVESTRING("targ
setformat(DPC, yytext);
}
-iscsi:|e?nbd:drbd:/.* {
- STRIP('':'');
+(iscsi|e?nbd|drbd):/.* {
+ char *newscript;
+ STRIP('':'');
DPC->had_depr_prefix=1; DEPRECATE("use
`script=...''");
- SAVESTRING("script", script, yytext);
- }
+ if (asprintf(&newscript, "block-%s", yytext)
< 0) {
+ xlu__disk_err(DPC,yytext,"unable to format
script");
+ return 0;
+ }
+ savestring(DPC, "script respecified",
+ &DPC->disk->script, newscript);
+ free(newscript);
+ }
tapdisk:/.* { DPC->had_depr_prefix=1; DEPRECATE(0); }
tap2?:/.* { DPC->had_depr_prefix=1; DEPRECATE(0); }