Network XML format
+-
+ Element and attribute overview
+
- + General metadata +
- + Connectivity +
- + Addressing +
- + Example configuration + +
This page provides an introduction to the network XML format. For background information on the concepts referred to here, consult the network driver architecture page.
-Element and attribute overview
++ Element and attribute overview +
The root element required for all virtual networks is
named network
and has no attributes.
+ The network XML format is available since 0.3.0
General metadata
++ General metadata +
The first elements provide basic metadata about the virtual network. @@ -139,12 +163,14 @@ consist only of alpha-numeric characters and is required to be unique within the scope of a single host. It is used to form the filename for storing the persistent - configuration file.
uuid
uuid
element provides
+ configuration file. Since 0.3.0uuid
uuid
element provides
a globally unique identifier for the virtual network.
The format must be RFC 4122 compliant, eg 3e3fce45-4f53-4fa7-bb32-11f34168b82b
.
If omitted when defining/creating a new network, a random
- UUID is generated.Connectivity
+ UUID is generated. Since 0.3.0 ++ Connectivity +
The next set of elements control how a virtual network is provided connectivity to the physical LAN (if at all). @@ -152,7 +178,7 @@
... <bridge name="virbr0" /> - <forward type="nat"/> + <forward mode="nat" dev="eth0"/> ...
bridge
- The
name
attribute on thebridge
element defines the name of a bridge device which will be used to construct @@ -161,18 +187,22 @@ may also be connected to the LAN. It is recommended that bridge device names started with the prefixvir
, but the namevirbr0
is reserved for the "default" virtual network. - This element should always be provided when defining a new network + This element should always be provided when defining a new network. + Since 0.3.0 forward
- Inclusion of the
forward
element indicates that the virtual network is to be connected to the physical LAN. If no attributes are set, NAT forwarding will be used for connectivity. Firewall rules will allow forwarding to any other network device whether ethernet, wireless, dialup, or VPN. If thedev
attribute is set, the firewall rules will restrict forwarding to the named - device only. If thetype
attribute is set toroute
+ device only. If themode
attribute is set toroute
then the traffic will not have NAT applied. This presumes that the local LAN router has suitable routing table entries to return traffic - to this host.
Addressing
+ to this host. Since 0.3.0; 'mode' attribute since + 0.4.2 ++ Addressing +
The final set of elements define the IPv4 address range available,
and optionally enable DHCP sevices.
@@ -190,19 +220,24 @@
device associated with the virtual network. To the guests this
address will be their default route. The netmask
attribute defines the significant bits of the network address,
- again specified in dotted-decimal format.
+ again specified in dotted-decimal format. Since 0.3.0
dhcp
ip
element there is an
optional dhcp
element. The presence of this element
enables DHCP services on the virtual network. It will further
contain one or more range
elements.
+ Since 0.3.0
range
start
and end
attributes on the
range
element specify the boundaries of a pool of
IPv4 addresses to be provided to DHCP clients. These two addresses
must lie within the scope of the network defined on the parent
- ip
element.
+ ip
element. Since 0.3.0
Example configuration
-NAT based network
++ Example configuration +
++ NAT based network +
This example is the so called "default" virtual network. It is provided and enabled out-of-the-box for all libvirt installations. @@ -223,7 +258,9 @@ </dhcp> </ip> </network> -
Routed network config
++ Routed network config +
This is a variant on the default network which routes traffic from the virtual network to the LAN without applying any NAT. @@ -243,7 +280,9 @@ </dhcp> </ip> </network> -
Isolated network config
++ Isolated network config +
This variant provides a completely isolated private network for guests. The guests can talk to each other, and the host diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index d3da000321..9c46a8946a 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -2,20 +2,24 @@
Network XML format
+-
+
This page provides an introduction to the network XML format. For background information on the concepts referred to here, consult the network driver architecture page.
-Element and attribute overview
+Element and attribute overview
The root element required for all virtual networks is
named network
and has no attributes.
+ The network XML format is available since 0.3.0
General metadata
+General metadata
The first elements provide basic metadata about the virtual @@ -35,16 +39,16 @@ consist only of alpha-numeric characters and is required to be unique within the scope of a single host. It is used to form the filename for storing the persistent - configuration file. + configuration file. Since 0.3.0
uuid
uuid
element provides
a globally unique identifier for the virtual network.
The format must be RFC 4122 compliant, eg 3e3fce45-4f53-4fa7-bb32-11f34168b82b
.
If omitted when defining/creating a new network, a random
- UUID is generated.Connectivity
+Connectivity
The next set of elements control how a virtual network is @@ -54,7 +58,7 @@
... <bridge name="virbr0" /> - <forward type="nat"/> + <forward mode="nat" dev="eth0"/> ...
-
@@ -66,7 +70,8 @@
may also be connected to the LAN. It is recommended that bridge
device names started with the prefix
forward
- Inclusion of the
forward
element indicates that @@ -75,13 +80,14 @@ Firewall rules will allow forwarding to any other network device whether ethernet, wireless, dialup, or VPN. If thedev
attribute is set, the firewall rules will restrict forwarding to the named - device only. If thetype
attribute is set toroute
+ device only. If themode
attribute is set toroute
then the traffic will not have NAT applied. This presumes that the local LAN router has suitable routing table entries to return traffic - to this host.
+ to this host. Since 0.3.0; 'mode' attribute since
+ 0.4.2
vir
, but the name
virbr0
is reserved for the "default" virtual network.
- This element should always be provided when defining a new network
+ This element should always be provided when defining a new network.
+ Since 0.3.0
Addressing
+Addressing
The final set of elements define the IPv4 address range available,
@@ -104,26 +110,27 @@
device associated with the virtual network. To the guests this
address will be their default route. The netmask
attribute defines the significant bits of the network address,
- again specified in dotted-decimal format.
+ again specified in dotted-decimal format. Since 0.3.0
dhcp
ip
element there is an
optional dhcp
element. The presence of this element
enables DHCP services on the virtual network. It will further
contain one or more range
elements.
+ Since 0.3.0
range
start
and end
attributes on the
range
element specify the boundaries of a pool of
IPv4 addresses to be provided to DHCP clients. These two addresses
must lie within the scope of the network defined on the parent
- ip
element.
+ ip
element. Since 0.3.0
Example configuration
+Example configuration
-NAT based network
+NAT based network
This example is the so called "default" virtual network. It is @@ -147,7 +154,7 @@ </ip> </network> -
Routed network config
+Routed network config
This is a variant on the default network which routes traffic @@ -170,7 +177,7 @@ </ip> </network> -
Isolated network config
+Isolated network config
This variant provides a completely isolated private network diff --git a/docs/formatstorage.html b/docs/formatstorage.html index df139c064e..4f0027bcd2 100644 --- a/docs/formatstorage.html +++ b/docs/formatstorage.html @@ -115,171 +115,300 @@
Storage pool and volume XML format
-
- Storage pool XML
-
-
- First level elements
+ Storage pool XML
+
- + General metadata +
- + Source elements +
- + Target elements +
- + Device extents +
-
- Source elements
+ Storage volume XML
+
- + General metadata +
- + Target elements +
- - Target elements -
- - Device extents -
-
- First level elements
+ Storage pool XML
+
-
- Storage volume XML
-
- - First level elements -
- - Source elements -
- - Target elements -
+ Example configuration
+
+
+
Storage pool XML
-
+
-Although all storage pool backends share the same public APIs and -XML format, they have varying levels of capabilities. Some may -allow creation of volumes, others may only allow use of pre-existing -volumes. Some may have constraints on volume size, or placement. -
-The is the top level tag for a storage pool document is 'pool'. It has
-a single attribute type
, which is one of dir
,
-fs
,netfs
,disk
,iscsi
,
-logical
. This corresponds to the storage backend drivers
-listed further along in this document.
-
- First level elements -
-- name
- Providing a name for the pool which is unique to the host. -This is mandatory when defining a pool
- uuid
- Providing an identifier for the pool which is globally unique. -This is optional when defining a pool, a UUID will be generated if -omitted
- allocation
- Providing the total storage allocation for the pool. This may -be larger than the sum of the allocation of all volumes due to -metadata overhead. This value is in bytes. This is not applicable -when creating a pool.
- capacity
- Providing the total storage capacity for the pool. Due to -underlying device constraints it may not be possible to use the -full capacity for storage volumes. This value is in bytes. This -is not applicable when creating a pool.
- available
- Providing the free space available for allocating new volumes -in the pool. Due to underlying device constraints it may not be -possible to allocate the entire free space to a single volume. -This value is in bytes. This is not applicable when creating a -pool.
- source
- Provides information about the source of the pool, such as -the underlying host devices, or remote server
- target
- Provides information about the representation of the pool -on the local host.
- Source elements -
-- device
- Provides the source for pools backed by physical devices.
-May be repeated multiple times depending on backend driver. Contains
-a single attribute
path
which is the fully qualified -path to the block device node. - directory
- Provides the source for pools backed by directories. May
-only occur once. Contains a single attribute
path
-which is the fully qualified path to the block device node. - host
- Provides the source for pools backed by storage from a
-remote server. Will be used in combination with a
directory
-ordevice
element. Contains an attributename
-which is the hostname or IP address of the server. May optionally -contain a
port
attribute for the protocol specific -port number. - format
- Provides information about the format of the pool. This
-contains a single attribute
type
whose value is -backend specific. This is typically used to indicate filesystem -type, or network filesystem type, or partition table type, or -LVM metadata type. All drivers are required to have a default -value for this, so it is optional.
- Target elements -
-- path
- Provides the location at which the pool will be mapped into
-the local filesystem namespace. For a filesystem/directory based
-pool it will be the name of the directory in which volumes will
-be created. For device based pools it will be the name of the directory in which
-devices nodes exist. For the latter
/dev/
may seem -like the logical choice, however, devices nodes there are not -guaranteed stable across reboots, since they are allocated on -demand. It is preferable to use a stable location such as one -of the/dev/disk/by-{path,id,uuid,label
locations. - - permissions
- Provides information about the default permissions to use
-when creating volumes. This is currently only useful for directory
-or filesystem based pools, where the volumes allocated are simple
-files. For pools where the volumes are device nodes, the hotplug
-scripts determine permissions. It contains 4 child elements. The
-
mode
element contains the octal permission set. The -owner
element contains the numeric user ID. Thegroup
-element contains the numeric group ID. Thelabel
element -contains the MAC (eg SELinux) label string. -
- Device extents -
+ Although all storage pool backends share the same public APIs and + XML format, they have varying levels of capabilities. Some may + allow creation of volumes, others may only allow use of pre-existing + volumes. Some may have constraints on volume size, or placement. +
-If a storage pool exposes information about its underlying
-placement / allocation scheme, the device
element
-within the source
element may contain information
-about its available extents. Some pools have a constraint that
-a volume must be allocated entirely within a single constraint
-(eg disk partition pools). Thus the extent information allows an
-application to determine the maximum possible size for a new
-volume
-
-For storage pools supporting extent information, within each
-device
element there will be zero or more freeExtent
-elements. Each of these elements contains two attributes, start
-and end
which provide the boundaries of the extent on the
-device, measured in bytes.
-
type
, which is one of dir
,
+ fs
,netfs
,disk
,iscsi
,
+ logical
. This corresponds to the storage backend drivers
+ listed further along in this document.
+ The storage pool XML format is available since 0.4.1
+
- Storage volume XML + General metadata +
++ <pool type="iscsi"> + <name>virtimages</name> + <uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid> + <allocation>10000000</allocation> + <capacity>50000000</capacity> + <available>40000000</available> + ...+
name
- Providing a name for the pool which is unique to the host. + This is mandatory when defining a pool. Since 0.4.1
uuid
- Providing an identifier for the pool which is globally unique. + This is optional when defining a pool, a UUID will be generated if + omitted. Since 0.4.1
allocation
- Providing the total storage allocation for the pool. This may + be larger than the sum of the allocation of all volumes due to + metadata overhead. This value is in bytes. This is not applicable + when creating a pool. Since 0.4.1
capacity
- Providing the total storage capacity for the pool. Due to + underlying device constraints it may not be possible to use the + full capacity for storage volumes. This value is in bytes. This + is not applicable when creating a pool. Since 0.4.1
available
- Providing the free space available for allocating new volumes + in the pool. Due to underlying device constraints it may not be + possible to allocate the entire free space to a single volume. + This value is in bytes. This is not applicable when creating a + pool. Since 0.4.1
+ Source elements
-A storage volume will be either a file or a device node. -
-- First level elements -
-- name
- Providing a name for the pool which is unique to the host. -This is mandatory when defining a pool
- uuid
- Providing an identifier for the pool which is globally unique. -This is optional when defining a pool, a UUID will be generated if -omitted
- allocation
- Providing the total storage allocation for the volume. This -may be smaller than the logical capacity if the volume is sparsely -allocated. It may also be larger than the logical capacity if the -volume has substantial metadata overhead. This value is in bytes. -If omitted when creating a volume, the volume will be fully -allocated at time of creation. If set to a value smaller than the -capacity, the pool has the option of deciding -to sparsely allocate a volume. It does not have to honour requests -for sparse allocation though.
- capacity
- Providing the logical capacity for the volume. This value is -in bytes. This is compulsory when creating a volume
- source
- Provides information about the underlying storage allocation -of the volume. This may not be available for some pool types.
- target
- Provides information about the representation of the volume -on the local host.
+ A single source
element is contained within the top level
+ pool
element. This tag is used to describe the source of
+ the storage pool. It can contain the following child elements:
+
+
+ ...
+ <source>
+ <host name="iscsi.example.com"/>
+ <device path="demo-target"/>
+ </source>
+ ...
+ device
- Provides the source for pools backed by physical devices.
+ May be repeated multiple times depending on backend driver. Contains
+ a single attribute
path
which is the fully qualified
+ path to the block device node. Since 0.4.1 directory
- Provides the source for pools backed by directories. May
+ only occur once. Contains a single attribute
path
+ which is the fully qualified path to the block device node.
+ Since 0.4.1 host
- Provides the source for pools backed by storage from a
+ remote server. Will be used in combination with a
directory
+ or device
element. Contains an attribute name
+ which is the hostname or IP address of the server. May optionally
+ contain a port
attribute for the protocol specific
+ port number. Since 0.4.1 format
- Provides information about the format of the pool. This
+ contains a single attribute
type
whose value is
+ backend specific. This is typically used to indicate filesystem
+ type, or network filesystem type, or partition table type, or
+ LVM metadata type. All drivers are required to have a default
+ value for this, so it is optional. Since 0.4.1
+
+ Target elements
+
+
device
path
which is the fully qualified
+ path to the block device node. Since 0.4.1directory
path
+ which is the fully qualified path to the block device node.
+ Since 0.4.1host
directory
+ or device
element. Contains an attribute name
+ which is the hostname or IP address of the server. May optionally
+ contain a port
attribute for the protocol specific
+ port number. Since 0.4.1format
type
whose value is
+ backend specific. This is typically used to indicate filesystem
+ type, or network filesystem type, or partition table type, or
+ LVM metadata type. All drivers are required to have a default
+ value for this, so it is optional. Since 0.4.1
+ A single target
element is contained within the top level
+ pool
element. This tag is used to describe the mapping of
+ the storage pool into the host filesystem. It can contain the following
+ child elements:
+
+ ... + <target> + <path>/dev/disk/by-path</path> + <permissions> + <owner>0744</owner> + <group>0744</group> + <mode>0744</mode> + <label>virt_image_t</label> + </permissions> + </target> + </pool>+
path
- Provides the location at which the pool will be mapped into
+ the local filesystem namespace. For a filesystem/directory based
+ pool it will be the name of the directory in which volumes will
+ be created. For device based pools it will be the name of the directory in which
+ devices nodes exist. For the latter
/dev/
may seem + like the logical choice, however, devices nodes there are not + guaranteed stable across reboots, since they are allocated on + demand. It is preferable to use a stable location such as one + of the/dev/disk/by-{path,id,uuid,label
locations. + Since 0.4.1 + permissions
- Provides information about the default permissions to use
+ when creating volumes. This is currently only useful for directory
+ or filesystem based pools, where the volumes allocated are simple
+ files. For pools where the volumes are device nodes, the hotplug
+ scripts determine permissions. It contains 4 child elements. The
+
mode
element contains the octal permission set. The +owner
element contains the numeric user ID. Thegroup
+ element contains the numeric group ID. Thelabel
element + contains the MAC (eg SELinux) label string. + Since 0.4.1 +
+ Device extents +
+
+ If a storage pool exposes information about its underlying
+ placement / allocation scheme, the device
element
+ within the source
element may contain information
+ about its available extents. Some pools have a constraint that
+ a volume must be allocated entirely within a single constraint
+ (eg disk partition pools). Thus the extent information allows an
+ application to determine the maximum possible size for a new
+ volume
+
+ For storage pools supporting extent information, within each
+ device
element there will be zero or more freeExtent
+ elements. Each of these elements contains two attributes, start
+ and end
which provide the boundaries of the extent on the
+ device, measured in bytes. Since 0.4.1
+
+ Storage volume XML +
++ A storage volume will be either a file or a device node. + The storage volume XML format is available since 0.4.1 +
++ General metadata +
++ <volume type="file"> + <name>sparse.img</name> + <key>/var/lib/xen/images/sparse.img</key> + <allocation>0</allocation> + <capacity unit="T">1</capacity> + ...+
name
- Providing a name for the volume which is unique to the pool. + This is mandatory when defining a volume. Since 0.4.1
key
- Providing an identifier for the volume which is globally unique. + This is optional when defining a volume, a key will be generated if + omitted. Since 0.4.1
allocation
- Providing the total storage allocation for the volume. This + may be smaller than the logical capacity if the volume is sparsely + allocated. It may also be larger than the logical capacity if the + volume has substantial metadata overhead. This value is in bytes. + If omitted when creating a volume, the volume will be fully + allocated at time of creation. If set to a value smaller than the + capacity, the pool has the option of deciding + to sparsely allocate a volume. It does not have to honour requests + for sparse allocation though. Since 0.4.1
capacity
- Providing the logical capacity for the volume. This value is + in bytes. This is compulsory when creating a volume. + Since 0.4.1
source
- Provides information about the underlying storage allocation + of the volume. This may not be available for some pool types. + Since 0.4.1
target
- Provides information about the representation of the volume + on the local host. Since 0.4.1
Target elements
-
- - path
- Provides the location at which the pool will be mapped into
-the local filesystem namespace. For a filesystem/directory based
-pool it will be the name of the directory in which volumes will
-be created. For device based pools it will be the name of the directory in which
-devices nodes exist. For the latter
/dev/
may seem
-like the logical choice, however, devices nodes there are not
-guaranteed stable across reboots, since they are allocated on
-demand. It is preferable to use a stable location such as one
-of the /dev/disk/by-{path,id,uuid,label
locations.
- - format
- Provides information about the pool specific volume format.
-For disk pools it will provide the partition type. For filesystem
-or directory pools it will provide the file format type, eg cow,
-qcow, vmdk, raw. If omitted when creating a volume, the pool's
-default format will be used. The actual format is specified via
-the
type
. Consult the pool-specific docs for the
-list of valid values. - permissions
- Provides information about the default permissions to use
-when creating volumes. This is currently only useful for directory
-or filesystem based pools, where the volumes allocated are simple
-files. For pools where the volumes are device nodes, the hotplug
-scripts determine permissions. It contains 4 child elements. The
-
mode
element contains the octal permission set. The
-owner
element contains the numeric user ID. The group
-element contains the numeric group ID. The label
element
-contains the MAC (eg SELinux) label string.
-
+
+ /dev/
may seem
-like the logical choice, however, devices nodes there are not
-guaranteed stable across reboots, since they are allocated on
-demand. It is preferable to use a stable location such as one
-of the /dev/disk/by-{path,id,uuid,label
locations.
-type
. Consult the pool-specific docs for the
-list of valid values.mode
element contains the octal permission set. The
-owner
element contains the numeric user ID. The group
-element contains the numeric group ID. The label
element
-contains the MAC (eg SELinux) label string.
-
+ A single target
element is contained within the top level
+ volume
element. This tag is used to describe the mapping of
+ the storage volume into the host filesystem. It can contain the following
+ child elements:
+
+ ... + <target> + <path>/var/lib/virt/images/sparse.img</path> + <permissions> + <owner>0744</owner> + <group>0744</group> + <mode>0744</mode> + <label>virt_image_t</label> + </permissions> + </target> + </volume>+
path
- Provides the location at which the pool will be mapped into
+ the local filesystem namespace. For a filesystem/directory based
+ pool it will be the name of the directory in which volumes will
+ be created. For device based pools it will be the name of the directory in which
+ devices nodes exist. For the latter
/dev/
may seem + like the logical choice, however, devices nodes there are not + guaranteed stable across reboots, since they are allocated on + demand. It is preferable to use a stable location such as one + of the/dev/disk/by-{path,id,uuid,label
locations. + Since 0.4.1 + format
- Provides information about the pool specific volume format.
+ For disk pools it will provide the partition type. For filesystem
+ or directory pools it will provide the file format type, eg cow,
+ qcow, vmdk, raw. If omitted when creating a volume, the pool's
+ default format will be used. The actual format is specified via
+ the
type
. Consult the pool-specific docs for the + list of valid values. Since 0.4.1 permissions
- Provides information about the default permissions to use
+ when creating volumes. This is currently only useful for directory
+ or filesystem based pools, where the volumes allocated are simple
+ files. For pools where the volumes are device nodes, the hotplug
+ scripts determine permissions. It contains 4 child elements. The
+
mode
element contains the octal permission set. The +owner
element contains the numeric user ID. Thegroup
+ element contains the numeric group ID. Thelabel
element + contains the MAC (eg SELinux) label string. + Since 0.4.1 +
+ Example configuration +
++ Here are a couple of examples, for a more complete set demonstrating + every type of storage pool, consult the storage driver page +
++ File based storage pool +
++ <pool type="dir"> + <name>virtimages</name> + <target> + <path>/var/lib/virt/images</path> + </target> + </pool>+
+ iSCSI based storage pool +
++ <pool type="iscsi"> + <name>virtimages</name> + <source> + <host name="iscsi.example.com"/> + <device path="demo-target"/> + </source> + <target> + <path>/dev/disk/by-path</path> + </target> + </pool>+
+ Storage volume +
++ <volume type="file"> + <name>sparse.img</name> + <allocation>0</allocation> + <capacity unit="T">1</capacity> + <target> + <path>/var/lib/virt/images/sparse.img</path> + <permissions> + <owner>0744</owner> + <group>0744</group> + <mode>0744</mode> + <label>virt_image_t</label> + </permissions> + </target> + </volume>