HP BL680c XenServer Software Development Kit Guide 4.1.0 - Page 14

Storage Repository, attached, connectors, Virtual Block Device, hot plugs, hot unplugs, Virtual

Page 14 highlights

Overview of the XenServer API SR Network fields include "virtual_size" and "sharable". (When we called VM.provision on the VM template in our previous example, some VDI objects were automatically created to represent the newly created disks, and attached to the VM object.) An SR (Storage Repository) aggregates a collection of VDIs and encapsulates the properties of physical storage on which the VDIs' bits reside. Example fields include "type" (which determines the storage-specific driver a XenServer installation uses to read/write the SR's VDIs) and "physical_utilisation"; example methods include "scan" (which invokes the storage-specific driver to acquire a list of the VDIs contained with the SR and the properties of these VDIs) and "create" (which initializes a block of physical storage so it is ready to store VDIs). A network object represents a layer-2 network that exists in the environment in which the XenServer Host instance lives. Since XenServer does not manage networks directly this is a lightweight class that serves merely to model physical and virtual network topology. VM and Host objects that are attached to a particular Network object (by virtue of VIF and PIF instances -- see below) can send network packets to each other. At this point, readers who are finding this enumeration of classes rather terse may wish to skip to the code walk-throughs of the next chapter: there are plenty of useful applications that can be written using only a subset of the classes already described! For those who wish to continue this description of classes in the abstract, read on. On top of the classes listed above, there are 4 more that act as connectors, specifying relationships between VMs and Hosts, and Storage and Networks. The first 2 of these classes that we will consider, VBD and VIF, determine how VMs are attached to virtual disks and network objects respectively: VBD VIF A VBD (Virtual Block Device) object represents an attachment between a VM and a VDI. When a VM is booted its VBD objects are queried to determine which disk images (i.e. VDIs) should be attached. Example methods of the VBD class include "plug" (which hot plugs a disk device into a running VM, making the specified VDI accessible therein) and "unplug" (which hot unplugs a disk device from a running guest); example fields include "device" (which determines the device name inside the guest under which the specified VDI will be made accessible). A VIF (Virtual network InterFace) object represents an attachment between a VM and a Network object. When a VM is booted its VIF objects are queried to determine which network devices should be create. Example methods of the VIF class include "plug" (which hot plugs a network device into a running VM) and "unplug" (which hot unplugs a network device from a running guest). The second set of "connector classes" that we will consider determine how Hosts are attached to Networks and Storage. PIF A PIF (Physical InterFace) object represents an attachment between a Host and a Network object. If a host is connected to a Network (via a PIF) then packets from the specified host can be transmitted/received by the corresponding host. Example fields of the PIF class include "device" (which specifies the device name to which the PIF corresponds -- e.g. eth0) and "MAC" (which specifies the MAC address of the underlying NIC that a PIF represents). Note that PIFs abstract both physical interfaces and VLANs (the latter distinguished by the existence of a positive integer in the "VLAN" field). 8

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

Overview of the XenServer API
8
fields include "virtual_size" and "sharable". (When we called
VM.provision
on the VM template in our previous example, some VDI objects were
automatically created to represent the newly created disks, and attached to
the VM object.)
SR
An SR (
Storage Repository
) aggregates a collection of VDIs and encapsulates
the properties of physical storage on which the VDIs' bits reside. Example
fields include "type" (which determines the storage-specific driver a XenServer
installation uses to read/write the SR's VDIs) and "physical_utilisation";
example methods include "scan" (which invokes the storage-specific driver to
acquire a list of the VDIs contained with the SR and the properties of these
VDIs) and "create" (which initializes a block of physical storage so it is ready
to store VDIs).
Network
A network object represents a layer-2 network that exists in the environment in
which the XenServer Host instance lives. Since XenServer does not manage
networks directly this is a lightweight class that serves merely to model
physical and virtual network topology. VM and Host objects that are
attached
to a particular Network object (by virtue of VIF and PIF instances -- see below)
can send network packets to each other.
At this point, readers who are finding this enumeration of classes rather terse may wish to skip to the code
walk-throughs of the next chapter: there are plenty of useful applications that can be written using only a
subset of the classes already described! For those who wish to continue this description of classes in the
abstract, read on.
On top of the classes listed above, there are 4 more that act as
connectors
, specifying relationships between
VMs and Hosts, and Storage and Networks. The first 2 of these classes that we will consider,
VBD
and
VIF
,
determine how VMs are attached to virtual disks and network objects respectively:
VBD
A VBD (
Virtual Block Device
) object represents an attachment between a VM
and a VDI. When a VM is booted its VBD objects are queried to determine
which disk images (i.e. VDIs) should be attached. Example methods of the
VBD class include "plug" (which
hot plugs
a disk device into a running VM,
making the specified VDI accessible therein) and "unplug" (which
hot unplugs
a disk device from a running guest); example fields include "device" (which
determines the device name inside the guest under which the specified VDI
will be made accessible).
VIF
A VIF (
Virtual network InterFace
) object represents an attachment between a
VM and a Network object. When a VM is booted its VIF objects are queried to
determine which network devices should be create. Example methods of the
VIF class include "plug" (which
hot plugs
a network device into a running VM)
and "unplug" (which
hot unplugs
a network device from a running guest).
The second set of "connector classes" that we will consider determine how Hosts are attached to Networks
and Storage.
PIF
A PIF (
Physical InterFace
) object represents an attachment between a
Host and a Network object. If a host is connected to a Network (via a PIF)
then packets from the specified host can be transmitted/received by the
corresponding host. Example fields of the PIF class include "device" (which
specifies the device name to which the PIF corresponds -- e.g.
eth0
) and
"MAC" (which specifies the MAC address of the underlying NIC that a PIF
represents). Note that PIFs abstract both physical interfaces and VLANs (the
latter distinguished by the existence of a positive integer in the "VLAN" field).