]>
git.proxmox.com Git - pve-cluster.git/blob - data/PVE/DataCenterConfig.pm
1 package PVE
:: DataCenterConfig
;
10 my $migration_format = {
14 enum
=> [ 'secure' , 'insecure' ],
15 description
=> "Migration traffic is encrypted using an SSH tunnel by " .
16 "default. On secure, completely private networks this can be " .
17 "disabled to increase performance." ,
22 type
=> 'string' , format
=> 'CIDR' ,
23 format_description
=> 'CIDR' ,
24 description
=> "CIDR of the (sub) network that is used for migration."
31 enum
=> [ 'freeze' , 'failover' , 'conditional' , 'migrate' ],
32 description
=> "The policy for HA services on node shutdown. 'freeze' disables " .
33 "auto-recovery, 'failover' ensures recovery, 'conditional' recovers on " .
34 "poweroff and freezes on reboot. 'migrate' will migrate running services " .
35 "to other nodes, if possible. With 'freeze' or 'failover', HA Services will " .
36 "always get stopped first on shutdown." ,
37 verbose_description
=> "Describes the policy for handling HA services on poweroff " .
38 "or reboot of a node. Freeze will always freeze services which are still located " .
39 "on the node on shutdown, those services won't be recovered by the HA manager. " .
40 "Failover will not mark the services as frozen and thus the services will get " .
41 "recovered to other nodes, if the shutdown node does not come up again quickly " .
42 "(< 1min). 'conditional' chooses automatically depending on the type of shutdown, " .
43 "i.e., on a reboot the service will be frozen but on a poweroff the service will " .
44 "stay as is, and thus get recovered after about 2 minutes. " .
45 "Migrate will try to move all running services to another node when a reboot or " .
46 "shutdown was triggered. The poweroff process will only continue once no running services " .
47 "are located on the node anymore. If the node comes up again, the service will " .
48 "be moved back to the previously powered-off node, at least if no other migration, " .
49 "reloaction or recovery took place." ,
50 default => 'conditional' ,
57 description
=> "U2F AppId URL override. Defaults to the origin." ,
58 format_description
=> 'APPID' ,
63 description
=> "U2F Origin override. Mostly useful for single nodes with a single URL." ,
64 format_description
=> 'URL' ,
70 PVE
:: JSONSchema
:: register_format
( 'mac-prefix' , \
& pve_verify_mac_prefix
);
71 sub pve_verify_mac_prefix
{
72 my ( $mac_prefix, $noerr ) = @_ ;
74 if ( $mac_prefix !~ m/^[a-f0-9][02468ace](?::[a-f0-9]{2}){0,2}:?$/i ) {
75 return undef if $noerr ;
76 die "value is not a valid unicast MAC address prefix \n " ;
81 my $datacenter_schema = {
83 additionalProperties
=> 0 ,
88 description
=> "Default keybord layout for vnc server." ,
89 enum
=> PVE
:: Tools
:: kvmkeymaplist
(),
94 description
=> "Default GUI language." ,
122 description
=> "Specify external http proxy which is used for downloads (example: 'http://username:password\ @host :port/')" ,
123 pattern
=> "http://.*" ,
125 migration_unsecure
=> {
128 description
=> "Migration is secure using SSH tunnel by default. " .
129 "For secure private networks you can disable it to speed up " .
130 "migration. Deprecated, use the 'migration' property instead!" ,
134 type
=> 'string' , format
=> $migration_format,
135 description
=> "For cluster wide migration settings." ,
140 description
=> "Select the default Console viewer. You can either use the builtin java applet (VNC; deprecated and maps to html5), an external virt-viewer comtatible application (SPICE), an HTML5 based vnc viewer (noVNC), or an HTML5 based console client (xtermjs). If the selected viewer is not available (e.g. SPICE not activated for the VM), the fallback is noVNC." ,
141 enum
=> [ 'applet' , 'vv' , 'html5' , 'xtermjs' ],
146 format
=> 'email-opt' ,
147 description
=> "Specify email address to send notification from (default is root @\$hostname )" ,
153 description
=> "Defines how many workers (per node) are maximal started " .
154 " on actions like 'stopall VMs' or task from the ha-manager." ,
159 default => 'watchdog' ,
160 enum
=> [ 'watchdog' , 'hardware' , 'both' ],
161 description
=> "Set the fencing mode of the HA cluster. Hardware mode " .
162 "needs a valid configuration of fence devices in /etc/pve/ha/fence.cfg." .
163 " With both all two modes are used." .
164 " \n\n WARNING: 'hardware' and 'both' are EXPERIMENTAL & WIP" ,
168 type
=> 'string' , format
=> $ha_format,
169 description
=> "Cluster wide HA settings." ,
174 format
=> 'mac-prefix' ,
175 description
=> 'Prefix for autogenerated MAC addresses.' ,
177 bwlimit
=> PVE
:: JSONSchema
:: get_standard_option
( 'bwlimit' ),
181 format
=> $u2f_format,
182 description
=> 'u2f' ,
187 # make schema accessible from outside (for documentation)
188 sub get_datacenter_schema
{ return $datacenter_schema };
190 sub parse_datacenter_config
{
191 my ( $filename, $raw ) = @_ ;
193 my $res = PVE
:: JSONSchema
:: parse_config
( $datacenter_schema, $filename, $raw // '' );
195 if ( my $migration = $res ->{ migration
}) {
196 $res ->{ migration
} = PVE
:: JSONSchema
:: parse_property_string
( $migration_format, $migration );
199 if ( my $ha = $res ->{ ha
}) {
200 $res ->{ ha
} = PVE
:: JSONSchema
:: parse_property_string
( $ha_format, $ha );
203 if ( my $u2f = $res ->{ u2f
}) {
204 $res ->{ u2f
} = PVE
:: JSONSchema
:: parse_property_string
( $u2f_format, $u2f );
207 # for backwards compatibility only, new migration property has precedence
208 if ( defined ( $res ->{ migration_unsecure
})) {
209 if ( defined ( $res ->{ migration
}->{ type
})) {
210 warn "deprecated setting 'migration_unsecure' and new 'migration: type' " .
211 "set at same time! Ignore 'migration_unsecure' \n " ;
213 $res ->{ migration
}->{ type
} = ( $res ->{ migration_unsecure
}) ?
'insecure' : 'secure' ;
217 # for backwards compatibility only, applet maps to html5
218 if ( defined ( $res ->{ console
}) && $res ->{ console
} eq 'applet' ) {
219 $res ->{ console
} = 'html5' ;
225 sub write_datacenter_config
{
226 my ( $filename, $cfg ) = @_ ;
228 # map deprecated setting to new one
229 if ( defined ( $cfg ->{ migration_unsecure
}) && ! defined ( $cfg ->{ migration
})) {
230 my $migration_unsecure = delete $cfg ->{ migration_unsecure
};
231 $cfg ->{ migration
}->{ type
} = ( $migration_unsecure ) ?
'insecure' : 'secure' ;
234 # map deprecated applet setting to html5
235 if ( defined ( $cfg ->{ console
}) && $cfg ->{ console
} eq 'applet' ) {
236 $cfg ->{ console
} = 'html5' ;
239 if ( ref ( $cfg ->{ migration
})) {
240 my $migration = $cfg ->{ migration
};
241 $cfg ->{ migration
} = PVE
:: JSONSchema
:: print_property_string
( $migration, $migration_format );
244 if ( ref ( $cfg ->{ ha
})) {
246 $cfg ->{ ha
} = PVE
:: JSONSchema
:: print_property_string
( $ha, $ha_format );
249 if ( ref ( $cfg ->{ u2f
})) {
250 my $u2f = $cfg ->{ u2f
};
251 $cfg ->{ u2f
} = PVE
:: JSONSchema
:: print_property_string
( $u2f, $u2f_format );
254 return PVE
:: JSONSchema
:: dump_config
( $datacenter_schema, $filename, $cfg );
257 PVE
:: Cluster
:: cfs_register_file
( 'datacenter.cfg' ,
258 \
& parse_datacenter_config
,
259 \
& write_datacenter_config
);