On 06/06/14 00:52, Eric Blake wrote:
The current implementation of 'virsh blockcopy'
(virDomainBlockRebase)
is limited to copying to a local file name. But future patches want
to extend it to also copy to network disks. This patch converts over
to a virStorageSourcePtr, although it should have no semantic change
visible to the user, in anticipation of those future patches being
able to use more fields for non-file destinations.
* src/conf/domain_conf.h (_virDomainDiskDef): Change type of
mirror information.
* src/conf/domain_conf.c (virDomainDiskDefParseXML): Localize
mirror parsing into new object.
(virDomainDiskDefFormat): Adjust clients.
* src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse):
Likewise.
* src/qemu/qemu_driver.c (qemuDomainBlockPivot)
(qemuDomainBlockJobImpl, qemuDomainBlockCopy): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 50 ++++++++++++++++++++---------------------
src/conf/domain_conf.h | 3 +--
src/qemu/qemu_domain.c | 8 +++----
src/qemu/qemu_driver.c | 60 +++++++++++++++++++++++++++++++------------------
src/qemu/qemu_process.c | 15 ++++++++-----
5 files changed, 77 insertions(+), 59 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3585537..11d5c68 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -606,8 +606,7 @@ struct _virDomainDiskDef {
int tray_status; /* enum virDomainDiskTray */
int removable; /* enum virDomainFeatureState */
- char *mirror;
- int mirrorFormat; /* virStorageFileFormat */
+ virStorageSourcePtr mirror;
You adjust the type here, but don't adjust the code in
virDomainDiskDefFree ...
bool mirroring;
struct {
You need to change:
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b8e7c50..827c401 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1203,7 +1203,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
virStorageSourceFree(def->src);
VIR_FREE(def->serial);
VIR_FREE(def->dst);
- VIR_FREE(def->mirror);
+ virStorageSourceFree(def->mirror);
VIR_FREE(def->wwn);
VIR_FREE(def->vendor);
VIR_FREE(def->product);
ACK with that addressed,
Peter