[pve-devel] [PATCH v2 qemu-server 09/28] parse_drive: Allow parsing vmstate volumes

Fabian Ebner f.ebner at proxmox.com
Tue Feb 25 13:46:51 CET 2020


On 2/25/20 12:32 PM, Fabian Grünbichler wrote:
> On February 24, 2020 1:43 pm, Fabian Ebner wrote:
>> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
>> ---
>>   PVE/QemuServer/Drive.pm | 12 +++++++++---
>>   1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm
>> index 35ac99d..e922392 100644
>> --- a/PVE/QemuServer/Drive.pm
>> +++ b/PVE/QemuServer/Drive.pm
>> @@ -378,16 +378,22 @@ sub parse_drive {
>>       if ($key =~ m/^([^\d]+)(\d+)$/) {
>>   	$interface = $1;
>>   	$index = $2;
>> +    } elsif ($key eq 'vmstate') {
>> +	$interface = 'vmstate';
>>       } else {
>>   	return undef;
>>       }
>>   
>> -    my $desc = $key =~ /^unused\d+$/ ? $alldrive_fmt
>> -                                     : $drivedesc_hash->{$key}->{format};
>> -    if (!$desc) {
>> +    my $desc;
>> +    if ($key =~ m/^unused\d+$/ || $key eq 'vmstate') {
>> +	$desc = $alldrive_fmt;
> 
> not new, I know, but the actual format for unused and vmstate is a
> different one (just a string with format 'pve-volume-id'). while
> everything besides 'file' is optional in $alldrive_fmt, 'file' also
> allows a path, which is not valid for either vmstate or unused volumes.
> 

You're right. A reason in favor of moving unuseddesc to the new module 
as well.

>> +    } elsif (defined($drivedesc_hash->{$key})) {
>> +	$desc = $drivedesc_hash->{$key}->{format};
>> +    } else {
>>   	warn "invalid drive key: $key\n";
>>   	return undef;
>>       }
>> +
>>       my $res = eval { PVE::JSONSchema::parse_property_string($desc, $data) };
>>       return undef if !$res;
>>       $res->{interface} = $interface;
>> -- 
>> 2.20.1
>>
>>
>> _______________________________________________
>> pve-devel mailing list
>> pve-devel at pve.proxmox.com
>> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>>
>>
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list