import xen config file line breaks failure
Brought to you by:
haphazard1,
jd_jedi
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'
]
version is 2.0 with patch 1 applied
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";
thanks - i've converted them all already