From a60ab1a6a26433f9d9cbc0b25e08c9a971b0dd42 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 30 Apr 2013 09:54:34 +0200 Subject: [PATCH] copy_vm: add name and description option --- PVE/API2/Qemu.pm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index fc9b502..fde6eb9 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1796,11 +1796,19 @@ __PACKAGE__->register_method({ parameters => { additionalProperties => 0, properties => { - # fixme: add other parameters like name and description? node => get_standard_option('pve-node'), vmid => get_standard_option('pve-vmid'), - newid => get_standard_option('pve-vmid', { - description => 'VMID for the copy.' }), + newid => get_standard_option('pve-vmid', { description => 'VMID for the copy.' }), + name => { + optional => 1, + type => 'string', format => 'dns-name', + description => "Set a name for the new VM.", + }, + description => { + optional => 1, + type => 'string', + description => "Description for the new VM.", + }, pool => { optional => 1, type => 'string', format => 'pve-poolid', @@ -1928,6 +1936,16 @@ __PACKAGE__->register_method({ } delete $newconf->{template}; + + if ($param->{name}) { + $newconf->{name} = $param->{name}; + } else { + $newconf->{name} = "Copy-of-$oldconf->{name}"; + } + + if ($param->{description}) { + $newconf->{description} = $param->{description}; + } PVE::Storage::activate_volumes($storecfg, $vollist); -- 2.39.2