mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-07 14:53:38 +00:00
save description as comment
This commit is contained in:
parent
3f05af61ff
commit
0581fe4fd6
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ RELEASE=2.0
|
|||||||
|
|
||||||
VERSION=2.0
|
VERSION=2.0
|
||||||
PACKAGE=qemu-server
|
PACKAGE=qemu-server
|
||||||
PKGREL=23
|
PKGREL=24
|
||||||
|
|
||||||
DESTDIR=
|
DESTDIR=
|
||||||
PREFIX=/usr
|
PREFIX=/usr
|
||||||
|
@ -214,7 +214,7 @@ my $confdesc = {
|
|||||||
description => {
|
description => {
|
||||||
optional => 1,
|
optional => 1,
|
||||||
type => 'string',
|
type => 'string',
|
||||||
description => "Description for the VM. Only used on the configuration web interface.",
|
description => "Description for the VM. Only used on the configuration web interface. This is saved as comment inside the configuration file.",
|
||||||
},
|
},
|
||||||
ostype => {
|
ostype => {
|
||||||
optional => 1,
|
optional => 1,
|
||||||
@ -1435,17 +1435,20 @@ sub parse_vm_config {
|
|||||||
|
|
||||||
my $vmid = $1;
|
my $vmid = $1;
|
||||||
|
|
||||||
|
my $descr = '';
|
||||||
|
|
||||||
while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
|
while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
|
||||||
my $line = $1;
|
my $line = $1;
|
||||||
|
|
||||||
next if $line =~ m/^\#/;
|
|
||||||
|
|
||||||
next if $line =~ m/^\s*$/;
|
next if $line =~ m/^\s*$/;
|
||||||
|
|
||||||
|
if ($line =~ m/^\#(.*)\s*$/) {
|
||||||
|
$descr .= PVE::Tools::decode_text($1) . "\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if ($line =~ m/^(description):\s*(.*\S)\s*$/) {
|
if ($line =~ m/^(description):\s*(.*\S)\s*$/) {
|
||||||
my $key = $1;
|
$descr .= PVE::Tools::decode_text($2);
|
||||||
my $value = PVE::Tools::decode_text($2);
|
|
||||||
$res->{$key} = $value;
|
|
||||||
} elsif ($line =~ m/^(args):\s*(.*\S)\s*$/) {
|
} elsif ($line =~ m/^(args):\s*(.*\S)\s*$/) {
|
||||||
my $key = $1;
|
my $key = $1;
|
||||||
my $value = $2;
|
my $value = $2;
|
||||||
@ -1478,6 +1481,8 @@ sub parse_vm_config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res->{description} = $descr if $descr;
|
||||||
|
|
||||||
# convert old smp to sockets
|
# convert old smp to sockets
|
||||||
if ($res->{smp} && !$res->{sockets}) {
|
if ($res->{smp} && !$res->{sockets}) {
|
||||||
$res->{sockets} = $res->{smp};
|
$res->{sockets} = $res->{smp};
|
||||||
@ -1507,11 +1512,8 @@ sub write_vm_config {
|
|||||||
|
|
||||||
my $new_volids = {};
|
my $new_volids = {};
|
||||||
foreach my $key (keys %$conf) {
|
foreach my $key (keys %$conf) {
|
||||||
next if $key eq 'digest';
|
next if $key eq 'digest' || $key eq 'description';
|
||||||
my $value = $conf->{$key};
|
my $value = $conf->{$key};
|
||||||
if ($key eq 'description') {
|
|
||||||
$value = PVE::Tools::encode_text($value);
|
|
||||||
}
|
|
||||||
eval { $value = check_type($key, $value); };
|
eval { $value = check_type($key, $value); };
|
||||||
die "unable to parse value of '$key' - $@" if $@;
|
die "unable to parse value of '$key' - $@" if $@;
|
||||||
|
|
||||||
@ -1533,8 +1535,15 @@ sub write_vm_config {
|
|||||||
|
|
||||||
# gererate RAW data
|
# gererate RAW data
|
||||||
my $raw = '';
|
my $raw = '';
|
||||||
|
|
||||||
|
# add description as comment to top of file
|
||||||
|
my $descr = $conf->{description} || '';
|
||||||
|
foreach my $cl (split(/\n/, $descr)) {
|
||||||
|
$raw .= '#' . PVE::Tools::encode_text($cl) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $key (sort keys %$conf) {
|
foreach my $key (sort keys %$conf) {
|
||||||
next if $key eq 'digest';
|
next if $key eq 'digest' || $key eq 'description';
|
||||||
$raw .= "$key: $conf->{$key}\n";
|
$raw .= "$key: $conf->{$key}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
qemu-server (2.0-24) unstable; urgency=low
|
||||||
|
|
||||||
|
* save description as comment.
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 01 Mar 2012 08:12:29 +0100
|
||||||
|
|
||||||
qemu-server (2.0-23) unstable; urgency=low
|
qemu-server (2.0-23) unstable; urgency=low
|
||||||
|
|
||||||
* fix lvremove call: avoid 'Not a CODE reference' warning
|
* fix lvremove call: avoid 'Not a CODE reference' warning
|
||||||
|
Loading…
Reference in New Issue
Block a user