+ # Same logic as in pve-container, but without the testcase special case
+ my $host_resolv_conf = PVE::INotify::read_file('resolvconf');
+
+ my $searchdomains = [
+ split(/\s+/, $conf->{searchdomain} // $host_resolv_conf->{search})
+ ];
+
+ my $nameserver = $conf->{nameserver};
+ if (!defined($nameserver)) {
+ $nameserver = [grep { $_ } $host_resolv_conf->@{qw(dns1 dns2 dns3)}];
+ } else {
+ $nameserver = [split(/\s+/, $nameserver)];
+ }
+
+ return ($searchdomains, $nameserver);
+}
+
+sub cloudinit_userdata {
+ my ($conf, $vmid) = @_;
+
+ my ($hostname, $fqdn) = get_hostname_fqdn($conf, $vmid);