[libvirt] [PATCH 3/4] storage_file: Add a new flag to mark backing files that are safe to probe

Daniel P. Berrange berrange at redhat.com
Mon Nov 22 11:04:31 UTC 2010


On Fri, Nov 19, 2010 at 10:18:17AM -0600, Adam Litke wrote:
> Signed-off-by: Adam Litke <agl at us.ibm.com>
> ---
>  src/conf/domain_conf.c  |    4 ++++
>  src/util/storage_file.c |    2 +-
>  src/util/storage_file.h |    1 +
>  3 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 2d11785..a08c846 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7825,6 +7825,10 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
>          if (format == VIR_STORAGE_FILE_AUTO &&
>              !allowProbing)
>              format = VIR_STORAGE_FILE_RAW; /* Stops further recursion */
> +
> +        /* Allow probing for image formats that are safe */
> +        if (format == VIR_STORAGE_FILE_AUTO_SAFE)
> +            format = VIR_STORAGE_FILE_AUTO;
>      } while (nextpath);
>  
>      ret = 0;
> diff --git a/src/util/storage_file.c b/src/util/storage_file.c
> index 27aad26..b656557 100644
> --- a/src/util/storage_file.c
> +++ b/src/util/storage_file.c
> @@ -41,7 +41,7 @@
>  
>  VIR_ENUM_IMPL(virStorageFileFormat,
>                VIR_STORAGE_FILE_LAST,
> -              "raw", "dir", "bochs",
> +              "raw", "probe", "dir", "bochs",
>                "cloop", "cow", "dmg", "iso",
>                "qcow", "qcow2", "qed", "vmdk", "vpc")
>  
> diff --git a/src/util/storage_file.h b/src/util/storage_file.h
> index c4d4650..13c731f 100644
> --- a/src/util/storage_file.h
> +++ b/src/util/storage_file.h
> @@ -30,6 +30,7 @@
>  enum virStorageFileFormat {
>      VIR_STORAGE_FILE_AUTO = -1,
>      VIR_STORAGE_FILE_RAW = 0,
> +    VIR_STORAGE_FILE_AUTO_SAFE,

You need to make sure that this is set to '-2', otherwise
this value becomes parsable in the XML which is not
desired. THis avoids the need to add it to the enum
above.

>      VIR_STORAGE_FILE_DIR,
>      VIR_STORAGE_FILE_BOCHS,
>      VIR_STORAGE_FILE_CLOOP,


Daniel




More information about the libvir-list mailing list