Re: [PATCH v3 1/8] test: Allow specifying object transient state in driver XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/26/2013 10:45 AM, Michal Privoznik wrote:
> On 25.09.2013 21:15, Cole Robinson wrote:
>> Similar to the runstate commit, allow a boolean <test:transient/>
>> element for setting domain persistence at driver startup.
>> ---
>> v3:
>>     Validate that transient is not specified with runstate=shutoff
>>
>>  src/test/test_driver.c | 16 +++++++++++++++-
>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
>> index 48b5ec1..c51c7ca 100644
>> --- a/src/test/test_driver.c
>> +++ b/src/test/test_driver.c
>> @@ -159,6 +159,7 @@ typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
>>  typedef testDomainNamespaceDef *testDomainNamespaceDefPtr;
>>  struct _testDomainNamespaceDef {
>>      int runstate;
>> +    bool transient;
>>  };
>>  
>>  static void
>> @@ -189,6 +190,13 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
>>      if (VIR_ALLOC(nsdata) < 0)
>>          return -1;
>>  
>> +    tmp = virXPathBoolean("boolean(./test:transient)", ctxt);
>> +    if (tmp == -1) {
>> +        virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid transient"));
>> +        goto error;
>> +    }
>> +    nsdata->transient = tmp;
>> +
>>      tmp = virXPathUInt("string(./test:runstate)", ctxt, &tmpuint);
>>      if (tmp == 0) {
>>          if (tmpuint >= VIR_DOMAIN_LAST) {
>> @@ -205,6 +213,12 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
>>          goto error;
>>      }
>>  
>> +    if (nsdata->transient && nsdata->runstate == VIR_DOMAIN_SHUTOFF) {
>> +        virReportError(VIR_ERR_XML_ERROR,
> 
> s/$/ "%s",/
> 
>> +            _("transient domain cannot have runstate 'shutoff'"));
>> +        goto error;
>> +    }
>> +
>>      *data = nsdata;
>>      return 0;
> 
> ACK with this squashed in:
> 
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index c51c7ca..87a87cc 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -214,7 +214,7 @@ testDomainDefNamespaceParse(xmlDocPtr xml
> ATTRIBUTE_UNUSED,
>      }
> 
>      if (nsdata->transient && nsdata->runstate == VIR_DOMAIN_SHUTOFF) {
> -        virReportError(VIR_ERR_XML_ERROR,
> +        virReportError(VIR_ERR_XML_ERROR, "%s",
>              _("transient domain cannot have runstate 'shutoff'"));
>          goto error;
>      }
> 

Thanks, pushed with that bit fixed.

- Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]