Peter Feiner | 8 Aug 2012 23:02
Picon
Gravatar

[libvirt] [PATCH] Allow rbd backing stores

Prevents libvirt from treating RBD backing stores as files. Without this patch,
creating a domain with a qcow2 overlay on an RBD would fail.

This patch essentially extends 9c7c4a4fc533598e59e9a0038ec783e61a38e664,
which allows nbd backing stores, to allow rbd backing stores.

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index f38aa8e..101518a 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
<at> <at> -589,8 +589,8 <at> <at> virStorageFileMatchesVersion(int format,
 static bool
 virBackingStoreIsFile(const char *backing)
 {
-    /* Backing store is a network block device */
-    if (STRPREFIX(backing, "nbd:"))
+    /* Backing store is a network block device or Rados block device */
+    if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))
         return false;
     return true;
 }
<div>
<div>Prevents libvirt from treating RBD backing stores as files. Without this patch,</div>
<div>creating a domain with a qcow2 overlay on an RBD would fail.</div>
<div><br></div>
<div>This patch essentially extends&nbsp;9c7c4a4fc533598e59e9a0038ec783e61a38e664,</div>
<div>which allows nbd backing stores, to allow rbd backing stores.</div>
<div><br></div>
<div>diff --git a/src/util/storage_file.c b/src/util/storage_file.c</div>
<div>index f38aa8e..101518a 100644</div>
<div>--- a/src/util/storage_file.c</div>
<div>+++ b/src/util/storage_file.c</div>
<div> <at>  <at>  -589,8 +589,8  <at>  <at>  virStorageFileMatchesVersion(int format,</div>
<div>&nbsp;static bool</div>
<div>&nbsp;virBackingStoreIsFile(const char *backing)</div>
<div>&nbsp;{</div>
<div>- &nbsp; &nbsp;/* Backing store is a network block device */</div>
<div>- &nbsp; &nbsp;if (STRPREFIX(backing, "nbd:"))</div>
<div>+ &nbsp; &nbsp;/* Backing store is a network block device or Rados block device */</div>
<div>+ &nbsp; &nbsp;if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return false;</div>
<div>&nbsp; &nbsp; &nbsp;return true;</div>
<div>&nbsp;}</div>
</div>
Eric Blake | 8 Aug 2012 23:56
Picon
Favicon
Gravatar

Re: [libvirt] [PATCH] Allow rbd backing stores

On 08/08/2012 03:02 PM, Peter Feiner wrote:
> Prevents libvirt from treating RBD backing stores as files. Without this
> patch,
> creating a domain with a qcow2 overlay on an RBD would fail.

Odd line-wrapping.

> 
> This patch essentially extends 9c7c4a4fc533598e59e9a0038ec783e61a38e664,
> which allows nbd backing stores, to allow rbd backing stores.
> 
> diff --git a/src/util/storage_file.c b/src/util/storage_file.c
> index f38aa8e..101518a 100644
> --- a/src/util/storage_file.c
> +++ b/src/util/storage_file.c
>  <at>  <at>  -589,8 +589,8  <at>  <at>  virStorageFileMatchesVersion(int format,
>  static bool
>  virBackingStoreIsFile(const char *backing)
>  {
> -    /* Backing store is a network block device */
> -    if (STRPREFIX(backing, "nbd:"))
> +    /* Backing store is a network block device or Rados block device */
> +    if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))

ACK and pushed.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

On 08/08/2012 03:02 PM, Peter Feiner wrote:
> Prevents libvirt from treating RBD backing stores as files. Without this
> patch,
> creating a domain with a qcow2 overlay on an RBD would fail.

Odd line-wrapping.

> 
> This patch essentially extends 9c7c4a4fc533598e59e9a0038ec783e61a38e664,
> which allows nbd backing stores, to allow rbd backing stores.
> 
> diff --git a/src/util/storage_file.c b/src/util/storage_file.c
> index f38aa8e..101518a 100644
> --- a/src/util/storage_file.c
> +++ b/src/util/storage_file.c
>  <at>  <at>  -589,8 +589,8  <at>  <at>  virStorageFileMatchesVersion(int format,
>  static bool
>  virBackingStoreIsFile(const char *backing)
>  {
> -    /* Backing store is a network block device */
> -    if (STRPREFIX(backing, "nbd:"))
> +    /* Backing store is a network block device or Rados block device */
> +    if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))

ACK and pushed.

--

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


Gmane