Hi Fabian,

On Fri, 16 Jun 2017 14:21:34 +0200
Fabian Grünbichler <f.gruenbich...@proxmox.com> wrote:

> > sub volume_resize {
> >     my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
> > 
> >     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
> > 
> >     my $run = PVE::QemuServer::check_running($vmid);
> >     if (!$run) {
> >         $run = PVE::LXC::check_running($vmid);
> >     }  
> 
> not allowed here - see comment on the very top.
> 
> alternative solutions:
> - expand storage API here to split $running into two parameters, modify
>   PVE::LXC and PVE::QemuServer to pass $running and the new parameter
>   accordingly, adapt other plugins to handle $running && $new_parameter
>   like they used to handle $running (if they did), adapt your plugin to
>   die if $running to forbid online resizing for now.
> - special case your plugin in PVE::LXC to handle running containers
>   there (Qemu does pass $running correctly).
> 
I have studied this phenomenon in greater depth and more and more I
begin to think that this is a bug burruniied deep down somewhere in
PVE::Tools::run_command, it is not related to FreeNAS or my plugin.

When you try to resize a running container you get this error message:
mount.nfs: Failed to resolve server /dev/disk/by-path/ip-10.0.1.32: Name or 
service not known
Failed to update the container's filesystem: command 'unshare -m -- sh -c 
'mount --make-rprivate / && mount 
/dev/disk/by-path/ip-10.0.1.32:3260-iscsi-iqn.2005-10.org.freenas.ctl:vm-113-lun-0
 /tmp && resize2fs 
/dev/disk/by-path/ip-10.0.1.32:3260-iscsi-iqn.2005-10.org.freenas.ctl:vm-113-lun-0''
 failed: exit code 32

If you copy/paste the command which pve-manager tries to run to the
command line everything works as expected, it is only when runned from
pve-manager the command fails. So resizing running CT's is disabled due
to a bug in pve-manager and not in the FreeNAS API or the plugin.

As a side note I can tell that path now returns the path with : escaped
as you sugggested but to no avail.

A small test case included:
#!/usr/bin/perl

use PVE::Tools qw(run_command);

$timeout = 5;
$noerr = 1;
my $text = '';

my $output = sub {
    my $line = shift;
    $text .= "$line\n";
};

my $cmd = ['unshare', '-m', '--', 'sh', '-c', 'mount --make-rprivate / && mount 
 
/dev/disk/by-path/ip-10.0.1.32:3260-iscsi-iqn.2005-10.org.freenas.ctl:vm-113-lun-0
 /tmp && resize2fs 
/dev/disk/by-path/ip-10.0.1.32:3260-iscsi-iqn.2005-10.org.freenas.ctl:vm-113-lun-0'];

my $exit_code = run_command($cmd, noerr => $noerr, errfunc => $output, outfunc 
=> $output, timeout => $timeout);

print "$exit_code: $text";

-- 
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir <at> datanom <dot> net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
/usr/games/fortune -es says:
"A power so great, it can only be used for Good or Evil!"
                -- Firesign Theatre, "The Giant Rat of Summatra"

Attachment: pgp_77e8Aotjl.pgp
Description: OpenPGP digital signature

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to