]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuServer.pm
cleanup cloud-init option descriptions
[qemu-server.git] / PVE / QemuServer.pm
index 7dfd4a30bed706a637b4f44b662df2b52b99e9e4..628ca3359cf11140ebb1d1242dabfb1e8e1c9aba 100644 (file)
@@ -540,6 +540,22 @@ EODESCR
 };
 
 my $confdesc_cloudinit = {
+    citype => {
+       optional => 1,
+       type => 'string',
+       description => 'Specifies the cloud-init configuration format. The default depends on the configured operating system type (`ostype`. We use the `nocloud` format for Linux, and `configdrive2` for windows.',
+       enum => ['configdrive2', 'nocloud'],
+    },
+    ciuser => {
+       optional => 1,
+       type => 'string',
+       description => "cloud-init: User name to change ssh keys and password for instead of the image's configured default user.",
+    },
+    cipassword => {
+       optional => 1,
+       type => 'string',
+       description => 'cloud-init: Password to assign the user. Using this is generally not recommended. Use ssh keys instead. Also note that older cloud-init versions do not support hashed passwords.',
+    },
     searchdomain => {
        optional => 1,
        type => 'string',
@@ -554,14 +570,7 @@ my $confdesc_cloudinit = {
        optional => 1,
        type => 'string',
        format => 'urlencoded',
-       description => "cloud-init : Setup public SSH keys (one key per line, " .
-                       "OpenSSH format).",
-    },
-    hostname => {
-       optional => 1,
-       description => "cloud-init: Hostname to use instead of the vm-name + search-domain.",
-       type => 'string', format => 'dns-name',
-       maxLength => 255,
+       description => "cloud-init: Setup public SSH keys (one key per line, OpenSSH format).",
     },
 };
 
@@ -2223,6 +2232,12 @@ sub json_config_properties {
     return $prop;
 }
 
+# return copy of $confdesc_cloudinit to generate documentation
+sub cloudinit_config_properties {
+
+    return dclone($confdesc_cloudinit);
+}
+
 sub check_type {
     my ($key, $value) = @_;
 
@@ -6395,7 +6410,17 @@ sub clone_disk {
        my ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
 
        print "create full clone of drive $drivename ($drive->{file})\n";
-       $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, undef, ($size/1024));
+       my $name = undef;
+       if (drive_is_cloudinit($drive)) {
+           $name = "vm-$newvmid-cloudinit";
+           # cloudinit only supports raw and qcow2 atm:
+           if ($dst_format eq 'qcow2') {
+               $name .= '.qcow2';
+           } elsif ($dst_format ne 'raw') {
+               die "clone: unhandled format for cloudinit image\n";
+           }
+       }
+       $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, ($size/1024));
        push @$newvollist, $newvolid;
 
        PVE::Storage::activate_volumes($storecfg, [$newvolid]);