[pve-devel] applied: [PATCH pve-network] create /etc/pve/sdn directory

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Nov 29 08:41:26 CET 2019


On 11/28/19 2:34 PM, Alexandre Derumier wrote:
> like for /etc/pve/ha, create it in api create
> 

Applied, but while we really do it like this in HA, wouldn't it make more
sense to do this in the int the write_config subs, i.e., before
cfs_write_file is called? But as the API is our only interface, abd CLI
command will also go over this class it should be OK also..

> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/API2/Network/SDN/Controllers.pm | 4 ++++
>  PVE/API2/Network/SDN/Vnets.pm       | 4 ++++
>  PVE/API2/Network/SDN/Zones.pm       | 4 ++++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/PVE/API2/Network/SDN/Controllers.pm b/PVE/API2/Network/SDN/Controllers.pm
> index 03da2ad..e16619c 100644
> --- a/PVE/API2/Network/SDN/Controllers.pm
> +++ b/PVE/API2/Network/SDN/Controllers.pm
> @@ -132,6 +132,10 @@ __PACKAGE__->register_method ({
>  	my $plugin = PVE::Network::SDN::Controllers::Plugin->lookup($type);
>  	my $opts = $plugin->check_config($id, $param, 1, 1);
>  
> +        # create /etc/pve/sdn directory
> +        PVE::Cluster::check_cfs_quorum();
> +        mkdir("/etc/pve/sdn");
> +
>          PVE::Network::SDN::Controllers::lock_sdn_controllers_config(
>  	    sub {
>  
> diff --git a/PVE/API2/Network/SDN/Vnets.pm b/PVE/API2/Network/SDN/Vnets.pm
> index d66cd14..80fc3c6 100644
> --- a/PVE/API2/Network/SDN/Vnets.pm
> +++ b/PVE/API2/Network/SDN/Vnets.pm
> @@ -112,6 +112,10 @@ __PACKAGE__->register_method ({
>  	my $type = extract_param($param, 'type');
>  	my $id = extract_param($param, 'vnet');
>  
> +        # create /etc/pve/sdn directory
> +        PVE::Cluster::check_cfs_quorum();
> +        mkdir("/etc/pve/sdn");
> +
>          PVE::Network::SDN::Vnets::lock_sdn_vnets_config(
>  	    sub {
>  
> diff --git a/PVE/API2/Network/SDN/Zones.pm b/PVE/API2/Network/SDN/Zones.pm
> index d149290..293880a 100644
> --- a/PVE/API2/Network/SDN/Zones.pm
> +++ b/PVE/API2/Network/SDN/Zones.pm
> @@ -139,6 +139,10 @@ __PACKAGE__->register_method ({
>  	my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($type);
>  	my $opts = $plugin->check_config($id, $param, 1, 1);
>  
> +        # create /etc/pve/sdn directory
> +        PVE::Cluster::check_cfs_quorum();
> +        mkdir("/etc/pve/sdn");
> +
>          PVE::Network::SDN::Zones::lock_sdn_zones_config(
>  	    sub {
>  
> 





More information about the pve-devel mailing list