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

2010-11-19 Thread Adam Litke
Signed-off-by: Adam Litke 
---
 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,
 VIR_STORAGE_FILE_DIR,
 VIR_STORAGE_FILE_BOCHS,
 VIR_STORAGE_FILE_CLOOP,
-- 
1.7.3.2.164.g6f10c

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


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

2010-11-22 Thread Adam Litke
Signed-off-by: Adam Litke 
Acked-by: Eric Blake 
---
 src/conf/domain_conf.c  |4 
 src/util/storage_file.h |1 +
 2 files changed, 5 insertions(+), 0 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.h b/src/util/storage_file.h
index c4d4650..1eef4c5 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -28,6 +28,7 @@
 # include 
 
 enum virStorageFileFormat {
+VIR_STORAGE_FILE_AUTO_SAFE = -2,
 VIR_STORAGE_FILE_AUTO = -1,
 VIR_STORAGE_FILE_RAW = 0,
 VIR_STORAGE_FILE_DIR,
-- 
1.7.3.2.164.g6f10c

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


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

2010-11-19 Thread Eric Blake
On 11/19/2010 09:18 AM, Adam Litke wrote:
> Signed-off-by: Adam Litke 
> ---
>  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);

ACK.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2010-11-22 Thread Daniel P. Berrange
On Fri, Nov 19, 2010 at 10:18:17AM -0600, Adam Litke wrote:
> Signed-off-by: Adam Litke 
> ---
>  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

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


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

2010-11-22 Thread Adam Litke
On Mon, 2010-11-22 at 11:04 +, Daniel P. Berrange wrote: 
> > 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.

Ah, of course.  I'll respin the series to incorporate this, and some of
the other items Eric suggested.


> >  VIR_STORAGE_FILE_DIR,
> >  VIR_STORAGE_FILE_BOCHS,
> >  VIR_STORAGE_FILE_CLOOP,
> 
> 
> Daniel

-- 
Thanks,
Adam

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