Storage Driver 4.4
The Storage subsystem is highly modular. These drivers are separated into two logical sets:
Located under /var/lib/one/remotes/datastore/<ds_mad>
datastore_image_dump image_id
image_source size
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.image_source
is the image source which will be later sent to the transfer manager datastore_image_dump image_id
image_source size
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.image_source
is the image source which will be later sent to the transfer manager.datastore_image_dump image_id
-
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.datastore_image_dump image_id
size
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.size
the size of the image in Mb.datastore_action_dump image_id
source
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.source
the new source
for the image.datastore_action_dump image_id
monitor data
datastore_image_dump
is an XML dump of the driver action encoded in Base 64. See a decoded example.monitor data
The monitoring information of the datastore, namely “USED_MB=…\nTOTAL_MB=…\nFREE_MB=…” which are respectively the used size of the datastore in MB, the total capacity of the datastore in MB and the available space in the datastore in MB.
image_source
has to be dynamically generated by the cp
and mkfs
script. It will be passed later on to the transfer manager, so it should provide all the information the transfer manager needs to locate the image. To illustrate a few examples:
DATASTORE_BASE_PATH + md5sum(date + id)
<base_iqn>:<host>.<vg-name>.<lv-name>
This is a list of the TM drivers and their action. Note that they don't return
anything. If the exit code is not 0
, the driver will have failed.
Located under /var/lib/one/remotes/tm/<tm_mad>
. There are two types of action scripts: the first group applies to general image datastores and includes (clone
, ln
, mv
and mvds
); the second one is only used in conjunction with the system datastore.
Action scripts for generic image datastores:
fe:SOURCE host:remote_system_ds/disk.i vm_id ds_id
fe
is the front-end hostnameSOURCE
is the path of the disk image in the form DS_BASE_PATH/diskhost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)fe:SOURCE host:remote_system_ds/disk.i vm_id ds_id
fe
is the front-end hostnameSOURCE
is the path of the disk image in the form DS_BASE_PATH/diskhost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)host:remote_system_ds/disk.i fe:SOURCE vm_id ds_id
fe
is the front-end hostnameSOURCE
is the path of the disk image in the form DS_BASE_PATH/diskhost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the original datastore for the image)host:remote_system_ds/disk.i fe:SOURCE vm_id ds_id
fe
is the front-end hostnameSOURCE
is the path of the disk image in the form DS_BASE_PATH/diskhost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the original datastore for the image)Action scripts needed when the TM is used for the system datastore:
file1 file2 … fileN host:remote_system_ds/disk.i vm_id ds_id
host
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)host:remote_system_ds/disk.i|host:remote_system_ds/ vm_id ds_id
host
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)size format host:remote_system_ds/disk.i vm_id ds_id
size
size in MB of the imageformat
format for the imagehost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)size host:remote_system_ds/disk.i vm_id ds_id
size
size in MB of the imagehost
is the target host to deploy the VMremote_system_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)hostA:system_ds/disk.i|hostB:system_ds/disk.i vm_id ds_id
OR hostA:system_ds/|hostB:system_ds/ vm_id ds_id
hostA
is the host the VM is in.hostB
is the target host to deploy the VMsystem_ds
is the path for the system datastore in the hostvm_id
is the id of the VMds_id
is the target datastore (the system datastore)source_host dst_host remote_system_dir vmid dsid template
src_host
is the host the VM is in.dst_host
is the target host to migrate the VM toremote_system_ds_dir
is the path for the VM directory in the system datastore in the hostvmid
is the id of the VMdsid
is the target datastoretemplate
is the template of the VM in XML and base64 encodedsource_host dst_host remote_system_dir vmid dsid template
premigrate
description.
mv
script, but consider the arguments received when the TM is used for the system datastore, a regular image datastore or both.
If the TM is only for regular images you only need to implement the first group.
Consider a VM with two disks:
NAME = vm01 CPU = 0.1 MEMORY = 64 DISK = [ IMAGE_ID = 0 ] # non-persistent disk DISK = [ IMAGE_ID = 1 ] # persistent disk
This a list of TM actions that will be called upon the events listed:
CREATE
<tm_mad>/clone <frontend>:<non_pers_image_source> <host01>:<ds_path>/<vm_id>/disk.0 <tm_mad>/ln <frontend>:<pers_image_source> <host01>:<ds_path>/<vm_id>/disk.1
STOP
<tm_mad>/mv <host01>:<ds_path>/<vm_id>/disk.0 <frontend>:<ds_path>/<vm_id>/disk.0 <tm_mad>/mv <host01>:<ds_path>/<vm_id>/disk.1 <frontend>:<ds_path>/<vm_id>/disk.1 <tm_mad_sysds>/mv <host01>:<ds_path>/<vm_id> <frontend>:<ds_path>/<vm_id>
RESUME
<tm_mad>/mv <frontend>:<ds_path>/<vm_id>/disk.0 <host01>:<ds_path>/<vm_id>/disk.0 <tm_mad>/mv <frontend>:<ds_path>/<vm_id>/disk.1 <host01>:<ds_path>/<vm_id>/disk.1 <tm_mad_sysds>/mv <frontend>:<ds_path>/<vm_id> <host01>:<ds_path>/<vm_id>
MIGRATE host01 → host02
<tm_mad>/mv <host01>:<ds_path>/<vm_id>/disk.0 <host02>:<ds_path>/<vm_id>/disk.0 <tm_mad>/mv <host01>:<ds_path>/<vm_id>/disk.1 <host02>:<ds_path>/<vm_id>/disk.1 <tm_mad_sysds>/mv <host01>:<ds_path>/<vm_id> <host02>:<ds_path>/<vm_id>
SHUTDOWN
<tm_mad>/delete <host02>:<ds_path>/<vm_id>/disk.0 <tm_mad>/mvds <host02>:<ds_path>/<vm_id>/disk.1 <pers_image_source> <tm_mad_sysds>/delete <host02>:<ds_path>/<vm_id>
non_pers_image_source
: Source of the non persistent image.pers_image_source
: Source of the persistent image.frontend
: hostname of the frontendhost01
: hostname of host01host02
: hostname of host02tm_mad
: TM driver of the datastore where the image is registeredtm_mad_sysds
: TM driver of the system datastore
There is a helper shell script with some functions defined to do some common tasks. It is located in /var/lib/one/remotes/scripts_common.sh
Here are the description of those functions.
log "Creating directory $DST_DIR"
error_message "File '$FILE' not found"
SRC_HOST=`arg_host $SRC`
SRC_PATH=`arg_path $SRC`
exec_and_log "chmod g+w $DST_PATH"
ssh_exec_and_log "$HOST" "chmod g+w $DST_PATH" "Error message"
exec_and_log
but takes as first parameter the max number of seconds the command can runtimeout_exec_and_log 15 "cp $SRC_PATH $DST_PATH"
The are additional minor helper functions, please read the scripts_common.sh
to see them.