Menu

#20 import xen config file line breaks failure

open
nobody
None
5
2010-03-29
2010-03-29
No

converting the xen config file of an existing machine to import it fails if the disk=[] array is splitted on multiple lines. the strings are correctly converted to be one line but the other lines are not removed:

disk = [
'file:/home/xen/domains/myvm/swap.img,xvda1,w',
'file:/home/xen/domains/myvm/disk.img,xvda2,w',
'phy:/dev/sdb2,sdb2,w'
]

results in

disk=['file:/home/xen/domains/myvm/swap.img,xvda1,w','file:/home/xen/domains/myvm/disk.img,xvda2,w','phy:/dev/sdb2,sdb2,w']
'file:/home/xen/domains/myvm/swap.img,xvda1,w',
'file:/home/xen/domains/myvm/disk.img,xvda2,w',
'phy:/dev/sdb2,sdb2,w'
]

Discussion

  • Martin Gerhardy

    Martin Gerhardy - 2010-03-29

    version is 2.0 with patch 1 applied

     
  • Jd_Jedi

    Jd_Jedi - 2010-04-08

    Workaround : Before importing make disk and vif entries in single line.

    == From some community member, perl script that might help. (not tested)

    ...assuming there is only one disk= in entire file...

    open (FILE, "$ARGV[0]");
    $file .= $_ while (<FILE>);
    close FILE;

    $file =~ /(.*?)\n(disk = \[.*?\])\n/ms;
    $var1 = $1;
    $var2 = $2;
    $var2 =~ s/\n//g;
    $var2 =~ s/,\]$/\]/;
    print "$var1\n$var2\n";

     
  • Martin Gerhardy

    Martin Gerhardy - 2010-04-08

    thanks - i've converted them all already

     

Log in to post a comment.

MongoDB Logo MongoDB