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

Re: [libvirt] [PATCH 1/1] Add disk error policy to domain XML



On Wed, Mar 24, 2010 at 04:31:48PM -0400, David Allan wrote:
> ---
>  docs/schemas/domain.rng  |   12 +++++++++++-
>  src/conf/domain_conf.c   |   15 +++++++++++++++
>  src/conf/domain_conf.h   |   10 ++++++++++
>  src/libvirt_private.syms |    2 +-
>  src/qemu/qemu_conf.c     |   12 +++++++++---
>  tests/qemuhelptest.c     |    1 +
>  tests/qemuxml2argvtest.c |    3 +++
>  7 files changed, 50 insertions(+), 5 deletions(-)
> 
> @@ -1288,6 +1293,7 @@ virDomainDiskDefParseXML(xmlNodePtr node,
>      char *target = NULL;
>      char *bus = NULL;
>      char *cachetag = NULL;
> +    char *error_policy = NULL;
>      char *devaddr = NULL;
>      virStorageEncryptionPtr encryption = NULL;
>      char *serial = NULL;
> @@ -1353,6 +1359,7 @@ virDomainDiskDefParseXML(xmlNodePtr node,
>                  driverName = virXMLPropString(cur, "name");
>                  driverType = virXMLPropString(cur, "type");
>                  cachetag = virXMLPropString(cur, "cache");
> +                error_policy = virXMLPropString(cur, "error_policy");
>              } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
>                  def->readonly = 1;
>              } else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
> @@ -1469,6 +1476,13 @@ virDomainDiskDefParseXML(xmlNodePtr node,
>          goto error;
>      }
> 
> +    if (error_policy &&
> +        (def->error_policy = virDomainDiskErrorPolicyTypeFromString(error_policy)) < 0) {
> +        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> +                             _("unknown disk error policy '%s'"), error_policy);
> +        goto error;
> +    }
> +
>      if (devaddr) {
>          if (sscanf(devaddr, "%x:%x:%x",
>                     &def->info.addr.pci.domain,


Need to also add a chunk to the virDomainDiskDefFormat() method to
print the attribute when generating XML

> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index f2d36f7..0b71ca9 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -1215,10 +1215,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
> 
>      /* Keep disabled till we're actually ready to turn on JSON mode
>       * The plan is todo it in 0.13.0 QEMU, but lets wait & see... */
> -#if 0
> -    if (version >= 13000)
> +    if (version >= 12000)
>          flags |= QEMUD_CMD_FLAG_MONITOR_JSON;
> -#endif
> 
>      return flags;
>  }

I assume this i just from testing.

> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
> index dfdac75..b3ab209 100644
> --- a/tests/qemuhelptest.c
> +++ b/tests/qemuhelptest.c
> @@ -227,6 +227,7 @@ mymain(int argc, char **argv)
>              QEMUD_CMD_FLAG_BALLOON |
>              QEMUD_CMD_FLAG_DEVICE |
>              QEMUD_CMD_FLAG_SMP_TOPOLOGY |
> +            QEMUD_CMD_FLAG_MONITOR_JSON |
>              QEMUD_CMD_FLAG_RTC,
>              12001, 0,  0);

Similarly this bit

> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index e3762c9..c98de19 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -261,6 +261,9 @@ mymain(int argc, char **argv)
>              QEMUD_CMD_FLAG_DRIVE_FORMAT);
>      DO_TEST("disk-drive-cache-v1-none", QEMUD_CMD_FLAG_DRIVE |
>              QEMUD_CMD_FLAG_DRIVE_FORMAT);
> +    DO_TEST("disk-drive-error-policy-stop", QEMUD_CMD_FLAG_DRIVE |
> +            QEMUD_CMD_FLAG_MONITOR_JSON |
> +            QEMUD_CMD_FLAG_DRIVE_FORMAT);
>      DO_TEST("disk-drive-cache-v2-wt", QEMUD_CMD_FLAG_DRIVE |
>              QEMUD_CMD_FLAG_DRIVE_CACHE_V2 | QEMUD_CMD_FLAG_DRIVE_FORMAT);
>      DO_TEST("disk-drive-cache-v2-wb", QEMUD_CMD_FLAG_DRIVE |

I think you forgot to 'git add' the two data files for the
new disk-drive-error-policy-stop test. If you also add this
same datafile to the  qemuxml2xmltest.c file you'll get 
coverage of XML output as well


Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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