0.7.5; <code>type='network'</code> since
0.8.7; <code>protocol='iscsi'</code> since 1.0.4;
<code>type='volume'</code> since 1.0.5;</span><br/>
- For a "file" disk type which represents a cdrom or floppy
+ For a "file" or "volume" disk type which represents a cdrom or floppy
(the <code>device</code> attribute), it is possible to define
policy what to do with the disk if the source file is not accessible.
- This is done by the <code>startupPolicy</code> attribute, accepting
- these values:
+ (NB, <code>startupPolicy</code> is not valid for "volume" disk unless
+ the specified storage volume is of "file" type). This is done by the
+ <code>startupPolicy</code> attribute, accepting these values:
<table class="top_table">
<tr>
<td> mandatory </td>
<attribute name="volume">
<ref name="volName"/>
</attribute>
+ <optional>
+ <ref name="startupPolicy"/>
+ </optional>
</element>
</optional>
<ref name="diskspec"/>
case VIR_DOMAIN_DISK_TYPE_VOLUME:
if (virDomainDiskSourcePoolDefParse(cur, def) < 0)
goto error;
+ startupPolicy = virXMLPropString(cur, "startupPolicy");
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
/* Parsing guarantees the def->srcpool->volume cannot be NULL
* if def->srcpool->pool is not NULL.
*/
- if (def->srcpool->pool)
- virBufferAsprintf(buf, " <source pool='%s' volume='%s'/>\n",
+ if (def->srcpool)
+ virBufferAsprintf(buf, " <source pool='%s' volume='%s'",
def->srcpool->pool, def->srcpool->volume);
+ if (def->startupPolicy)
+ virBufferEscapeString(buf, " startupPolicy='%s'/>\n", startupPolicy);
+ else
+ virBufferAddLit(buf, "/>\n");
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
if (virStorageVolGetInfo(vol, &info) < 0)
goto cleanup;
+ if (def->startupPolicy &&
+ info.type != VIR_STORAGE_VOL_FILE) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'startupPolicy' is only valid for 'file' type volume"));
+ goto cleanup;
+ }
+
switch (info.type) {
case VIR_STORAGE_VOL_FILE:
case VIR_STORAGE_VOL_BLOCK:
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='volume' device='cdrom'>
- <source pool='blk-pool0' volume='blk-pool0-vol0'/>
+ <source pool='blk-pool0' volume='blk-pool0-vol0' startupPolicy='optional'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>