On Wed, Mar 05, 2014 at 12:48:00PM +0000, qiaonuohan(a)cn.fujitsu.com wrote:
On 03/05/2014 08:42 PM, Daniel P. Berrange wrote:
> On Wed, Mar 05, 2014 at 12:00:59PM +0000, qiaonuohan(a)cn.fujitsu.com wrote:
>> On 03/04/2014 07:41 PM, Daniel P. Berrange wrote:
>>>> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
>>>> index b724f82..605b0d1 100644
>>>> --- a/src/test/test_driver.c
>>>> +++ b/src/test/test_driver.c
>>>> @@ -2427,9 +2427,10 @@ testDomainRestore(virConnectPtr conn,
>>>> return testDomainRestoreFlags(conn, path, NULL, 0);
>>>> }
>>>>
>>>> -static int testDomainCoreDump(virDomainPtr domain,
>>>> - const char *to,
>>>> - unsigned int flags)
>>>> +static int testDomainCoreDumpWithFormat(virDomainPtr domain,
>>>> + const char *to,
>>>> + unsigned int dumpformat,
>>>> + unsigned int flags)
>>>> {
>>>> testConnPtr privconn = domain->conn->privateData;
>>>> int fd = -1;
>>>> @@ -2479,6 +2480,12 @@ static int testDomainCoreDump(virDomainPtr
domain,
>>>> }
>>>> }
>>>>
>>>> + if (dumpformat> VIR_DUMP_FORMAT_KDUMP_SNAPPY) {
>>>> + virReportSystemError(errno,
>>>> + _("invalid value of dumpformat:
%d"), dumpformat);
>>>> + goto cleanup;
>>>> + }
>>>
>>> This should be done in the libvirt.c entry point, comparing against
>>> VIR_DUMP_FORMAT_LAST
>>>
>>
>> Is it OK, if I change the check to following one
>>
>> + /* dump the core of "domain" to file "to" */
>> + if (virDomainCoreDumpWithFormat(domain, to, dumpformat, flags)< 0) {
>> + goto cleanup;
>> + }
>
> Huh, I don't really see what you mean here.
parameter of testXXX should be used, or it won't go through make. My computer
output the following message. I just want to check is it OK to use
virDomainCoreDumpWithFormat here.
<cut>
...
CC qemu/libvirt_driver_qemu_impl_la-qemu_capabilities.lo
CC qemu/libvirt_driver_qemu_impl_la-qemu_command.lo
CC qemu/libvirt_driver_qemu_impl_la-qemu_domain.lo
cc1: warnings being treated as errors
test/test_driver.c: In function 'testDomainCoreDumpWithFormat':
test/test_driver.c:2432: error: unused parameter 'dumpformat'
[-Wunused-parameter]
Ok, so for the test driver you should do something like this
if (dumpformat != VIR_DUMP_FORMAT_RAW) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
....);
return -1;
}
ie, only accept raw format
The check for format value being out of range should be in libvirt.c
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|