[pve-devel] problem with my nexenta plugin when start vm with pve-manager, need perl help

Stefan Priebe - Profihost AG s.priebe at profihost.ag
Tue Aug 21 14:34:52 CEST 2012


Am 21.08.2012 14:29, schrieb Alexandre DERUMIER:
> this is strange, using iscsidirect plugin, give me same syntax
>
> -drive file=iscsi://10.6.0.38/iqn.1986-03.com.sun:02:7971f46d-bd0e-6289-9240-8090b5b2be9a/6,if=none,id=drive-virtio1,aio=native
>
> but launch fine ....
>
> Dumper of $cmd with iscsidirect
>
>   $VAR1 = [           '/usr/bin/kvm',           '-id',           '115',           '-chardev',           'socket,id=qmp,path=/var/run/qemu-server/115.qmp,server,nowait',           '-mon',           'chardev=qmp,mode=control',           '-vnc',           'unix:/var/run/qemu-server/115.vnc,x509,password',           '-pidfile',           '/var/run/qemu-server/115.pid',           '-daemonize',           '-name',           'testalex',           '-smp',           'sockets=1,cores=2',           '-nodefaults',           '-boot',           'menu=on',           '-vga',           'cirrus',           '-k',           'fr',           '-m',           100,           '-usbdevice',           'tablet',           '-drive',           'file=iscsi://10.6.0.38/iqn.1986-03.com.sun:02:7971f46d-bd0e-6289-9240-8090b5b2be9a/6,if=none,id=drive-virtio1,aio=native',           '-device',           'virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb',           '-drive',           'if=none,id=drive-ide2
,media=cdrom,aio=native',           '-device',           'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200',           '-drive',           'file=/var/lib/vz/images/115/vm-115-disk-1.raw,if=none,id=drive-virtio0,bps_rd=10485760,aio=native,cache=none',           '-device',           'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=101'         ];
>
> Dumper of $cmd with nexentaplugin
>
>   $VAR1 = [           '/usr/bin/kvm',           '-id',           '115',           '-chardev',           'socket,id=qmp,path=/var/run/qemu-server/115.qmp,server,nowait',           '-mon',           'chardev=qmp,mode=control',           '-vnc',           'unix:/var/run/qemu-server/115.vnc,x509,password',           '-pidfile',           '/var/run/qemu-server/115.pid',           '-daemonize',           '-name',           'testalex',           '-smp',           'sockets=1,cores=2',           '-nodefaults',           '-boot',           'menu=on',           '-vga',           'cirrus',           '-k',           'fr',           '-m',           100,           '-usbdevice',           'tablet',           '-drive',           'file=iscsi:10.6.0.38/iqn.1986-03.com.sun:02:7971f46d-bd0e-6289-9240-8090b5b2be9a/6,if=none,id=drive-virtio1,aio=native',           '-device',           'virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb',           '-drive',           'if=none,id=drive-ide2,m
edia=cdrom,aio=native',           '-device',           'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200',           '-drive',           'file=/var/lib/vz/images/115/vm-115-disk-1.raw,if=none,id=drive-virtio0,bps_rd=10485760,aio=native,cache=none',           '-device',           'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=101'         ];
>
>
> The only difference is the call to nexenta api to find the lun number, in sub path{}
> my $map = nexenta_list_lun_mapping_entries($name,$scfg);
> die "could not find lun number" if !$map;
> my $lun = @$map[0]->{lun};
>
> I had try to hardcode the lun number, removing the call, and now it's launching fine.
> so this is something related to HTTP::Request->new or LWP::UserAgent ....

ah perl detects that $map is something got from external so it might 
have code in it which is not OK or is a security issue.

Try the following:

my $map = nexenta_list_lun_mapping_entries($name,$scfg);
die "could not find lun number" if !$map;
my $lun = @$map[0]->{lun};
$lun =~ m/^(\d+)$/ or die "lun is not OK\n"
$lun = $1;
...

Stefan



More information about the pve-devel mailing list