[libvirt] [PATCH 5/6] Add 'nbd' as a valid filesystem driver type

Michal Privoznik mprivozn at redhat.com
Fri May 10 11:30:10 UTC 2013


On 03.05.2013 15:49, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The <filesystem> element can now accept a <driver type='nbd'/>
> as an alternative to 'loop'. The benefit of NBD is support
> for non-raw disk image formats.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  docs/formatdomain.html.in                 | 5 +++--
>  docs/schemas/domaincommon.rng             | 1 +
>  src/conf/domain_conf.c                    | 3 ++-
>  src/conf/domain_conf.h                    | 1 +
>  src/qemu/qemu_command.c                   | 1 +
>  tests/lxcxml2xmldata/lxc-disk-formats.xml | 5 +++++
>  6 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index c95756e..768b54c 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1985,8 +1985,9 @@
>              the <code>type</code> attribute selects the primary
>              backend driver name, while the <code>format</code>
>              attribute provides the format type. For example, LXC
> -            supports a type of "loop", with a format of "raw". QEMU
> -            supports a type of "path" or "handle", but no formats.
> +            supports a type of "loop", with a format of "raw" or
> +            "nbd" with any format. QEMU supports a type of "path"
> +            or "handle", but no formats.
>            </li>
>          </ul>
>        </dd>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 7d1cfa6..73225fc 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1675,6 +1675,7 @@
>              <value>path</value>
>              <value>handle</value>
>              <value>loop</value>
> +            <value>nbd</value>
>            </choice>
>          </attribute>
>        </optional>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f858485..6bb30ae 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -343,7 +343,8 @@ VIR_ENUM_IMPL(virDomainFSDriverType, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
>                "default",
>                "path",
>                "handle",
> -              "loop")
> +              "loop",
> +              "nbd")
>  
>  VIR_ENUM_IMPL(virDomainFSAccessMode, VIR_DOMAIN_FS_ACCESSMODE_LAST,
>                "passthrough",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 76a6dd0..c9e5d66 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -793,6 +793,7 @@ enum virDomainFSDriverType {
>      VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
>      VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
>      VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
> +    VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
>  
>      VIR_DOMAIN_FS_DRIVER_TYPE_LAST
>  };
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 24f2fab..894b1a9 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -139,6 +139,7 @@ VIR_ENUM_IMPL(qemuDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
>                "local",
>                "local",
>                "handle",
> +              NULL,
>                NULL);
>  
>  
> diff --git a/tests/lxcxml2xmldata/lxc-disk-formats.xml b/tests/lxcxml2xmldata/lxc-disk-formats.xml
> index da53cf2..e953065 100644
> --- a/tests/lxcxml2xmldata/lxc-disk-formats.xml
> +++ b/tests/lxcxml2xmldata/lxc-disk-formats.xml
> @@ -19,6 +19,11 @@
>        <source file='/root/container.img'/>
>        <target dir='/'/>
>      </filesystem>
> +    <filesystem type='file' accessmode='passthrough'>
> +      <driver type='nbd' format='qcow2'/>
> +      <source file='/root/container.qcow2'/>
> +      <target dir='/home'/>
> +    </filesystem>
>      <console type='pty'>
>        <target type='lxc' port='0'/>
>      </console>
> 

ACK

Michal




More information about the libvir-list mailing list