use PVE::INotify;
use PVE::JSONSchema qw(get_standard_option);
use PVE::LXC;
+use PVE::NodeConfig;
use PVE::ProcFSTools;
use PVE::QemuConfig;
use PVE::QemuServer;
PVE::Cluster::check_node_exists($node);
my $config = PVE::NodeConfig::load_config($node);
- my $mac_addr = $config->{wakeonlan};
+ my $wol_config = PVE::NodeConfig::get_wakeonlan_config($config);
+ my $mac_addr = $wol_config->{mac};
if (!defined($mac_addr)) {
die "No wake on LAN MAC address defined for '$node'!\n";
}
close($sock);
- return $config->{wakeonlan};
+ return $wol_config->{mac};
}});
__PACKAGE__->register_method({
maxLength => 64 * 1024,
optional => 1,
},
- wakeonlan => {
- type => 'string',
- description => 'MAC address for wake on LAN',
- format => 'mac-addr',
- optional => 1,
- },
'startall-onboot-delay' => {
description => 'Initial delay in seconds, before starting all the Virtual Guests with on-boot enabled.',
type => 'integer',
},
};
+my $wakeonlan_desc = {
+ mac => {
+ type => 'string',
+ description => 'MAC address for wake on LAN',
+ format => 'mac-addr',
+ format_description => 'MAC address',
+ default_key => 1,
+ },
+};
+
+$confdesc->{wakeonlan} = {
+ type => 'string',
+ description => 'Node specific wake on LAN settings.',
+ format => $wakeonlan_desc,
+ optional => 1,
+};
+
my $acme_domain_desc = {
domain => {
type => 'string',
return $raw;
}
+sub get_wakeonlan_config {
+ my ($node_conf) = @_;
+
+ $node_conf //= {};
+
+ my $res = {};
+ if (defined($node_conf->{wakeonlan})) {
+ $res = eval {
+ PVE::JSONSchema::parse_property_string($wakeonlan_desc, $node_conf->{wakeonlan})
+ };
+ die $@ if $@;
+ }
+
+ return $res;
+}
+
# we always convert domain values to lower case, since DNS entries are not case
# sensitive and ACME implementations might convert the ordered identifiers
# to lower case