[pve-devel] [PATCH pve-common] new helper PVE::Tools::du() - get disk usage
We simply call the external binary 'du', so that we can abort the command when we run into a timeout. Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/Tools.pm | 20 1 file changed, 20 insertions(+) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 6a2dae4..1c5b502 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -997,6 +997,26 @@ sub df { }; } +sub du { +my ($path, $timeout) = @_; + +my $size; + +$timeout //= 10; + +my $parser = sub { + my $line = shift; + + if ($line =~ m/^(\d+)\s+total$/) { + $size = $1; + } +}; + +run_command(['du', '-scb', $path], outfunc => $parser, timeout => $timeout); + +return $size; +} + # UPID helper # We use this to uniquely identify a process. # An 'Unique Process ID' has the following format: -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] VDI solution...
> You guys could integrate Apache Guacamole to Proxmox VE, perhaps. You can install an run that inside any VM. So I don't really understand what we should integrate? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH v2 storage 0/2] show storage-utilization per pool
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] pve-edk2-firmware and mirror_edk2
fixed - please test again. > On April 17, 2018 at 11:04 AM Rene Jochumwrote: > > > Hi, > > while building my packages for Buster i found that both repos in the > Subject aren't exported. > > I see those are pretty new, do they miss a "git-daemon-export-ok" or is > that indented? > > Thanks, > René > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Gitlab-ci
> I've made some Dockerfiles for PVE (easy to add more for PMG). These > don't require the Docker HUB - so it will be able to build them > even when the hub goes down. > > https://git.lxch.eu/git/pve-dockerfiles > > Is that something Proxmox is interested in? If yes, I'll continue my > work on it. > > At last i want to say that "Debian" moves to Gitlab and "Gnome" already > moved. ( https://salsa.debian.org/public ). I personally think this adds much overhead and does not really help developing software. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [Patch V3 guest-common] fix #1694: make failure of snapshot removal non-fatal
applied with fixes - see comment inline: > On April 13, 2018 at 12:24 PM Wolfgang Linkwrote: > > > In certain high-load scenarios ANY ZFS operation can block, > including registering an (async) destroy. > Since ZFS operations are implemented via ioctl's, > killing the user space process > does not affect the waiting kernel thread processing the ioctl. > > Once "zfs destroy" has been called, killing it does not say anything > about whether the destroy operation will be aborted or not. > Since running into a timeout effectively means killing it, > we don't know whether the snapshot exists afterwards or not. > We also don't know how long it takes for ZFS to catch up on pending ioctls. > > Given the above problem, we must to not die on errors when deleting a no > longer needed snapshot fails (under a timeout) after an otherwise > successful replication. Since we retry on the next run anyway, this is > not problematic. > > The snapshot deletion error will be logged in the replication log > and the syslog/journal. > --- > PVE/Replication.pm | 30 ++ > 1 file changed, 26 insertions(+), 4 deletions(-) > > Patch V2: > As discuss with Dietmar we will keep remove the former snapshot at the end of > the run, > but ignore if it fails. This is to prevent we have 2 replication snapshots at > time. > > Patch V3: > Remove cleanup_local_snapshots from eval as Diemar suggest. > Use Fabian commit message. > > diff --git a/PVE/Replication.pm b/PVE/Replication.pm > index 9bc4e61..98ba1b6 100644 > --- a/PVE/Replication.pm > +++ b/PVE/Replication.pm > @@ -136,8 +136,21 @@ sub prepare { > $last_snapshots->{$volid}->{$snap} = 1; > } elsif ($snap =~ m/^\Q$prefix\E/) { > $logfunc->("delete stale replication snapshot '$snap' on > $volid"); > - PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap); > - $cleaned_replicated_volumes->{$volid} = 1; > + > + eval { > + PVE::Storage::volume_snapshot_delete($storecfg, $volid, > $snap); > + $cleaned_replicated_volumes->{$volid} = 1; > + }; > + > + # If deleting the snapshot fails, we can not be sure if it was > due to an > error or a timeout. > + # The likelihood that the delete has worked out is high at a > timeout. > + # If it really fails, it will try to remove on the next run. > + > + # warn is for syslog/journal. > + warn $@ if $@; > + > + # logfunc will written in replication log. > + $logfunc->("delete stale replication snapshot error: $@") if $@; > } > } > } > @@ -296,9 +309,18 @@ sub replicate { > # remove old snapshots because they are no longer needed > $cleanup_local_snapshots->($last_snapshots, $last_sync_snapname); > > -remote_finalize_local_job($ssh_info, $jobid, $vmid, $sorted_volids, > $start_time, $logfunc); > +eval { > + remote_finalize_local_job($ssh_info, $jobid, $vmid, $sorted_volids, > $start_time, $logfunc); > +}; > > -die $err if $err; > +# old snapshots will removed by next run from prepare_local_job. > +if ($err = $@) { > + # warn is for syslog/journal. > + warn $err; > + > + # logfunc will written in replication log. > + $logfunc->("delete stale replication snapshot error: err"); should be: $logfunc->("delete stale replication snapshot error: $err"); > +} > > return $volumes; > } > -- ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH v3 storage 1/2] Fix #1542: show storage utilization per pool
comments inline. > On April 11, 2018 at 4:36 PM Alwin Antreichwrote: > > > - get the percent_used value for a ceph pool and >calculate it where ceph doesn't supply it (pre kraken) > - use librados2-perl for pool status > - add librados2-perl as build-depends and depends in debian/control > > Signed-off-by: Alwin Antreich > --- > PVE/CLI/pvesm.pm | 1 + > PVE/Storage.pm | 4 +- > PVE/Storage/RBDPlugin.pm | 96 > ++-- > debian/control | 2 + > 4 files changed, 81 insertions(+), 22 deletions(-) > > diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm > index 5774364..98cd9e9 100755 > --- a/PVE/CLI/pvesm.pm > +++ b/PVE/CLI/pvesm.pm > @@ -149,6 +149,7 @@ my $print_status = sub { > my $active = $res->{active} ? 'active' : 'inactive'; > my ($per, $per_fmt) = (0, '% 7.2f%%'); > $per = ($res->{used}*100)/$res->{total} if $res->{total} > 0; > + $per = $res->{percent_used} if defined($res->{percent_used}); > > if (!$res->{enabled}) { > $per = 'N/A'; > diff --git a/PVE/Storage.pm b/PVE/Storage.pm > index 4140a99..0d9d7cf 100755 > --- a/PVE/Storage.pm > +++ b/PVE/Storage.pm > @@ -1065,14 +1065,14 @@ sub storage_info { > next; > } > > - my ($total, $avail, $used, $active); > - eval { ($total, $avail, $used, $active) = $plugin->status($storeid, > $scfg, > $cache); }; > + my ($total, $avail, $used, $active, $percent_used) = eval { > $plugin->status($storeid, $scfg, $cache); }; > warn $@ if $@; > next if !$active; > $info->{$storeid}->{total} = int($total); > $info->{$storeid}->{avail} = int($avail); > $info->{$storeid}->{used} = int($used); > $info->{$storeid}->{active} = $active; > + $info->{$storeid}->{percent_used} = $percent_used if > (defined($percent_used)); > } > > return $info; > diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm > index fd5a2ef..1b09b58 100644 > --- a/PVE/Storage/RBDPlugin.pm > +++ b/PVE/Storage/RBDPlugin.pm > @@ -7,6 +7,7 @@ use Net::IP; > use PVE::Tools qw(run_command trim); > use PVE::Storage::Plugin; > use PVE::JSONSchema qw(get_standard_option); > +use PVE::RADOS; > > use base qw(PVE::Storage::Plugin); > > @@ -90,6 +91,50 @@ my $rados_cmd = sub { > return $build_cmd->('/usr/bin/rados', $scfg, $storeid, $op, @options); > }; > > +my $ceph_connect_option = sub { > +my ($scfg, $storeid, %options) = @_; > + > +my $cmd_option = {}; > +my $ceph_storeid_conf = "/etc/pve/priv/ceph/${storeid}.conf"; > +my $keyring = "/etc/pve/priv/ceph/${storeid}.keyring"; > +my $pveceph_managed = !defined($scfg->{monhost}); > + > +$cmd_option->{ceph_conf} = $pveceph_config if (-e $pveceph_config); > + > +if (-e $ceph_storeid_conf) { > + if ($pveceph_managed) { > + warn "ignoring custom ceph config for storage '$storeid', 'monhost' > is > not set (assuming pveceph managed cluster)!\n"; > + } else { > + $cmd_option->{ceph_conf} = $ceph_storeid_conf; > + } > +} > + > +$cmd_option->{keyring} = $keyring if (-e $keyring); > +$cmd_option->{auth_supported} = (defined $cmd_option->{keyring}) ? > 'cephx' : 'none'; > +$cmd_option->{userid} = $scfg->{username} ? $scfg->{username} : 'admin'; > +$cmd_option->{mon_host} = $hostlist->($scfg->{monhost}, ',') if > (defined($scfg->{monhost})); > + > +if (%options) { > + foreach my $k (keys %options) { > + $cmd_option->{$k} = $options{$k}; > + } > +} > + > + > +return $cmd_option; > + > +}; > + > +my $librados_connect = sub { > +my ($scfg, $storeid, $options) = @_; > + > +my $librados_config = $ceph_connect_option->($scfg, $storeid); > + > +my $rados = PVE::RADOS->new(%$librados_config); > + > +return $rados; > +}; > + > # needed for volumes created using ceph jewel (or higher) > my $krbd_feature_disable = sub { > my ($scfg, $storeid, $name) = @_; > @@ -539,31 +584,42 @@ sub list_images { > sub status { > my ($class, $storeid, $scfg, $cache) = @_; > > -my $cmd = &$rados_cmd($scfg, $storeid, 'df'); > - > -my $stats = {}; > > -my $parser = sub { > - my $line = shift; > - if ($line =~ m/^\s*total(?:\s|_)(\S+)\s+(\d+)(k|M|G|T)?/) { > - $stats->{$1} = $2; > - # luminous has units here.. > - if ($3) { > - $stats->{$1} *= $rbd_unittobytes->{$3}/1024; > - } > - } > -}; > +my $rados = &$librados_connect($scfg, $storeid); > +my $df = $rados->mon_command({ prefix => 'df', format => 'json' }); > > -eval { > - run_rbd_command($cmd, errmsg => "rados error", errfunc => sub {}, > outfunc => > $parser); > -}; > +my ($d) = grep { $_->{name} eq $scfg->{pool} } @{$df->{pools}}; > > -my $total = $stats->{space} ? $stats->{space}*1024 : 0; > -my $free = $stats->{avail} ?
Re: [pve-devel] [Patch V2 guest-common] fix #1694: Replication risks permanently losing sync in high loads due to timeout bug
> @@ -293,12 +303,16 @@ sub replicate { > die $err; > } > > -# remove old snapshots because they are no longer needed > -$cleanup_local_snapshots->($last_snapshots, $last_sync_snapname); > +eval { > + # remove old snapshots because they are no longer needed > + $cleanup_local_snapshots->($last_snapshots, $last_sync_snapname); Seems to me that $cleanup_local_snapshots->() never raise an exception, so this code does not really makes sense? At least there is no need to catch errors from $cleanup_local_snapshots ? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [Patch V2 guest-common] fix #1694: Replication risks permanently losing sync in high loads due to timeout bug
> diff --git a/PVE/Replication.pm b/PVE/Replication.pm > index 9bc4e61..d8ccfaf 100644 > --- a/PVE/Replication.pm > +++ b/PVE/Replication.pm > @@ -136,8 +136,18 @@ sub prepare { > $last_snapshots->{$volid}->{$snap} = 1; > } elsif ($snap =~ m/^\Q$prefix\E/) { > $logfunc->("delete stale replication snapshot '$snap' on > $volid"); > - PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap); > - $cleaned_replicated_volumes->{$volid} = 1; > + > + eval { > + PVE::Storage::volume_snapshot_delete($storecfg, $volid, > $snap); > + $cleaned_replicated_volumes->{$volid} = 1; > + }; > + > + # If deleting the snapshot fails, we can not be sure if it was > due to an > error or a timeout. > + # The likelihood that the delete has worked out is high at a > timeout. > + # If it really fails, it will try to remove on the next run. > + warn $@ if $@; > + > + $logfunc->("delete stale replication snapshot error: $@") if $@; why do we need this in prepare? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Wish-List for Mail-Gateway
> where can I send a wish list for the Mail-Gateway? I guess it is best to open an issue at bugzilla.proxmox.com for each topic. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [pmg-devel] [PATCH pmg-gui 1/1] overwrite run_editor of base class
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [pmg-devel] [PATCH manager 1/1] overwrite the built-in 'run_editor' function
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager] better focus of lxc/MPEdit
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH widget-toolkit 1/1] allow pressing enter in ObjectGrids to edit a field
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH widget-toolkit] better default focus selection
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager] merge cores, cpulimit and cpuunits for containers
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs 2/2] mention that NAT mode is not available on the WebUI
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs 1/2] fix wording for new memory dialog for qemu
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager] fix editor and set_button_status for cloudinit
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager 01/11] add advanced checkbox to the wizard
applied all (11) patches ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH widget-toolkit 2/2] add a checkbox to edit windows for advanced options
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH widget-toolkit 1/2] add advanced options to the input panel
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH manager v2 1/5] dc: add simple cluster panel
fixed > the only thing not working is the 'nodecount' since the diffstore has no > 'load' event, thus the update never triggers > > but we can fix this in a followup by adding the event to the rstore > instead ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager v2 0/5] cluster create/join UI
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH v2 librados2-perl 0/3] resend of last series
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster] API/Cluster: autoflush STDOUT for join and create
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: make aab and dab compatible with LXC 3 config properties
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH dab] use new config properties for sample lxc config
applied and bumped version to dab_3.0-9_all.deb Uploaded new package to pvetest respository: http://download.proxmox.com/debian/pve/dists/stretch/pvetest/binary-amd64/dab_3.0-9_all.deb > On April 5, 2018 at 9:53 AM Thomas Lamprechtwrote: > > > Signed-off-by: Thomas Lamprecht > --- > DAB.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/DAB.pm b/DAB.pm > index b686141..c52a589 100644 > --- a/DAB.pm > +++ b/DAB.pm > @@ -244,8 +244,8 @@ sub __sample_config { > } else { > die "unknown os type '$ostype'\n"; > } > -$data .= "lxc.utsname = localhost\n"; > -$data .= "lxc.rootfs = $self->{rootfs}\n"; > +$data .= "lxc.uts.name = localhost\n"; > +$data .= "lxc.rootfs.path = $self->{rootfs}\n"; > > return $data; > } > -- > 2.14.2 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [RFC manager 0/1] introduce pvesrd, replacing systemd pvesr.{timer, service}
My plan was to use pvestatd for that. We need to improve that daemon to run a forked worker for each storage, so I think it would be ease to add this functionality. Would save some memory ... > On April 3, 2018 at 4:02 PM Thomas Lamprechtwrote: > > > This is a POC of replacing the systemd timer which ran pvesr.service (an > exec of `pvesr run`) once a minute. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH librados2-perl] Split method pve_rados_connect
comments inline > On March 30, 2018 at 12:25 PM Alwin Antreichwrote: > > > To be able to connect through librados2 without a config file, the > method pve_rados_connect is split up into pve_rados_connect and > pve_rados_conf_read_file. > > Signed-off-by: Alwin Antreich > --- > PVE/RADOS.pm | 9 - > RADOS.xs | 26 +- > 2 files changed, 29 insertions(+), 6 deletions(-) > > diff --git a/PVE/RADOS.pm b/PVE/RADOS.pm > index aa6a102..ad1c2db 100644 > --- a/PVE/RADOS.pm > +++ b/PVE/RADOS.pm > @@ -1,6 +1,6 @@ > package PVE::RADOS; > > -use 5.014002; > +use 5.014002; # FIXME: update version?? why this FIXME? > use strict; > use warnings; > use Carp; > @@ -13,6 +13,7 @@ use PVE::RPCEnvironment; > require Exporter; > > my $rados_default_timeout = 5; > +my $ceph_default_conf = '/etc/ceph/ceph.conf'; > > > our @ISA = qw(Exporter); > @@ -164,6 +165,12 @@ sub new { > $conn = pve_rados_create() || > die "unable to create RADOS object\n"; > > + my $ceph_conf = delete $params{ceph_conf} || $ceph_default_conf; > + > + if (-e $ceph_conf) { > + pve_rados_conf_read_file($conn, $ceph_conf); > + } > + What if $params{ceph_conf} is set, but file does not exist? IMHO this should raise an error instead of using the default? > pve_rados_conf_set($conn, 'client_mount_timeout', $timeout); > > foreach my $k (keys %params) { > diff --git a/RADOS.xs b/RADOS.xs > index a9f6bc3..ad3cf96 100644 > --- a/RADOS.xs > +++ b/RADOS.xs > @@ -47,19 +47,35 @@ CODE: > } > > void > -pve_rados_connect(cluster) > +pve_rados_conf_read_file(cluster, path) > rados_t cluster > -PROTOTYPE: $ > +SV *path > +PROTOTYPE: $$ > CODE: > { > -DPRINTF("pve_rados_connect\n"); > +char *p = NULL; > > -int res = rados_conf_read_file(cluster, NULL); > +if (SvOK(path)) { > + p = SvPV_nolen(path); > +} > + > +DPRINTF("pve_rados_conf_read_file %s\n", p); > + > +int res = rados_conf_read_file(cluster, p); I thought we only want to call this if p != NULL ? > if (res < 0) { > die("rados_conf_read_file failed - %s\n", strerror(-res)); > } > +} > + > +void > +pve_rados_connect(cluster) > +rados_t cluster > +PROTOTYPE: $ > +CODE: > +{ > +DPRINTF("pve_rados_connect\n"); > > -res = rados_connect(cluster); > +int res = rados_connect(cluster); > if (res < 0) { > die("rados_connect failed - %s\n", strerror(-res)); > } > -- > 2.11.0 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] OAuth2 Authentication
Hi Andreas, > Is OAuth2 on the list of features you want to have in PVE and if so, > is someone working on it? > We're migration step-by-step every service in our infrastructure > towards OAuth2 and it would be great to authenticate against OAuth2 > too. I though OAuth2 is not even a authentication protocol, so how do you want to implement authentication on top of OAuth2? OpenID connect? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] installer with ovs bridge option
The installer just generate a 'minimal' configuration. I don't want to bloat that up... IMHO it is easy enough to change that afterwards. > On March 24, 2018 at 8:45 AM testerwrote: > > > Hi, > would it be a problem to add an option in the installer to use ovs bridge > instead of ’normal’ linux bridge? > > Thanks > tester > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs] vzdump: add restore bwlimit docs
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs] api-viewer: show full return info if available
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] HTTP API : Cloudinit
> I am looking for any information about support for cloudinit in HTTP > API in upcoming 5.2 release. > > Where can I find some information about that? Dominik sent you that. Just ask here if you have further questions. Also, it would be great to get some feedback: - is it helpful within your environment - do you need/want more cloud-init options ? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs] add 'gen-qm-cloud-init-opts.pl' to doc-gen
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] training week : students features request
I already added some docs here: https://git.proxmox.com/?p=pve-docs.git;a=blob;f=qm-cloud-init.adoc;h=cfac011c659440e4b4b91d985dea79f98e5f083c;hb=HEAD > On March 20, 2018 at 1:16 PM Alexandre DERUMIERwrote: > > > >>Sorry for newbie skills. > no problem. > > cloudinit is managed on the vm, > first you can add a "cloudinit" disk (add device, like for efi disk) > > then you have a new cloudinit section in the vm configuration. > > (maybe try to refresh your browser if you don't see them) ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-container 2/2] clone: check storage permissions
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/API2/LXC.pm | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 128a89b..0c9ee40 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1326,6 +1326,13 @@ __PACKAGE__->register_method({ if ($mp->{type} eq 'volume') { my $volid = $mp->{volume}; + + my ($sid, $volname) = PVE::Storage::parse_volume_id($volid); + $sid = $storage if defined($storage); + my $scfg = PVE::Storage::storage_config($storecfg, $sid); + + $rpcenv->check($authuser, "/storage/$sid", ['Datastore.AllocateSpace']); + if ($full) { die "Cannot do full clones on a running container without snapshots\n" if $running && !defined($snapname); -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-container 1/2] clone: implement target parameter
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/API2/LXC.pm | 38 +- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 9205215..128a89b 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1229,10 +1229,10 @@ __PACKAGE__->register_method({ description => "Create a full copy of all disks. This is always done when " . "you clone a normal CT. For CT templates, we try to create a linked clone by default.", }, -# target => get_standard_option('pve-node', { -# description => "Target node. Only allowed if the original VM is on shared storage.", -# optional => 1, -# }), + target => get_standard_option('pve-node', { + description => "Target node. Only allowed if the original VM is on shared storage.", + optional => 1, + }), }, }, returns => { @@ -1261,13 +1261,26 @@ __PACKAGE__->register_method({ my $storage = extract_param($param, 'storage'); + my $target = extract_param($param, 'target'); + my $localnode = PVE::INotify::nodename(); +undef $target if $target && ($target eq $localnode || $target eq 'localhost'); + + PVE::Cluster::check_node_exists($target) if $target; + my $storecfg = PVE::Storage::config(); if ($storage) { # check if storage is enabled on local node PVE::Storage::storage_check_enabled($storecfg, $storage); + if ($target) { + # check if storage is available on target node + PVE::Storage::storage_check_node($storecfg, $storage, $target); + # clone only works if target storage is shared + my $scfg = PVE::Storage::storage_config($storecfg, $storage); + die "can't clone to non-shared storage '$storage'\n" if !$scfg->{shared}; + } } PVE::Cluster::check_cfs_quorum(); @@ -1277,10 +1290,13 @@ __PACKAGE__->register_method({ my $mountpoints = {}; my $fullclone = {}; my $vollist = []; + my $running; PVE::LXC::Config->lock_config($vmid, sub { my $src_conf = PVE::LXC::Config->set_lock($vmid, 'disk'); + $running = PVE::LXC::check_running($vmid) || 0; + my $full = extract_param($param, 'full'); if (!defined($full)) { $full = !PVE::LXC::Config->is_template($src_conf); @@ -1291,7 +1307,6 @@ __PACKAGE__->register_method({ die "snapshot '$snapname' does not exist\n" if $snapname && !defined($src_conf->{snapshots}->{$snapname}); - my $running = PVE::LXC::check_running($vmid) || 0; my $src_conf = $snapname ? $src_conf->{snapshots}->{$snapname} : $src_conf; @@ -1372,6 +1387,9 @@ __PACKAGE__->register_method({ my $newvollist = []; + my $verify_running = PVE::LXC::check_running($vmid) || 0; + die "unexpected state change\n" if $verify_running != $running; + eval { local $SIG{INT} = local $SIG{TERM} = @@ -1402,6 +1420,16 @@ __PACKAGE__->register_method({ PVE::AccessControl::add_vm_to_pool($newid, $pool) if $pool; PVE::LXC::Config->remove_lock($newid, 'create'); + + if ($target) { + # always deactivate volumes - avoid lvm LVs to be active on several nodes + PVE::Storage::deactivate_volumes($storecfg, $vollist, $snapname) if !$running; + PVE::Storage::deactivate_volumes($storecfg, $newvollist); + + my $newconffile = PVE::LXC::Config->config_file($newid, $target); + die "Failed to move config to node '$target' - rename failed: $!\n" + if !rename($conffile, $newconffile); + } }; my $err = $@; -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] training week : students features request
> >>Thanks for the feedback. I will add this to the (long) TODO list. Concerning > >> > >>backup, I would prefer an approach that work with all storage types. > > Any plan to add incremental support in vma ? (I think qemu backup incremental > is now complete ?) > During the training, this is the biggest missing feature for user. I would prefer a deduplication solution like borgbackup, zbackup, or attic. But those solution cannot deal with out of order blocks, so we may need to write that code ourselves ... > and maybe backup with iothread support ? yes (but someone needs to write that code). > >>BTW, we finally committed the cloud-init series .. > > Yes, see that :) I'll test it next week ! Thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] training week : students features request
Hi Alexandre, > student are very happy with the hard work done on proxmox5, > bugfixes,documentation and stability improvements. Great! > They have some features requests/suggestion > > > - vm balancing/redispatching based on cpu > - auto-snapshot feature (cron like) > - global/central backup scheduler (be able to do backup sequentially of all > vms, but not on all hosts at the same time) > - incremental backup > - ceph: backup implementation with rbd export-diff >(I personally think that it could be great to implement alternative storage > snasphot/export backup in storage plugins as an option , it's a lot faster on > ceph for example, and support diff backup out of the box) > - ceph: add replication like zfs to a remote ceph cluster for disaster > recovery > - fault-tolerance implementation (COLO) : (lot of work, seem that it'll be > possible ready for qemu 2.12) Thanks for the feedback. I will add this to the (long) TODO list. Concerning backup, I would prefer an approach that work with all storage types. BTW, we finally committed the cloud-init series .. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH manager] cloudinit: implement missing remove logic
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH V2 storage 01/10] Add CIFS Storage Plugin.
applied all 10 patches + a few cleanups on top ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH qemu-server 2/2] clone: add command line completion for newid
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- PVE/API2/Qemu.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 300e347..ac7fe4d 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2455,7 +2455,9 @@ __PACKAGE__->register_method({ properties => { node => get_standard_option('pve-node'), vmid => get_standard_option('pve-vmid', { completion => \::QemuServer::complete_vmid }), - newid => get_standard_option('pve-vmid', { description => 'VMID for the clone.' }), + newid => get_standard_option('pve-vmid', { + completion => \::Cluster::complete_next_vmid, + description => 'VMID for the clone.' }), name => { optional => 1, type => 'string', format => 'dns-name', -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH qemu-server 1/2] clone: use better default for parameter 'full'
template => linked clone normal VM => full clone Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- PVE/API2/Qemu.pm | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index b1c6896..300e347 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2476,12 +2476,10 @@ __PACKAGE__->register_method({ }), storage => get_standard_option('pve-storage-id', { description => "Target storage for full clone.", - requires => 'full', optional => 1, }), 'format' => { - description => "Target format for file storage.", - requires => 'full', + description => "Target format for file storage. Only valid for full clone.", type => 'string', optional => 1, enum => [ 'raw', 'qcow2', 'vmdk'], @@ -2489,9 +2487,8 @@ __PACKAGE__->register_method({ full => { optional => 1, type => 'boolean', - description => "Create a full copy of all disk. This is always done when " . + description => "Create a full copy of all disks. This is always done when " . "you clone a normal VM. For VM templates, we try to create a linked clone by default.", - default => 0, }, target => get_standard_option('pve-node', { description => "Target node. Only allowed if the original VM is on shared storage.", @@ -2572,6 +2569,17 @@ __PACKAGE__->register_method({ die "snapshot '$snapname' does not exist\n" if $snapname && !defined( $conf->{snapshots}->{$snapname}); + my $full = extract_param($param, 'full'); + if (!defined($full)) { + $full = !PVE::QemuConfig->is_template($conf); + } + + die "parameter 'storage' not allowed for linked clones\n" + if defined($storage) && !$full; + + die "parameter 'format' not allowed for linked clones\n" + if defined($format) && !$full; + my $oldconf = $snapname ? $conf->{snapshots}->{$snapname} : $conf; my $sharedvm = &$check_storage_access_clone($rpcenv, $authuser, $storecfg, $oldconf, $storage); @@ -2610,7 +2618,7 @@ __PACKAGE__->register_method({ if (PVE::QemuServer::drive_is_cdrom($drive, 1)) { $newconf->{$opt} = $value; # simply copy configuration } else { - if ($param->{full} || PVE::QemuServer::drive_is_cloudinit($drive)) { + if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) { die "Full clone feature is not supported for drive '$opt'\n" if !PVE::Storage::volume_has_feature($storecfg, 'copy', $drive->{file}, $snapname, $running); $fullclone->{$opt} = 1; -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH pve-container 1/3] PVE/API2/LXC.pm: remove experimental parameter for clone/template
applied all 3 patches ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-container 2/3] clone: allow clone to same storage without specifying storage parameter
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/API2/LXC.pm | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index e59eb10..4c1912c 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1263,9 +1263,6 @@ __PACKAGE__->register_method({ my $storage = extract_param($param, 'storage'); - die "Full clone requires a target storage.\n" - if $param->{full} && !$storage; - my $localnode = PVE::INotify::nodename(); my $storecfg = PVE::Storage::config(); @@ -1385,7 +1382,8 @@ __PACKAGE__->register_method({ my $newvolid; if ($fullclone->{$opt}) { print "create full clone of mountpoint $opt ($volid)\n"; - $newvolid = PVE::LXC::copy_volume($mp, $newid, $storage, $storecfg, $newconf, $snapname); + my $target_storage = $storage // PVE::Storage::parse_volume_id($volid); + $newvolid = PVE::LXC::copy_volume($mp, $newid, $target_storage, $storecfg, $newconf, $snapname); } else { print "create linked clone of mount point $opt ($volid)\n"; $newvolid = PVE::Storage::vdisk_clone($storecfg, $volid, $newid, $snapname); -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-container 3/3] clone: use better default for parameter 'full'
template => linked clone normal container => full clone Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/API2/LXC.pm | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index 4c1912c..55aff75 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1221,7 +1221,6 @@ __PACKAGE__->register_method({ }), storage => get_standard_option('pve-storage-id', { description => "Target storage for full clone.", - requires => 'full', optional => 1, }), full => { @@ -1229,7 +1228,6 @@ __PACKAGE__->register_method({ type => 'boolean', description => "Create a full copy of all disk. This is always done when " . "you clone a normal CT. For CT templates, we try to create a linked clone by default.", - default => 0, }, # target => get_standard_option('pve-node', { # description => "Target node. Only allowed if the original VM is on shared storage.", @@ -1282,6 +1280,13 @@ __PACKAGE__->register_method({ PVE::LXC::Config->lock_config($vmid, sub { my $src_conf = PVE::LXC::Config->set_lock($vmid, 'disk'); + + my $full = extract_param($param, 'full'); + if (!defined($full)) { + $full = !PVE::LXC::Config->is_template($src_conf); + } + die "parameter 'storage' not allowed for linked clones\n" if defined($storage) && !$full; + eval { die "snapshot '$snapname' does not exist\n" if $snapname && !defined($src_conf->{snapshots}->{$snapname}); @@ -1306,7 +1311,7 @@ __PACKAGE__->register_method({ if ($mp->{type} eq 'volume') { my $volid = $mp->{volume}; - if ($param->{full}) { + if ($full) { die "Cannot do full clones on a running container without snapshots\n" if $running && !defined($snapname); $fullclone->{$opt} = 1; -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-container 1/3] PVE/API2/LXC.pm: remove experimental parameter for clone/template
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/API2/LXC.pm | 12 1 file changed, 12 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index ec3a449..e59eb10 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1126,12 +1126,6 @@ __PACKAGE__->register_method({ properties => { node => get_standard_option('pve-node'), vmid => get_standard_option('pve-vmid', { completion => \::LXC::complete_ctid_stopped }), - experimental => { - type => 'boolean', - description => "The template feature is experimental, set this " . - "flag if you know what you are doing.", - default => 0, - }, }, }, returns => { type => 'null'}, @@ -1237,12 +1231,6 @@ __PACKAGE__->register_method({ "you clone a normal CT. For CT templates, we try to create a linked clone by default.", default => 0, }, - experimental => { - type => 'boolean', - description => "The clone feature is experimental, set this " . - "flag if you know what you are doing.", - default => 0, - }, # target => get_standard_option('pve-node', { # description => "Target node. Only allowed if the original VM is on shared storage.", # optional => 1, -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH container v5] Fix pct skiplock
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container v4] Fix pct skiplock
another comment inline > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > index 7adbcd1..4398cfd 100644 > --- a/src/PVE/LXC.pm > +++ b/src/PVE/LXC.pm > @@ -1545,11 +1545,20 @@ sub vm_start { > > update_lxc_config($vmid, $conf); > > -local $ENV{PVE_SKIPLOCK}=1 if $skiplock; > +my $skiplock_flag_fn = "/run/lxc/skiplock-$vmid"; > + > +if ($skiplock) { > + open(my $fh, '>', $skiplock_flag_fn) || die "failed to open > $skiplock_flag_fn for writing: $!\n"; > + close($fh); > +} > > my $cmd = ['systemctl', 'start', "pve-container\@$vmid"]; > > -PVE::Tools::run_command($cmd); > +eval { PVE::Tools::run_command($cmd); }; > +if (my $err = $@) { > + unlink $skiplock_flag_fn if -e $skiplock_flag_fn; there is no need to test with -e, simply use unlink $skiplock_flag_fn; > + die $err if $err; > +} > > return; ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container v4] Fix pct skiplock
> diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook > index fd29423..79297da 100755 > --- a/src/lxc-pve-prestart-hook > +++ b/src/lxc-pve-prestart-hook > @@ -57,13 +57,16 @@ __PACKAGE__->register_method ({ > return undef if $param->{name} !~ m/^\d+$/; > > my $vmid = $param->{name}; > + my $skiplock_flag_fn = "/run/lxc/skiplock-$vmid"; > + my $skiplock = 1 if -e $skiplock_flag_fn; > + unlink $skiplock_flag_fn if -e $skiplock_flag_fn; Why not: > + unlink $skiplock_flag_fn if $skiplock; ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container v2] Fix pct skiplock
Please send those white-space cleanups as separate patch > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > index 7adbcd1..acb5cfd 100644 > --- a/src/PVE/LXC.pm > +++ b/src/PVE/LXC.pm > @@ -393,7 +393,7 @@ sub update_lxc_config { > > # some init scripts expect a linux terminal (turnkey). > $raw .= "lxc.environment = TERM=linux\n"; > - > + ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH qemu] build: use 3.0 source format
I don't really like this. Why not simply: %: dh $@ --with quilt > diff --git a/debian/source/format b/debian/source/format > new file mode 100644 > index 000..163aaf8 > --- /dev/null > +++ b/debian/source/format > @@ -0,0 +1 @@ > +3.0 (quilt) > -- > 2.14.2 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH REBASED v4 container 0/5] lxc clone/move volume patches
applied all 5 patches ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster 2/2] fix tainted input in backup_cfs_database
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster 1/2] refactor backup_cfs_database
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster 1/2] pvecm: check if APIClient exception code is defined
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster 2/2] api: add fork worker ID for create and join
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH cluster] cluster join: ensure updatecerts gets called on quorate cluster
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [RFC qemu-server] cloud-init: make cipassword interactive on the CLI
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [RFC common] cli: more generic interactive parameter definition
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH container 2/2] Remove obsolete read from storage.cfg in vm_start api call
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH container 1/2] Fix #1547: on migration abort, the CT starts again
applied with syntax fix. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container 1/2] Fix #1547: on migration abort, the CT starts again
looks good, only one small sytax error: > + # in restart mode, we start the container on the source node > + # on migration error > + if ($self->{opts}->{restart} && $self->{was_running}) { > + $self->log('info', "start container on source node"); > + my skiplock = 1; > + PVE::LXC::vm_start($vmid, $self->{vmconf}, $skiplock); > + } No such class skiplock at PVE/LXC/Migrate.pm line 361, near "my skiplock" syntax error at PVE/LXC/Migrate.pm line 361, near "my skiplock =" I will fix this myself, thanks. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH firewall 0/6] pve-firewall packaging cleanup
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] aplied: [PATCH v2 firewall] check multiport limit in port ranges
applied - and thanks for the cleanup! > On March 8, 2018 at 12:06 PM Wolfgang Bumillerwrote: > > > Signed-off-by: Wolfgang Bumiller > --- > Changes: > We don't actually use the returned $count for anything other than > checking whether it's >1 to know whether to use `--match multiport`. > This still works when counting ranges as 2. > > src/PVE/Firewall.pm | 11 +-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm > index 2feac54..bc3d9fe 100644 > --- a/src/PVE/Firewall.pm > +++ b/src/PVE/Firewall.pm > @@ -1035,12 +1035,13 @@ sub parse_port_name_number_or_range { > my @elements = split(/,/, $str); > die "extraneous commas in list\n" if $str ne join(',', @elements); > foreach my $item (@elements) { > - $count++; > if ($item =~ m/^(\d+):(\d+)$/) { > + $count += 2; > my ($port1, $port2) = ($1, $2); > die "invalid port '$port1'\n" if $port1 > 65535; > die "invalid port '$port2'\n" if $port2 > 65535; > } elsif ($item =~ m/^(\d+)$/) { > + $count += 1; > my $port = $1; > die "invalid port '$port'\n" if $port > 65535; > } else { > @@ -1054,7 +1055,13 @@ sub parse_port_name_number_or_range { > } > } > > -die "ICPM ports not allowed in port range\n" if $icmp_port && $count > 1; > +die "ICPM ports not allowed in port range\n" if $icmp_port && $count > 0; > + > +# I really don't like to use the word number here, but it's the only > thing > +# that makes sense in a literal way. The range 1:100 counts as 2, not as > +# one and not as 100... > +die "too many entries in port list (> 15 numbers)\n" > + if $count > 15; > > return $count; > } > -- > 2.11.0 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [pmg-devel] [PATCH pmg-gui/widget-toolkit] fix gettext for safari
applied > this series fixes the gettext definition for safari on macos > > for pve only the widget-toolkit patch is needed, but for > pmg we also need to patch the pmg-gui package > (it would be best if we add a dependecy on the next widget-toolkit > verision to pmg-gui then) > > [PATCH pmg-gui] add default gettext definition in case of no langfile > [PATCH widget-toolkit] remove gettext definition in Utils.js ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH v4 qemu-server 03/10] implement cloudinit
> use PVE::Cluster qw (cfs_read_file cfs_write_file);; > use PVE::SafeSyslog; > @@ -64,7 +65,9 @@ my $check_storage_access = sub { > > my $volid = $drive->{file}; > > - if (!$volid || $volid eq 'none') { > + if (!$volid || ($volid eq 'none' || $volid eq 'cloudinit')) { > + # nothing to check > + } elsif ($volid =~ m/^(([^:\s]+):)?(cloudinit)$/) { Why two different checks for 'cloudinit'? The regex also match 'cloudinit', so the first test is useless? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 5/6] rename $can_read_pass to $read_password_func
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/CLIHandler.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 2d77145..5e2d3b8 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -117,7 +117,7 @@ sub generate_usage_str { $separator //= ''; $indent //= ''; -my $can_read_pass = $cli_handler_class->can('read_password'); +my $read_password_func = $cli_handler_class->can('read_password'); my $param_mapping_func = $cli_handler_class->can('string_param_file_mapping'); my ($subcmd, $def) = resolve_cmd($cmd); @@ -138,7 +138,7 @@ sub generate_usage_str { $str .= $indent; $str .= $class->usage_str($name, "$prefix $cmd", $arg_param, $fixed_param, $format, - $can_read_pass, $param_mapping_func); + $read_password_func, $param_mapping_func); $oldclass = $class; } elsif (defined($def->{$cmd}->{alias}) && ($format eq 'asciidoc')) { @@ -162,7 +162,7 @@ sub generate_usage_str { $str .= $indent; $str .= $class->usage_str($name, $prefix, $arg_param, $fixed_param, $format, - $can_read_pass, $param_mapping_func); + $read_password_func, $param_mapping_func); } return $str; }; -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 1/6] introduce compute_param_mapping_hash helper
This allows us to specify a arbitrary mapping func for any param. Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/RESTHandler.pm | 68 +- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 5c1d419..bd3f8ae 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -6,6 +6,7 @@ use warnings; use PVE::SafeSyslog; use PVE::Exception qw(raise raise_param_exc); use PVE::JSONSchema; +use PVE::Tools; use HTTP::Status qw(:constants :is status_message); use Text::Wrap; use Clone qw(clone); @@ -393,8 +394,9 @@ sub handle { # $phash: json schema property hash # $format: 'asciidoc', 'short', 'long' or 'full' # $style: 'config', 'config-sub', 'arg' or 'fixed' +# $mapdef: parameter mapping ({ desc => XXX, func => sub {...} }) my $get_property_description = sub { -my ($name, $style, $phash, $format, $hidepw, $fileparams) = @_; +my ($name, $style, $phash, $format, $hidepw, $mapdef) = @_; my $res = ''; @@ -415,13 +417,8 @@ my $get_property_description = sub { $type_text = ''; } -if ($fileparams && $phash->{type} eq 'string') { - foreach my $elem (@$fileparams) { - if ($name eq $elem) { - $type_text = ''; - last; - } - } +if ($mapdef && $phash->{type} eq 'string') { + $type_text = $mapdef->{desc}; } if ($format eq 'asciidoc') { @@ -500,6 +497,37 @@ my $get_property_description = sub { return $res; }; +# translate parameter mapping definition +# $mapping_array is a array which can contain: +# strings ... in that case we assume it is a parameter name, and +# we want to load that parameter from a file +# [ param_name, func, desc] ... allows you to specify a arbitrary +# mapping func for any param +# +# Returns: a hash indexed by parameter_name, +# i.e. { param_name => { func => .., desc => ... } } +my $compute_param_mapping_hash = sub { +my ($mapping_array) = @_; + +my $res = {}; + +return $res if !defined($mapping_array); + +foreach my $item (@$mapping_array) { + my ($name, $func, $desc); + if (ref($item) eq 'ARRAY') { + ($name, $func, $desc) = @$item; + } else { + $name = $item; + $func = sub { return PVE::Tools::file_get_contents($_[0]) }; + } + $desc //= ''; + $res->{$name} = { desc => $desc, func => $func }; +} + +return $res; +}; + # generate usage information for command line tools # # $name... the name of the method @@ -572,9 +600,11 @@ sub usage_str { } } - my $mapping = defined($stringfilemap) ? &$stringfilemap($name) : undef; + my $param_mapping_hash = $compute_param_mapping_hash->(&$stringfilemap($name)) + if $stringfilemap; + $opts .= &$get_property_description($base, 'arg', $prop->{$k}, $format, - $hidepw, $mapping); + $hidepw, $param_mapping_hash->{$k}); if (!$prop->{$k}->{optional}) { $args .= " " if $args; @@ -658,13 +688,11 @@ sub dump_properties { } my $replace_file_names_with_contents = sub { -my ($param, $mapping) = @_; +my ($param, $param_mapping_hash) = @_; -if ($mapping) { - foreach my $elem ( @$mapping ) { - $param->{$elem} = PVE::Tools::file_get_contents($param->{$elem}) - if defined($param->{$elem}); - } +while (my ($k, $d) = each %$param_mapping_hash) { + $param->{$k} = $d->{func}->($param->{$k}) + if defined($param->{$k}); } return $param; @@ -678,8 +706,12 @@ sub cli_handler { my $res; eval { my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $pwcallback); - &$replace_file_names_with_contents($param, &$stringfilemap($name)) - if defined($stringfilemap); + + if (defined($stringfilemap)) { + my $param_mapping_hash = $compute_param_mapping_hash->(&$stringfilemap($name)); + &$replace_file_names_with_contents($param, $param_mapping_hash); + } + $res = $self->handle($info, $param); }; if (my $err = $@) { -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 6/6] use better name for string_param_file_mapping (param_mapping).
But keep old one for compatibility. Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/CLIHandler.pm | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 5e2d3b8..1fd7b02 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -118,7 +118,8 @@ sub generate_usage_str { $indent //= ''; my $read_password_func = $cli_handler_class->can('read_password'); -my $param_mapping_func = $cli_handler_class->can('string_param_file_mapping'); +my $param_mapping_func = $cli_handler_class->can('param_mapping') || + $cli_handler_class->can('string_param_file_mapping'); my ($subcmd, $def) = resolve_cmd($cmd); @@ -546,7 +547,8 @@ sub run_cli_handler { my $preparefunc = $params{prepare}; my $read_password_func = $class->can('read_password'); -my $param_mapping_func = $class->can('string_param_file_mapping'); +my $param_mapping_func = $cli_handler_class->can('param_mapping') || + $class->can('string_param_file_mapping'); $exename = &$get_exe_name($class); -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 4/6] rename $pwcallback to $read_password_func
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/CLIHandler.pm | 14 +++--- src/PVE/RESTHandler.pm | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 33b7aca..2d77145 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -457,7 +457,7 @@ sub setup_environment { } my $handle_cmd = sub { -my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_; +my ($args, $read_password_func, $preparefunc, $param_mapping_func) = @_; $cmddef->{help} = [ __PACKAGE__, 'help', ['extra-args'] ]; @@ -489,13 +489,13 @@ my $handle_cmd = sub { $abort->("unknown command '$cmd_str'") if !$class; my $prefix = "$exename $cmd_str"; -my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $pwcallback, $param_mapping_func); +my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $read_password_func, $param_mapping_func); &$outsub($res) if $outsub; }; my $handle_simple_cmd = sub { -my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_; +my ($args, $read_password_func, $preparefunc, $param_mapping_func) = @_; my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef}; die "no class specified" if !$class; @@ -524,7 +524,7 @@ my $handle_simple_cmd = sub { &$preparefunc() if $preparefunc; -my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $pwcallback, $param_mapping_func); +my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $read_password_func, $param_mapping_func); &$outsub($res) if $outsub; }; @@ -545,7 +545,7 @@ sub run_cli_handler { my $preparefunc = $params{prepare}; -my $pwcallback = $class->can('read_password'); +my $read_password_func = $class->can('read_password'); my $param_mapping_func = $class->can('string_param_file_mapping'); $exename = &$get_exe_name($class); @@ -556,9 +556,9 @@ sub run_cli_handler { $cmddef = ${"${class}::cmddef"}; if (ref($cmddef) eq 'ARRAY') { - &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func); + &$handle_simple_cmd(\@ARGV, $read_password_func, $preparefunc, $param_mapping_func); } else { - &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func); + &$handle_cmd(\@ARGV, $read_password_func, $preparefunc, $param_mapping_func); } exit 0; diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 55a7f9a..0a64158 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -699,13 +699,13 @@ my $replace_file_names_with_contents = sub { }; sub cli_handler { -my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $pwcallback, $param_mapping_func) = @_; +my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $read_password_func, $param_mapping_func) = @_; my $info = $self->map_method_by_name($name); my $res; eval { - my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $pwcallback); + my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $read_password_func); if (defined($param_mapping_func)) { my $param_mapping_hash = $compute_param_mapping_hash->(&$param_mapping_func($name)); @@ -719,7 +719,7 @@ sub cli_handler { die $err if !$ec || $ec ne "PVE::Exception" || !$err->is_param_exc(); - $err->{usage} = $self->usage_str($name, $prefix, $arg_param, $fixed_param, 'short', $pwcallback, $param_mapping_func); + $err->{usage} = $self->usage_str($name, $prefix, $arg_param, $fixed_param, 'short', $read_password_func, $param_mapping_func); die $err; } -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 2/6] rename $stringfilemap to $param_mapping_func
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/CLIHandler.pm | 14 +++--- src/PVE/RESTHandler.pm | 16 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 45c0427..736e5ec 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -457,7 +457,7 @@ sub setup_environment { } my $handle_cmd = sub { -my ($args, $pwcallback, $preparefunc, $stringfilemap) = @_; +my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_; $cmddef->{help} = [ __PACKAGE__, 'help', ['extra-args'] ]; @@ -489,13 +489,13 @@ my $handle_cmd = sub { $abort->("unknown command '$cmd_str'") if !$class; my $prefix = "$exename $cmd_str"; -my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $pwcallback, $stringfilemap); +my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $pwcallback, $param_mapping_func); &$outsub($res) if $outsub; }; my $handle_simple_cmd = sub { -my ($args, $pwcallback, $preparefunc, $stringfilemap) = @_; +my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_; my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef}; die "no class specified" if !$class; @@ -524,7 +524,7 @@ my $handle_simple_cmd = sub { &$preparefunc() if $preparefunc; -my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $pwcallback, $stringfilemap); +my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $pwcallback, $param_mapping_func); &$outsub($res) if $outsub; }; @@ -546,7 +546,7 @@ sub run_cli_handler { my $preparefunc = $params{prepare}; my $pwcallback = $class->can('read_password'); -my $stringfilemap = $class->can('string_param_file_mapping'); +my $param_mapping_func = $class->can('string_param_file_mapping'); $exename = &$get_exe_name($class); @@ -556,9 +556,9 @@ sub run_cli_handler { $cmddef = ${"${class}::cmddef"}; if (ref($cmddef) eq 'ARRAY') { - &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap); + &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func); } else { - &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap); + &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func); } exit 0; diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index bd3f8ae..55a7f9a 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -541,9 +541,9 @@ my $compute_param_mapping_hash = sub { # 'full' ... text, include description # 'asciidoc' ... generate asciidoc for man pages (like 'full') # $hidepw ... hide password option (use this if you provide a read passwork callback) -# $stringfilemap ... mapping for string parameters to file path parameters +# $param_mapping_func ... mapping for string parameters to file path parameters sub usage_str { -my ($self, $name, $prefix, $arg_param, $fixed_param, $format, $hidepw, $stringfilemap) = @_; +my ($self, $name, $prefix, $arg_param, $fixed_param, $format, $hidepw, $param_mapping_func) = @_; $format = 'long' if !$format; @@ -600,8 +600,8 @@ sub usage_str { } } - my $param_mapping_hash = $compute_param_mapping_hash->(&$stringfilemap($name)) - if $stringfilemap; + my $param_mapping_hash = $compute_param_mapping_hash->(&$param_mapping_func($name)) + if $param_mapping_func; $opts .= &$get_property_description($base, 'arg', $prop->{$k}, $format, $hidepw, $param_mapping_hash->{$k}); @@ -699,7 +699,7 @@ my $replace_file_names_with_contents = sub { }; sub cli_handler { -my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $pwcallback, $stringfilemap) = @_; +my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $pwcallback, $param_mapping_func) = @_; my $info = $self->map_method_by_name($name); @@ -707,8 +707,8 @@ sub cli_handler { eval { my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $pwcallback); - if (defined($stringfilemap)) { - my $param_mapping_hash = $compute_param_mapping_hash->(&$stringfilemap($name)); + if (defined($param_mapping_func)) { + my $param_mapping_hash = $compute_param_mapping_hash->(&$param_mapping_func($name)); &$replace_file_names_with_contents($param, $param_mapping_hash); } @@ -719,7 +719,7 @@ sub cli_handler { die $err if !$ec || $ec ne "PVE::Exception" || !$err->is_param_exc(); - $err->{usage} = $self->us
[pve-devel] [PATCH V2 pve-common 3/6] rename $can_str_param_fmap to $param_mapping_func
Signed-off-by: Dietmar Maurer <diet...@proxmox.com> --- src/PVE/CLIHandler.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 736e5ec..33b7aca 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -118,7 +118,7 @@ sub generate_usage_str { $indent //= ''; my $can_read_pass = $cli_handler_class->can('read_password'); -my $can_str_param_fmap = $cli_handler_class->can('string_param_file_mapping'); +my $param_mapping_func = $cli_handler_class->can('string_param_file_mapping'); my ($subcmd, $def) = resolve_cmd($cmd); @@ -138,7 +138,7 @@ sub generate_usage_str { $str .= $indent; $str .= $class->usage_str($name, "$prefix $cmd", $arg_param, $fixed_param, $format, - $can_read_pass, $can_str_param_fmap); + $can_read_pass, $param_mapping_func); $oldclass = $class; } elsif (defined($def->{$cmd}->{alias}) && ($format eq 'asciidoc')) { @@ -162,7 +162,7 @@ sub generate_usage_str { $str .= $indent; $str .= $class->usage_str($name, $prefix, $arg_param, $fixed_param, $format, - $can_read_pass, $can_str_param_fmap); + $can_read_pass, $param_mapping_func); } return $str; }; -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH V2 pve-common 0/6] CLI/RESTHandler: more generic parameter mapping
Changes since V1: - split patch into smaller parts - new helper $compute_param_mapping_hash() - improve parameter names - add some inline docs Besides, functionality should be still the same. Dietmar Maurer (6): introduce compute_param_mapping_hash helper rename $stringfilemap to $param_mapping_func rename $can_str_param_fmap to $param_mapping_func rename $pwcallback to $read_password_func rename $can_read_pass to $read_password_func use better name for string_param_file_mapping (param_mapping). src/PVE/CLIHandler.pm | 26 + src/PVE/RESTHandler.pm | 78 +++--- 2 files changed, 69 insertions(+), 35 deletions(-) -- 2.11.0 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH common] CLI/RESTHandler: more generic parameter mapping
Those renames disturb the whole patch: > my $can_read_pass = $cli_handler_class->can('read_password'); > -my $can_str_param_fmap = > $cli_handler_class->can('string_param_file_mapping'); > +my $can_map_params = $cli_handler_class->can('param_mapping') || > + $cli_handler_class->can('string_param_file_mapping'); The functional change is quite easy, but > > my ($subcmd, $def) = resolve_cmd($cmd); > > @@ -138,7 +139,7 @@ sub generate_usage_str { > $str .= $indent; > $str .= $class->usage_str($name, "$prefix $cmd", $arg_param, > $fixed_param, $format, > - $can_read_pass, > $can_str_param_fmap); > + $can_read_pass, $can_map_params); but the rename causes the diff to grow ... > $oldclass = $class; > > } elsif (defined($def->{$cmd}->{alias}) && ($format eq > 'asciidoc')) { > @@ -162,7 +163,7 @@ sub generate_usage_str { > > $str .= $indent; > $str .= $class->usage_str($name, $prefix, $arg_param, $fixed_param, > $format, > - $can_read_pass, $can_str_param_fmap); > + $can_read_pass, $can_map_params); same here > } > return $str; > }; > @@ -546,7 +547,8 @@ sub run_cli_handler { > my $preparefunc = $params{prepare}; > > my $pwcallback = $class->can('read_password'); > -my $stringfilemap = $class->can('string_param_file_mapping'); > +my $param_mapping = $cli_handler_class->can('param_mapping') || > + $cli_handler_class->can('string_param_file_mapping'); again, a simple functional change. > > $exename = &$get_exe_name($class); > > @@ -556,9 +558,9 @@ sub run_cli_handler { > $cmddef = ${"${class}::cmddef"}; > > if (ref($cmddef) eq 'ARRAY') { > - &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap); > + &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping); and useless changes due to the rename > } else { > - &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap); > + &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping); same here ... ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH common] CLI/RESTHandler: more generic parameter mapping
This patch is quite hard to read. I guess it would make sense to split this and do the function rename as extra patch? Some questions below: > -my $replace_file_names_with_contents = sub { > +my $replace_mapped_contents = sub { > my ($param, $mapping) = @_; > > if ($mapping) { > foreach my $elem ( @$mapping ) { > - $param->{$elem} = PVE::Tools::file_get_contents($param->{$elem}) > - if defined($param->{$elem}); > + my $mapfunc = sub { return PVE::Tools::file_get_contents($_[0]) }; why define $mapfunc, and why here? Simply use: my $mapfunc; > + if (ref($elem) eq 'ARRAY') { > + ($elem, $mapfunc) = @$elem; you overwrite here anyways. > + } > + if (defined(my $value = $param->{$elem})) { > + $param->{$elem} = $mapfunc->($value); $param->{$elem} = PVE::Tools::file_get_contents($value) > + } > } > } ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH i18n 1/1] update french translation
There is something wrong with this mail. The attachment has the following content type: > Content-Type: text/plain; charset=y What is charset=y ? Please can you resend with correct content type? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] ZFS alternatives
> I have here a bounce of friends complain about ZFS, which is a memory eater > - and killer! > So, I wonder if Proxmox consider others alternatives, like BRTFS or > whatever. Yes, but there are still concerns about btrfs stability ... And btrfs is really slow in some scenarios (dpkg). ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] building pve-qemu
> How to build pve-qemu? There is a Makefile ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH container v2] close #1668: add Devuan support
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Using zstd for backup
> Question @PVE-Devel: To finish this patch up we have to include a clone of > https://github.com/facebook/zstd to your git repositories > https://git.proxmox.com, is that possible? Instead, try to include that into Debian. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH dab] close #1668: add support for devuan jessie and ascii
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH dab-pve-appliances] close #1668: add Devuan Jessie template config
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] close #1668: add Devuan support
> diff --git a/src/PVE/LXC/Setup/Devuan.pm b/src/PVE/LXC/Setup/Devuan.pm > new file mode 100644 > index 000..2f35de6 > --- /dev/null > +++ b/src/PVE/LXC/Setup/Devuan.pm > @@ -0,0 +1,73 @@ > +package PVE::LXC::Setup::Devuan; > + > +use strict; > +use warnings; > + > +use PVE::Tools qw($IPV6RE); > +use PVE::LXC; > +use PVE::Network; > +use File::Path; > + > +use PVE::LXC::Setup::Base; > +use PVE::LXC::Setup::Debian; > + > +use base qw(PVE::LXC::Setup::Debian); > + > +sub new { > +my ($class, $conf, $rootdir) = @_; > + > +my $version = > PVE::Tools::file_read_firstline("$rootdir/etc/devuan_version"); > + > +die "unable to read version info\n" if !defined($version); > + > +die "unsupported Devuan version '$version'\n" > + if $version !~ /jessie|ascii/; > + > +my $self = { conf => $conf, rootdir => $rootdir, version => $version }; > + > +$conf->{ostype} = "devuan"; > + > +return bless $self, $class; > +} > + > +# Devuan doesn't support the /dev/lxc/ subdirectory. > +sub devttydir { > +return ''; > +} > + > +sub setup_init { > +my ($self, $conf) = @_; > + > +my $filename = "/etc/inittab"; > +return if !$self->ct_file_exists($filename); > + > +my $ttycount = PVE::LXC::Config->get_tty_count($conf); > +my $inittab = $self->ct_file_get_contents($filename); > + > +my @lines = grep { > + # remove getty lines > + !/^\s*\d+:\d*:[^:]*:.*getty/ && > + # remove power lines > + !/^\s*p[fno0]:/ > + } split(/\n/, $inittab); > + > +$inittab = join("\n", @lines) . "\n"; > + > +$inittab .= "p0::powerfail:/sbin/init 0\n"; > + > +for (my $id = 1; $id <= $ttycount; $id++) { > + next if $id == 7; # reserved for X11 > + my $levels = ($id == 1) ? '2345' : '23'; > + $inittab .= "$id:$levels:respawn:/sbin/getty --noclear 38400 tty$id\n"; > +} > + > +$self->ct_file_set_contents($filename, $inittab); > +} > + > +sub setup_network { > +my ($self, $conf) = @_; > + > +PVE::LXC::Setup::Debian::setup_network($self, $conf); > +} > + > +1; why do you duplicate setup_network and setup_init and devttydir here? Base class implementation work perfectly, so there is no need to copy that code? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH docs] fix typo in api viewer
applied ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [[PATCH V4 docs] add VLAN explanation.] add VLAN explanation.
applied + cleanups ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Support for Devuan LCX container
> This seems the only issue with Devuan container. > > You can test it by downloading the dab.conf and the Makefile at > https://github.com/siddolo/pve-devuan-appliances > > Can you support a Devuan container looking into /etc/devuan_version? Please can you file a bug at bugzilla.proxmox.com? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] From LXC to LXD
LXC is the base technology for both LXD an PCT > Any change to migrate from LXC to LXD no (as explained above, LXD uses LXC) > It's seem to me that LXD is more advance than LXC! What do you, guys, thing > about it??? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [RFC PATCH] add kiosk option to vm
> with my patch as it is, only root can change the option > > afaics there is no option to set the target file (at least not on the > commandline) only 'TMPDIR' via an environment variable (but i guess this > is not what we want since it changes the location of all tmpfiles of qemu) I always rejected this kiosk mode because we found no clean solution. One idea was to use storage snapshots, and rollback at start... ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH common] replace brctl with iproute2 calls
nice - I like such cleanups :-) > On February 7, 2018 at 2:15 PM Wolfgang Bumiller> wrote: > > > And add a few helpers for the common cases. > > Signed-off-by: Wolfgang Bumiller > --- > This has been on my todo list for a while and as an extra > 'iface_set_master' is not specific to bridges but can also be used with > eg. vrf devices ;-) > (Note that to test vrf devices you need to set its mtu down to 65535 as > it'll start with 65536 which our 'copy-bridge-mtu' code tries to > apply which fails...) ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Cluster creation via web gui
we are working on that. > On January 31, 2018 at 11:26 PM Gilberto Nunes> wrote: > > > Hello friends > > I saw in last video about PMG, that is possible to create and join Cluster > via web gui. > So I wonder why us so difficult to bring the same feature to PVE. > This could be include or is something very difficult to achieve? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH cluster] datacenter.cfg: add bwlimit
I think this is the wrong place to add defaults. We need default for various different task, so we should use a more generic concept? > On January 30, 2018 at 4:34 PM Wolfgang Bumiller> wrote: > > > This will define the global defaults which can be overridden > by per-storage limits. > > Signed-off-by: Wolfgang Bumiller > --- > data/PVE/Cluster.pm | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm > index 5fc7d86..b49fd94 100644 > --- a/data/PVE/Cluster.pm > +++ b/data/PVE/Cluster.pm > @@ -1398,6 +1398,7 @@ my $datacenter_schema = { > pattern => qr/[a-f0-9]{2}(?::[a-f0-9]{2}){0,2}:?/i, > description => 'Prefix for autogenerated MAC addresses.', > }, > + bwlimit => PVE::JSONSchema::get_standard_option('bwlimit'), > }, > }; > > -- > 2.11.0 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?
> On January 29, 2018 at 1:31 PM Herman Bos <h...@osso.nl> wrote: > > > On 29 January 2018 at 12:22, Dietmar Maurer <diet...@proxmox.com> wrote: > > > > > > > Looks we simply need a flexible plugin architecture ... > > > > > You could take a look at how kubernetes does it. If somehow you can keep it > compatible you can get lots of stuff for free. :-) Thats just python code - I cannot find any API definition there? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] LizardFS support - wishlist
> Well... It's just seems that LizardFS (which is a MooseFS fork, I guess), > is easier to implement, If I remember correctly, they run a single Master with no automatic failover? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?
> It's not difficult if we can do bgp to the router. but I think Dietmar want > something > for user with a simple router/default gw. (so with some proxy-arp trick). No, I still do not know what I want - too many options ;-) Looks we simply need a flexible plugin architecture ... ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?
> On January 26, 2018 at 6:18 PM Alexandre DERUMIERwrote: > > > > After all, if we don't do s-nat, nat 1:1, why not just configure the gateway > > > > of the vm to use the external router directly > > >>Because there is no route to the external router? Please can you elaborate > >>on > >>that? > > I mean, for example > > > internet-->89.248.0.0/16---router--(89.248.1.1/24)---proxmox0(vmbr0)--vm1(89.248.1.10/24) > > > ---proxmox1(vmbr0)--vm2(89.248.1.10/24) > > > ---router--(89.248.2.1/24)---proxmox0(vmbr1)--vm3(89.248.2.10/24) > > > ---proxmox1(vmbr1)--vm4(89.248.2.10/24) > > > you can have the vms with default gw to 89.248.x.1/24. This looks like a normal PVE setup. Or where is the virtual network (vxlan) here? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?
> After all, if we don't do s-nat, nat 1:1, why not just configure the gateway > of the vm to use the external router directly Because there is no route to the external router? Please can you elaborate on that? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?
> On January 26, 2018 at 2:26 PM Alexandre DERUMIERwrote: > > > >>What is wrong using proxy-arp? > > each vmbr which have the gateway, have the same ip AND mac address. The idea is to use a link local IP, and do not expose that IP to the router at all. I need to run some test to see if that is possible to do... ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel