In the future we might need to track state of individual images. Move
the readonly and shared flags to the virStorageSource struct so that we
can keep them in a per-image basis.
---
src/conf/domain_conf.c | 18 ++++++++++--------
src/conf/domain_conf.h | 2 --
src/libxl/libxl_conf.c | 2 +-
src/locking/domain_lock.c | 4 ++--
src/lxc/lxc_cgroup.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/qemu/qemu_cgroup.c | 4 ++--
src/qemu/qemu_command.c | 14 +++++++-------
src/qemu/qemu_conf.c | 4 ++--
src/qemu/qemu_driver.c | 8 ++++----
src/qemu/qemu_migration.c | 16 ++++++++++------
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 6 +++---
src/security/virt-aa-helper.c | 2 +-
src/util/virstoragefile.h | 6 ++++++
src/vbox/vbox_tmpl.c | 30 +++++++++++++++---------------
src/xenxs/xen_sxpr.c | 10 +++++-----
src/xenxs/xen_xm.c | 10 +++++-----
19 files changed, 77 insertions(+), 67 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 02c394f..44903b0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5549,9 +5549,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
- def->readonly = true;
+ def->src->readonly = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
- def->shared = true;
+ def->src->shared = true;
} else if (xmlStrEqual(cur->name, BAD_CAST "transient")) {
def->transient = true;
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
@@ -5678,7 +5678,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
/* Force CDROM to be listed as read only */
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
- def->readonly = true;
+ def->src->readonly = true;
if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
@@ -5700,7 +5700,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
snapshot);
goto error;
}
- } else if (def->readonly) {
+ } else if (def->src->readonly) {
def->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE;
}
@@ -13390,7 +13390,8 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
return false;
}
- if (src->readonly != dst->readonly || src->shared != dst->shared) {
+ if (src->src->readonly != dst->src->readonly ||
+ src->src->shared != dst->src->shared) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Target disk access mode does not match source"));
return false;
@@ -15114,7 +15115,8 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " sgio='%s'", sgio);
if (def->snapshot &&
- !(def->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
def->readonly))
+ !(def->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
+ def->src->readonly))
virBufferAsprintf(buf, " snapshot='%s'",
virDomainSnapshotLocationTypeToString(def->snapshot));
virBufferAddLit(buf, ">\n");
@@ -15270,9 +15272,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "</iotune>\n");
}
- if (def->readonly)
+ if (def->src->readonly)
virBufferAddLit(buf, "<readonly/>\n");
- if (def->shared)
+ if (def->src->shared)
virBufferAddLit(buf, "<shareable/>\n");
if (def->transient)
virBufferAddLit(buf, "<transient/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1122eb2..bd85514 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -636,8 +636,6 @@ struct _virDomainDiskDef {
int copy_on_read; /* enum virDomainDiskCopyOnRead */
int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
int startupPolicy; /* enum virDomainStartupPolicy */
- bool readonly;
- bool shared;
bool transient;
virDomainDeviceInfo info;
bool rawio_specified;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 4b6b5c0..ea2b21b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -827,7 +827,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
/* XXX is this right? */
x_disk->removable = 1;
- x_disk->readwrite = !l_disk->readonly;
+ x_disk->readwrite = !l_disk->src->readonly;
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
/* An empty CDROM must have the empty format, otherwise libxl fails. */
if (x_disk->is_cdrom && !x_disk->pdev_path)
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index 4b3f4d4..78acaa6 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -83,9 +83,9 @@ static int virDomainLockManagerAddDisk(virLockManagerPtr lock,
type == VIR_STORAGE_TYPE_DIR))
return 0;
- if (disk->readonly)
+ if (disk->src->readonly)
diskFlags |= VIR_LOCK_MANAGER_RESOURCE_READONLY;
- if (disk->shared)
+ if (disk->src->shared)
diskFlags |= VIR_LOCK_MANAGER_RESOURCE_SHARED;
VIR_DEBUG("Add disk %s", src);
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 39e30ad..00ff807 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -380,7 +380,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
if (virCgroupAllowDevicePath(cgroup,
virDomainDiskGetSource(def->disks[i]),
- (def->disks[i]->readonly ?
+ (def->disks[i]->src->readonly ?
VIR_CGROUP_DEVICE_READ :
VIR_CGROUP_DEVICE_RW) |
VIR_CGROUP_DEVICE_MKNOD) < 0)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 38acdff..2866869 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -455,7 +455,7 @@ static int virLXCControllerSetupNBDDeviceDisk(virDomainDiskDefPtr
disk)
if (virFileNBDDeviceAssociate(src,
format,
- disk->readonly,
+ disk->src->readonly,
&dev) < 0)
return -1;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3875bf3..257303d 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4068,7 +4068,7 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
goto cleanup;
}
- perms = (def->readonly ?
+ perms = (def->src->readonly ?
VIR_CGROUP_DEVICE_READ :
VIR_CGROUP_DEVICE_RW) |
VIR_CGROUP_DEVICE_MKNOD;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index a31558f..3394c68 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -61,10 +61,10 @@ qemuSetupDiskPathAllow(virDomainDiskDefPtr disk,
VIR_DEBUG("Process path %s for disk", path);
ret = virCgroupAllowDevicePath(priv->cgroup, path,
- (disk->readonly ? VIR_CGROUP_DEVICE_READ
+ (disk->src->readonly ? VIR_CGROUP_DEVICE_READ
: VIR_CGROUP_DEVICE_RW));
virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path,
- disk->readonly ? "r" : "rw", ret ==
0);
+ disk->src->readonly ? "r" : "rw",
ret == 0);
/* Get this for root squash NFS */
if (ret < 0 &&
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 93d303e..58ba214 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3316,7 +3316,7 @@ qemuBuildDriveStr(virConnectPtr conn,
goto error;
}
- if (!disk->readonly) {
+ if (!disk->src->readonly) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot create virtual FAT disks in read-write
mode"));
goto error;
@@ -3384,7 +3384,7 @@ qemuBuildDriveStr(virConnectPtr conn,
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
virBufferAddLit(&opt, ",boot=on");
- if (disk->readonly &&
+ if (disk->src->readonly &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
virBufferAddLit(&opt, ",readonly=on");
if (disk->transient) {
@@ -3443,7 +3443,7 @@ qemuBuildDriveStr(virConnectPtr conn,
}
virBufferAsprintf(&opt, ",cache=%s", mode);
- } else if (disk->shared && !disk->readonly) {
+ } else if (disk->src->shared && !disk->src->readonly) {
virBufferAddLit(&opt, ",cache=off");
}
@@ -8019,7 +8019,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virStorageFileFormatTypeToString(disk->src->format));
goto error;
}
- if (!disk->readonly) {
+ if (!disk->src->readonly) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot create virtual FAT disks in read-write
mode"));
goto error;
@@ -9649,7 +9649,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STREQ(keywords[i], "media")) {
if (STREQ(values[i], "cdrom")) {
def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
- def->readonly = true;
+ def->src->readonly = true;
} else if (STREQ(values[i], "floppy"))
def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
} else if (STREQ(keywords[i], "format")) {
@@ -9705,7 +9705,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
}
} else if (STREQ(keywords[i], "readonly")) {
if ((values[i] == NULL) || STREQ(values[i], "on"))
- def->readonly = true;
+ def->src->readonly = true;
} else if (STREQ(keywords[i], "aio")) {
if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -10873,7 +10873,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
if (VIR_STRDUP(disk->dst, "hdc") < 0)
goto error;
- disk->readonly = true;
+ disk->src->readonly = true;
} else {
if (STRPREFIX(arg, "-fd")) {
disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 8a3bdef..c9ca17c 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -906,7 +906,7 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
disk = dev->data.disk;
- if (!disk->shared || !virDomainDiskSourceIsBlockType(disk))
+ if (!disk->src->shared || !virDomainDiskSourceIsBlockType(disk))
return 0;
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
@@ -1013,7 +1013,7 @@ qemuRemoveSharedDevice(virQEMUDriverPtr driver,
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
disk = dev->data.disk;
- if (!disk->shared || !virDomainDiskSourceIsBlockType(disk))
+ if (!disk->src->shared || !virDomainDiskSourceIsBlockType(disk))
return 0;
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
hostdev = dev->data.hostdev;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ce57542..552e595 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12069,7 +12069,7 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
* permissions it would have as if part of the disk chain is to
* temporarily modify the disk in place. */
virStorageSource origdisk;
- bool origreadonly = disk->readonly;
+ bool origreadonly = disk->src->readonly;
virQEMUDriverConfigPtr cfg = NULL;
int ret = -1;
@@ -12084,7 +12084,7 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
* than a full virDomainDiskDef. */
memcpy(&origdisk, disk->src, sizeof(origdisk));
memcpy(disk->src, elem, sizeof(*elem));
- disk->readonly = mode == VIR_DISK_CHAIN_READ_ONLY;
+ disk->src->readonly = mode == VIR_DISK_CHAIN_READ_ONLY;
if (mode == VIR_DISK_CHAIN_NO_ACCESS) {
if (virSecurityManagerRestoreDiskLabel(driver->securityManager,
@@ -12107,7 +12107,7 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
cleanup:
memcpy(disk->src, &origdisk, sizeof(origdisk));
- disk->readonly = origreadonly;
+ disk->src->readonly = origreadonly;
virObjectUnref(cfg);
return ret;
}
@@ -12759,7 +12759,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
case VIR_DOMAIN_SNAPSHOT_LOCATION_NONE:
/* Remember seeing a disk that has snapshot disabled */
- if (!dom_disk->readonly)
+ if (!dom_disk->src->readonly)
forbid_internal = true;
break;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7684aec..8a20bf8 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1159,7 +1159,8 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk = vm->def->disks[i];
/* skip shared, RO and source-less disks */
- if (disk->shared || disk->readonly || !virDomainDiskGetSource(disk))
+ if (disk->src->shared || disk->src->readonly ||
+ !virDomainDiskGetSource(disk))
continue;
VIR_FREE(diskAlias);
@@ -1265,7 +1266,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
virDomainBlockJobInfo info;
/* skip shared, RO and source-less disks */
- if (disk->shared || disk->readonly || !virDomainDiskGetSource(disk))
+ if (disk->src->shared || disk->src->readonly ||
+ !virDomainDiskGetSource(disk))
continue;
VIR_FREE(diskAlias);
@@ -1351,7 +1353,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk = vm->def->disks[--lastGood];
/* skip shared, RO disks */
- if (disk->shared || disk->readonly || !virDomainDiskGetSource(disk))
+ if (disk->src->shared || disk->src->readonly ||
+ !virDomainDiskGetSource(disk))
continue;
VIR_FREE(diskAlias);
@@ -1414,7 +1417,8 @@ qemuMigrationCancelDriveMirror(qemuMigrationCookiePtr mig,
virDomainDiskDefPtr disk = vm->def->disks[i];
/* skip shared, RO and source-less disks */
- if (disk->shared || disk->readonly || !virDomainDiskGetSource(disk))
+ if (disk->src->shared || disk->src->readonly ||
+ !virDomainDiskGetSource(disk))
continue;
VIR_FREE(diskAlias);
@@ -1528,8 +1532,8 @@ qemuMigrationIsSafe(virDomainDefPtr def)
/* Our code elsewhere guarantees shared disks are either readonly (in
* which case cache mode doesn't matter) or used with cache=none */
if (src &&
- !disk->shared &&
- !disk->readonly &&
+ !disk->src->shared &&
+ !disk->src->readonly &&
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) {
int rc;
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 639f9b0..38cb47f 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -383,7 +383,7 @@ virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
* we can't see running VMs using the file on other nodes
* Safest bet is thus to skip the restore step.
*/
- if (disk->readonly || disk->shared)
+ if (disk->src->readonly || disk->src->shared)
return 0;
if (!src)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 572f8a1..7740e69 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1155,7 +1155,7 @@ virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr
mgr,
* we can't see running VMs using the file on other nodes
* Safest bet is thus to skip the restore step.
*/
- if (disk->readonly || disk->shared)
+ if (disk->src->readonly || disk->src->shared)
return 0;
if (!src || virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
@@ -1213,9 +1213,9 @@ virSecuritySELinuxSetSecurityFileLabel(virDomainDiskDefPtr disk,
ret = virSecuritySELinuxSetFilecon(path, disk_seclabel->label);
} else if (depth == 0) {
- if (disk->shared) {
+ if (disk->src->shared) {
ret = virSecuritySELinuxSetFileconOptional(path, data->file_context);
- } else if (disk->readonly) {
+ } else if (disk->src->readonly) {
ret = virSecuritySELinuxSetFileconOptional(path, data->content_context);
} else if (secdef->imagelabel) {
ret = virSecuritySELinuxSetFileconOptional(path, secdef->imagelabel);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index e54f73f..b5f66f3 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -907,7 +907,7 @@ add_file_path(virDomainDiskDefPtr disk,
int ret;
if (depth == 0) {
- if (disk->readonly)
+ if (disk->src->readonly)
ret = vah_add_file(buf, path, "r");
else
ret = vah_add_file(buf, path, "rw");
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 48c7e02..fe17b0b 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -240,6 +240,12 @@ struct _virStorageSource {
size_t nseclabels;
virSecurityDeviceLabelDefPtr *seclabels;
+ /* Don't ever write to the image */
+ bool readonly;
+
+ /* image is shared across hosts */
+ bool shared;
+
/* backing chain of the storage source */
virStorageSourcePtr backingStore;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 4ba9ad7..91e9482 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2791,7 +2791,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
hardDiskPM->vtbl->GetType(hardDiskPM, &hddType);
if (hddType == HardDiskType_Immutable)
- def->disks[hddNum]->readonly = true;
+ def->disks[hddNum]->src->readonly = true;
ignore_value(virDomainDiskSetSource(def->disks[hddNum],
hddlocation));
ignore_value(VIR_STRDUP(def->disks[hddNum]->dst,
"hda"));
@@ -2813,7 +2813,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
hardDiskPS->vtbl->GetType(hardDiskPS, &hddType);
if (hddType == HardDiskType_Immutable)
- def->disks[hddNum]->readonly = true;
+ def->disks[hddNum]->src->readonly = true;
ignore_value(virDomainDiskSetSource(def->disks[hddNum],
hddlocation));
ignore_value(VIR_STRDUP(def->disks[hddNum]->dst,
"hdb"));
@@ -2835,7 +2835,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
hardDiskSS->vtbl->GetType(hardDiskSS, &hddType);
if (hddType == HardDiskType_Immutable)
- def->disks[hddNum]->readonly = true;
+ def->disks[hddNum]->src->readonly = true;
ignore_value(virDomainDiskSetSource(def->disks[hddNum],
hddlocation));
ignore_value(VIR_STRDUP(def->disks[hddNum]->dst,
"hdd"));
@@ -2977,7 +2977,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
medium->vtbl->GetReadOnly(medium, &readOnly);
if (readOnly == PR_TRUE)
- def->disks[diskCount]->readonly = true;
+ def->disks[diskCount]->src->readonly = true;
virDomainDiskSetType(def->disks[diskCount],
VIR_STORAGE_TYPE_FILE);
@@ -3257,7 +3257,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
def->disks[def->ndisks - 1]->bus =
VIR_DOMAIN_DISK_BUS_IDE;
virDomainDiskSetType(def->disks[def->ndisks - 1],
VIR_STORAGE_TYPE_FILE);
- def->disks[def->ndisks - 1]->readonly = true;
+ def->disks[def->ndisks - 1]->src->readonly =
true;
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
ignore_value(VIR_STRDUP(def->disks[def->ndisks -
1]->dst, "hdc"));
def->ndisks--;
@@ -3304,7 +3304,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
def->disks[def->ndisks - 1]->bus =
VIR_DOMAIN_DISK_BUS_FDC;
virDomainDiskSetType(def->disks[def->ndisks -
1],
VIR_STORAGE_TYPE_FILE);
- def->disks[def->ndisks - 1]->readonly =
false;
+ def->disks[def->ndisks -
1]->src->readonly = false;
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
ignore_value(VIR_STRDUP(def->disks[def->ndisks
- 1]->dst, "fda"));
def->ndisks--;
@@ -3910,9 +3910,9 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine
*machine)
VIR_DEBUG("disk(%zu) driverType: %s", i,
virStorageFileFormatTypeToString(format));
VIR_DEBUG("disk(%zu) cachemode: %d", i,
def->disks[i]->cachemode);
- VIR_DEBUG("disk(%zu) readonly: %s", i,
(def->disks[i]->readonly
+ VIR_DEBUG("disk(%zu) readonly: %s", i,
(def->disks[i]->src->readonly
? "True" : "False"));
- VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared
+ VIR_DEBUG("disk(%zu) shared: %s", i,
(def->disks[i]->src->shared
? "True" : "False"));
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
@@ -4014,11 +4014,11 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data,
IMachine *machine)
"attached as harddisk: %s, rc=%08x"),
src, (unsigned)rc);
} else {
- if (def->disks[i]->readonly) {
+ if (def->disks[i]->src->readonly) {
hardDisk->vtbl->SetType(hardDisk,
HardDiskType_Immutable);
VIR_DEBUG("setting harddisk to readonly");
- } else if (!def->disks[i]->readonly) {
+ } else if (!def->disks[i]->src->readonly) {
hardDisk->vtbl->SetType(hardDisk,
HardDiskType_Normal);
VIR_DEBUG("setting harddisk type to normal");
@@ -4193,9 +4193,9 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine
*machine)
VIR_DEBUG("disk(%zu) driverType: %s", i,
virStorageFileFormatTypeToString(format));
VIR_DEBUG("disk(%zu) cachemode: %d", i,
def->disks[i]->cachemode);
- VIR_DEBUG("disk(%zu) readonly: %s", i,
(def->disks[i]->readonly
+ VIR_DEBUG("disk(%zu) readonly: %s", i,
(def->disks[i]->src->readonly
? "True" : "False"));
- VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared
+ VIR_DEBUG("disk(%zu) shared: %s", i,
(def->disks[i]->src->shared
? "True" : "False"));
if (type == VIR_STORAGE_TYPE_FILE && src) {
@@ -4317,10 +4317,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data,
IMachine *machine)
}
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
- if (def->disks[i]->readonly) {
+ if (def->disks[i]->src->readonly) {
medium->vtbl->SetType(medium, MediumType_Immutable);
VIR_DEBUG("setting harddisk to immutable");
- } else if (!def->disks[i]->readonly) {
+ } else if (!def->disks[i]->src->readonly) {
medium->vtbl->SetType(medium, MediumType_Normal);
VIR_DEBUG("setting harddisk type to normal");
}
@@ -7500,7 +7500,7 @@ int vboxSnapshotGetReadOnlyDisks(virDomainSnapshotPtr snapshot,
goto cleanup;
}
if (readOnly == PR_TRUE)
- def->dom->disks[diskCount]->readonly = true;
+ def->dom->disks[diskCount]->src->readonly = true;
def->dom->disks[diskCount]->src->type = VIR_STORAGE_TYPE_FILE;
def->dom->disks[diskCount]->dst = vboxGenerateMediumName(storageBus,
deviceInst,
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index aacf74c..08a10e7 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -495,10 +495,10 @@ xenParseSxprDisks(virDomainDefPtr def,
if (mode &&
strchr(mode, 'r'))
- disk->readonly = true;
+ disk->src->readonly = true;
if (mode &&
strchr(mode, '!'))
- disk->shared = true;
+ disk->src->shared = true;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
goto error;
@@ -1321,7 +1321,7 @@ xenParseSxpr(const struct sexpr *root,
goto error;
}
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
- disk->readonly = true;
+ disk->src->readonly = true;
if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) {
virDomainDiskDefFree(disk);
@@ -1818,9 +1818,9 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
}
}
- if (def->readonly)
+ if (def->src->readonly)
virBufferAddLit(buf, "(mode 'r')");
- else if (def->shared)
+ else if (def->src->shared)
virBufferAddLit(buf, "(mode 'w!')");
else
virBufferAddLit(buf, "(mode 'w')");
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 2cd6d4c..6349d17 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -625,10 +625,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (STREQ(head, "r") ||
STREQ(head, "ro"))
- disk->readonly = true;
+ disk->src->readonly = true;
else if ((STREQ(head, "w!")) ||
(STREQ(head, "!")))
- disk->shared = true;
+ disk->src->shared = true;
/* Maintain list in sorted order according to target device name */
if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0)
@@ -656,7 +656,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (VIR_STRDUP(disk->dst, "hdc") < 0)
goto cleanup;
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
- disk->readonly = true;
+ disk->src->readonly = true;
if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0)
goto cleanup;
@@ -1249,9 +1249,9 @@ xenFormatXMDisk(virConfValuePtr list,
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
virBufferAddLit(&buf, ":cdrom");
- if (disk->readonly)
+ if (disk->src->readonly)
virBufferAddLit(&buf, ",r");
- else if (disk->shared)
+ else if (disk->src->shared)
virBufferAddLit(&buf, ",!");
else
virBufferAddLit(&buf, ",w");
--
1.9.3