[libvirt] [PATCH 0/4] Display thin lv's from a logical vg
by John Ferlan
While I know not the preferred mechanism for Jan, these patches
provide a means to display thin lv data from a volume group including
the source thin-pool name and thin-pool capacity. Since a thin-pool
and a thin lv are just members of the vg, it just feels natural to
display whatever is in the volume group because a logical pool
comprises all the volumes within the vg.
Even if not accepted, some concepts can be used as a bases for a
single thin-pool to libvirt pool relationship.
There are no changes to virsh vol-list --details or virsh vol-info
to display the thin-pool capacity. If one self adds all the capacity
values in the vol-list --details display, they will determine that the
sum is larger than the virsh pool-info output for the volume group.
Although that's even true prior to these patches since the thin data
is not displayed in the vol-list output, but is accounted for in the
pool-info output, thus the sum of the vol-list capacity details are less.
John Ferlan (4):
vol: Add new elements to _virStorageVolSource for thin lv
logical: Add capability to get the thin pool name
logical: Add thin-pool look-aside list
logical: Display thin lv's found in a libvirt managed volume group
docs/formatstorage.html.in | 9 ++-
docs/schemas/storagevol.rng | 14 ++++
src/conf/storage_conf.c | 11 +++
src/conf/storage_conf.h | 15 ++++
src/storage/storage_backend_logical.c | 100 +++++++++++++++++++-----
tests/storagevolxml2xmlin/vol-logical-thin.xml | 20 +++++
tests/storagevolxml2xmlout/vol-logical-thin.xml | 17 ++++
tests/storagevolxml2xmltest.c | 1 +
8 files changed, 166 insertions(+), 21 deletions(-)
create mode 100644 tests/storagevolxml2xmlin/vol-logical-thin.xml
create mode 100644 tests/storagevolxml2xmlout/vol-logical-thin.xml
--
2.5.0
8 years, 10 months
[libvirt] [PATCH] conf: add caps to virDomainSnapshotDefFormat
by Joao Martins
The virDomainSnapshotDefFormat calls into virDomainDefFormat,
so should be providing a non-NULL virCapsPtr instance. On the
qemu driver we change qemuDomainSnapshotWriteMetadata to also
include caps since it calls virDomainSnapshotDefFormat.
Signed-off-by: Joao Martins <joao.m.martins(a)oracle.com>
---
src/conf/snapshot_conf.c | 3 ++-
src/conf/snapshot_conf.h | 1 +
src/esx/esx_driver.c | 2 +-
src/qemu/qemu_domain.c | 5 +++--
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 16 ++++++++++------
src/test/test_driver.c | 3 ++-
src/vbox/vbox_common.c | 4 ++--
tests/domainsnapshotxml2xmltest.c | 2 +-
9 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index ffa1bf2..1eda7c2 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -659,6 +659,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf,
char *virDomainSnapshotDefFormat(const char *domain_uuid,
virDomainSnapshotDefPtr def,
+ virCapsPtr caps,
unsigned int flags,
int internal)
{
@@ -702,7 +703,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
virBufferAddLit(&buf, "</disks>\n");
}
if (def->dom) {
- if (virDomainDefFormatInternal(def->dom, NULL, flags, &buf) < 0) {
+ if (virDomainDefFormatInternal(def->dom, caps, flags, &buf) < 0) {
virBufferFreeAndReset(&buf);
return NULL;
}
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 4f0d096..fcf7a1e 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -113,6 +113,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def);
char *virDomainSnapshotDefFormat(const char *domain_uuid,
virDomainSnapshotDefPtr def,
+ virCapsPtr caps,
unsigned int flags,
int internal);
int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index ce5f799..00d0e0a 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4292,7 +4292,7 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuid_string);
- xml = virDomainSnapshotDefFormat(uuid_string, &def,
+ xml = virDomainSnapshotDefFormat(uuid_string, &def, priv->caps,
virDomainDefFormatConvertXMLFlags(flags),
0);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a70b866..0b02c68 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2605,6 +2605,7 @@ qemuFindQemuImgBinary(virQEMUDriverPtr driver)
int
qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virDomainSnapshotObjPtr snapshot,
+ virCapsPtr caps,
char *snapshotDir)
{
char *newxml = NULL;
@@ -2615,7 +2616,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virUUIDFormat(vm->def->uuid, uuidstr);
newxml = virDomainSnapshotDefFormat(
- uuidstr, snapshot->def,
+ uuidstr, snapshot->def, caps,
virDomainDefFormatConvertXMLFlags(QEMU_DOMAIN_FORMAT_LIVE_FLAGS),
1);
if (newxml == NULL)
@@ -2775,7 +2776,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
snap->def->parent);
} else {
parentsnap->def->current = true;
- if (qemuDomainSnapshotWriteMetadata(vm, parentsnap,
+ if (qemuDomainSnapshotWriteMetadata(vm, parentsnap, driver->caps,
cfg->snapshotDir) < 0) {
VIR_WARN("failed to set parent snapshot '%s' as current",
snap->def->parent);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6a8cf70..7cabf10 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -375,6 +375,7 @@ const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virDomainSnapshotObjPtr snapshot,
+ virCapsPtr caps,
char *snapshotDir);
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d623831..2e283a9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14908,6 +14908,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if (update_current) {
vm->current_snapshot->def->current = false;
if (qemuDomainSnapshotWriteMetadata(vm, vm->current_snapshot,
+ driver->caps,
cfg->snapshotDir) < 0)
goto endjob;
vm->current_snapshot = NULL;
@@ -14956,7 +14957,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
endjob:
if (snapshot && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
- if (qemuDomainSnapshotWriteMetadata(vm, snap,
+ if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps,
cfg->snapshotDir) < 0) {
/* if writing of metadata fails, error out rather than trying
* to silently carry on without completing the snapshot */
@@ -15275,6 +15276,7 @@ static char *
qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
+ virQEMUDriverPtr driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
@@ -15293,7 +15295,7 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuidstr);
- xml = virDomainSnapshotDefFormat(uuidstr, snap->def,
+ xml = virDomainSnapshotDefFormat(uuidstr, snap->def, driver->caps,
virDomainDefFormatConvertXMLFlags(flags),
0);
@@ -15474,7 +15476,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (vm->current_snapshot) {
vm->current_snapshot->def->current = false;
if (qemuDomainSnapshotWriteMetadata(vm, vm->current_snapshot,
- cfg->snapshotDir) < 0)
+ driver->caps, cfg->snapshotDir) < 0)
goto endjob;
vm->current_snapshot = NULL;
/* XXX Should we restore vm->current_snapshot after this point
@@ -15709,7 +15711,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
cleanup:
if (ret == 0) {
- if (qemuDomainSnapshotWriteMetadata(vm, snap,
+ if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps,
cfg->snapshotDir) < 0)
ret = -1;
else
@@ -15736,6 +15738,7 @@ struct _virQEMUSnapReparent {
virQEMUDriverConfigPtr cfg;
virDomainSnapshotObjPtr parent;
virDomainObjPtr vm;
+ virCapsPtr caps;
int err;
virDomainSnapshotObjPtr last;
};
@@ -15764,7 +15767,7 @@ qemuDomainSnapshotReparentChildren(void *payload,
if (!snap->sibling)
rep->last = snap;
- rep->err = qemuDomainSnapshotWriteMetadata(rep->vm, snap,
+ rep->err = qemuDomainSnapshotWriteMetadata(rep->vm, snap, rep->caps,
rep->cfg->snapshotDir);
}
@@ -15833,7 +15836,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
if (rem.current) {
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) {
snap->def->current = true;
- if (qemuDomainSnapshotWriteMetadata(vm, snap,
+ if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps,
cfg->snapshotDir) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to set snapshot '%s' as current"),
@@ -15850,6 +15853,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
rep.vm = vm;
rep.err = 0;
rep.last = NULL;
+ rep.caps = driver->caps;
virDomainSnapshotForEachChild(snap,
qemuDomainSnapshotReparentChildren,
&rep);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 89973f6..fde5e2d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -6087,6 +6087,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
+ testDriverPtr privconn = snapshot->domain->conn->privateData;
virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
@@ -6098,7 +6099,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(snapshot->domain->uuid, uuidstr);
- xml = virDomainSnapshotDefFormat(uuidstr, snap->def,
+ xml = virDomainSnapshotDefFormat(uuidstr, snap->def, privconn->caps,
virDomainDefFormatConvertXMLFlags(flags),
0);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index cf38d2a..d1eb09a 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -5221,7 +5221,7 @@ vboxSnapshotRedefine(virDomainPtr dom,
VIR_FREE(currentSnapshotXmlFilePath);
if (virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml", machineLocationPath, snapshotMachineDesc->currentSnapshot) < 0)
goto cleanup;
- char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, VIR_DOMAIN_DEF_FORMAT_SECURE, 0);
+ char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, data->caps, VIR_DOMAIN_DEF_FORMAT_SECURE, 0);
if (snapshotContent == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to get snapshot content"));
@@ -6146,7 +6146,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virUUIDFormat(dom->uuid, uuidstr);
memcpy(def->dom->uuid, dom->uuid, VIR_UUID_BUFLEN);
- ret = virDomainSnapshotDefFormat(uuidstr, def,
+ ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps,
virDomainDefFormatConvertXMLFlags(flags),
0);
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index cf91447..714d64f 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -100,7 +100,7 @@ testCompareXMLToXMLFiles(const char *inxml,
flags)))
goto cleanup;
- if (!(actual = virDomainSnapshotDefFormat(uuid, def,
+ if (!(actual = virDomainSnapshotDefFormat(uuid, def, driver.caps,
VIR_DOMAIN_DEF_FORMAT_SECURE,
internal)))
goto cleanup;
--
2.1.4
8 years, 10 months
[libvirt] [PATCH v3 0/8 RESEND] add close callback for drivers with persistent connection
by Nikolay Shirokovskiy
Rebase on master.
Currently close callback API can only inform us of closing the connection
between remote driver and daemon. But what if a driver running in the
daemon itself can have another persistent connection? In this case
we want to be informed of that connection changes state too.
This patch series extends meaning of current close callback API so
that now it notifies of closing of any internal persistent connection.
The overall approach is to move close callback support to drivers.
Changes from v2:
Split patches further to make it more comprehensible.
Nikolay Shirokovskiy (8):
factor out virConnectCloseCallbackDataPtr methods
virConnectCloseCallbackData: fix connection object refcount
virConnectCloseCallbackData: factor out callback disarming
close callback API: remove unnecessary locks
virConnectCloseCallbackDataDispose: remove unnecessary locks
close callback: move it to driver
daemon: add connection close rpc
vz: implement connection close notification
daemon/libvirtd.h | 1 +
daemon/remote.c | 84 ++++++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
src/datatypes.c | 113 +++++++++++++++++++++++++++++++++----------
src/datatypes.h | 11 +++++
src/driver-hypervisor.h | 12 +++++
src/libvirt-host.c | 46 ++----------------
src/remote/remote_driver.c | 106 ++++++++++++++++++++++++++++++++--------
src/remote/remote_protocol.x | 24 ++++++++-
src/remote_protocol-structs | 6 +++
src/vz/vz_driver.c | 39 +++++++++++++++
src/vz/vz_sdk.c | 4 ++
src/vz/vz_utils.h | 3 ++
13 files changed, 363 insertions(+), 87 deletions(-)
--
1.8.3.1
8 years, 10 months
[libvirt] [PATCH] bhyve: fix build
by Roman Bogorodskiy
Fix build fail introduced as a side effect of commit d239a54.
Pushed under the build breaker rule.
---
src/bhyve/bhyve_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 337a29e..f486f86 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -488,7 +488,7 @@ bhyveDomainGetOSType(virDomainPtr dom)
static char *
bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
{
- bhyveConnPtr privconn = conn->privateData;
+ bhyveConnPtr privconn = domain->conn->privateData;
virDomainObjPtr vm;
virCapsPtr caps = NULL;
char *ret = NULL;
--
2.4.6
8 years, 10 months
[libvirt] [PATCH] libxl: support <hap> feature
by Jim Fehlig
Even though the libxl driver advertises <hap> in capabilities,
it is ignored when set in domXML. Enable hap in the
libxl_domain_create_info struct when <hap> is specified in domXML.
The xm/xl <-> domXML parser/formatter already supports hap but
lacked a test with hap enabled. Add a hap test.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 8 ++++--
tests/xlconfigdata/test-fullvirt-hap.cfg | 27 ++++++++++++++++++++
tests/xlconfigdata/test-fullvirt-hap.xml | 42 ++++++++++++++++++++++++++++++++
tests/xlconfigtest.c | 1 +
4 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 6320421..a531fdb 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -507,10 +507,14 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
libxl_domain_create_info_init(c_info);
- if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
+ if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
c_info->type = LIBXL_DOMAIN_TYPE_HVM;
- else
+ libxl_defbool_set(&c_info->hap,
+ def->features[VIR_DOMAIN_FEATURE_HAP] ==
+ VIR_TRISTATE_SWITCH_ON);
+ } else {
c_info->type = LIBXL_DOMAIN_TYPE_PV;
+ }
if (VIR_STRDUP(c_info->name, def->name) < 0)
goto error;
diff --git a/tests/xlconfigdata/test-fullvirt-hap.cfg b/tests/xlconfigdata/test-fullvirt-hap.cfg
new file mode 100644
index 0000000..aa1d79f
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-hap.cfg
@@ -0,0 +1,27 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+hap = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vncpasswd = "123poi"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+boot = "d"
+disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy" ]
diff --git a/tests/xlconfigdata/test-fullvirt-hap.xml b/tests/xlconfigdata/test-fullvirt-hap.xml
new file mode 100644
index 0000000..f50b672
--- /dev/null
+++ b/tests/xlconfigdata/test-fullvirt-hap.xml
@@ -0,0 +1,42 @@
+<domain type='xen'>
+ <name>XenGuest2</name>
+ <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>592896</memory>
+ <currentMemory unit='KiB'>403456</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenfv'>hvm</type>
+ <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ <hap/>
+ </features>
+ <clock offset='variable' adjustment='0' basis='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy' type='raw'/>
+ <source dev='/dev/HostVG/XenGuest2'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:66:92:9c'/>
+ <source bridge='xenbr1'/>
+ <script path='vif-bridge'/>
+ <model type='e1000'/>
+ </interface>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'>
+ <listen type='address' address='127.0.0.1'/>
+ </graphics>
+ </devices>
+</domain>
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index bad69ca..3962e70 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -209,6 +209,7 @@ mymain(void)
DO_TEST("vif-rate");
DO_TEST("paravirt-cmdline");
+ DO_TEST("fullvirt-hap");
DO_TEST_FORMAT("paravirt-cmdline-extra-root");
DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root");
--
2.1.4
8 years, 10 months
[libvirt] [PATCH v3 0/3] libxl: p2p migration support
by Joao Martins
Hey,
This series adds support for p2p migration: Patch 2 and 3
are new in this series and it's purpose is to take the
LIBXL_JOB_MODIFY as mentioned in the last review.
Changelog in individual patches.
Thanks,
Joao
Joao Martins (3):
libxl: add p2p migration
libxl: move begin phase job handling
libxl: begin job on perform phase
src/libxl/libxl_driver.c | 36 +++++++-
src/libxl/libxl_migration.c | 219 +++++++++++++++++++++++++++++++++++++++++---
src/libxl/libxl_migration.h | 11 +++
3 files changed, 250 insertions(+), 16 deletions(-)
--
2.1.4
8 years, 10 months
[libvirt] [PATCH] conf: add caps to virDomainObjFormat/SaveStatus
by Daniel P. Berrange
The virDomainObjFormat and virDomainSaveStatus methods
both call into virDomainDefFormat, so should be providing
a non-NULL virCapsPtr instance.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/bhyve/bhyve_process.c | 15 +++++++++++--
src/conf/domain_conf.c | 10 +++++----
src/conf/domain_conf.h | 4 +++-
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 14 ++++++------
src/libxl/libxl_migration.c | 4 ++--
src/lxc/lxc_driver.c | 12 +++++------
src/lxc/lxc_process.c | 4 ++--
src/qemu/qemu_blockjob.c | 2 +-
src/qemu/qemu_domain.c | 4 ++--
src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++-----------------------
src/qemu/qemu_migration.c | 6 +++---
src/qemu/qemu_process.c | 36 +++++++++++++++----------------
13 files changed, 90 insertions(+), 75 deletions(-)
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 42255d2..9763d71 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -115,11 +115,15 @@ virBhyveProcessStart(virConnectPtr conn,
bhyveConnPtr privconn = conn->privateData;
bhyveDomainObjPrivatePtr priv = vm->privateData;
int ret = -1, rc;
+ virCapsPtr caps = NULL;
if (virAsprintf(&logfile, "%s/%s.log",
BHYVE_LOG_DIR, vm->def->name) < 0)
return -1;
+ caps = bhyveDriverGetCapabilities(privconn);
+ if (!caps)
+ goto cleanup;
if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
S_IRUSR | S_IWUSR)) < 0) {
@@ -215,12 +219,13 @@ virBhyveProcessStart(virConnectPtr conn,
if (virDomainSaveStatus(driver->xmlopt,
BHYVE_STATE_DIR,
- vm) < 0)
+ vm, caps) < 0)
goto cleanup;
ret = 0;
cleanup:
+ virObjectUnref(caps);
if (devicemap != NULL) {
rc = unlink(devmap_file);
if (rc < 0 && errno != ENOENT)
@@ -362,6 +367,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
char *expected_proctitle = NULL;
bhyveDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
+ virCapsPtr caps = NULL;
if (!virDomainObjIsActive(vm))
return 0;
@@ -369,6 +375,10 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
if (!vm->pid)
return 0;
+ caps = bhyveDriverGetCapabilities(privconn);
+ if (!caps)
+ return -1;
+
virObjectLock(vm);
kp = kvm_getprocs(data->kd, KERN_PROC_PID, vm->pid, &nprocs);
@@ -397,9 +407,10 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
VIR_DOMAIN_SHUTOFF_UNKNOWN);
ignore_value(virDomainSaveStatus(data->driver->xmlopt,
BHYVE_STATE_DIR,
- vm));
+ vm, caps));
}
+ virObjectUnref(caps);
virObjectUnlock(vm);
VIR_FREE(expected_proctitle);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 035e5e1..187495c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -22516,6 +22516,7 @@ virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags)
char *
virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
virDomainObjPtr obj,
+ virCapsPtr caps,
unsigned int flags)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -22540,7 +22541,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
xmlopt->privateData.format(&buf, obj) < 0)
goto error;
- if (virDomainDefFormatInternal(obj->def, NULL, flags, &buf) < 0)
+ if (virDomainDefFormatInternal(obj->def, caps, flags, &buf) < 0)
goto error;
virBufferAdjustIndent(&buf, -2);
@@ -22746,7 +22747,8 @@ virDomainSaveConfig(const char *configDir,
int
virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
const char *statusDir,
- virDomainObjPtr obj)
+ virDomainObjPtr obj,
+ virCapsPtr caps)
{
unsigned int flags = (VIR_DOMAIN_DEF_FORMAT_SECURE |
VIR_DOMAIN_DEF_FORMAT_STATUS |
@@ -22757,7 +22759,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
int ret = -1;
char *xml;
- if (!(xml = virDomainObjFormat(xmlopt, obj, flags)))
+ if (!(xml = virDomainObjFormat(xmlopt, obj, caps, flags)))
goto cleanup;
if (virDomainSaveXML(statusDir, obj->def, xml))
@@ -23906,7 +23908,7 @@ virDomainObjSetMetadata(virDomainObjPtr vm,
if (virDomainDefSetMetadata(vm->def, type, metadata, key, uri) < 0)
return -1;
- if (virDomainSaveStatus(xmlopt, stateDir, vm) < 0)
+ if (virDomainSaveStatus(xmlopt, stateDir, vm, caps) < 0)
return -1;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8843cbd..79060bc 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2738,6 +2738,7 @@ char *virDomainDefFormat(virDomainDefPtr def,
unsigned int flags);
char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
virDomainObjPtr obj,
+ virCapsPtr caps,
unsigned int flags);
int virDomainDefFormatInternal(virDomainDefPtr def,
virCapsPtr caps,
@@ -2912,7 +2913,8 @@ int virDomainSaveConfig(const char *configDir,
virDomainDefPtr def);
int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
const char *statusDir,
- virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
+ virDomainObjPtr obj,
+ virCapsPtr caps) ATTRIBUTE_RETURN_CHECK;
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
int newDomain,
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index cf27ec4..1133c8b 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1086,7 +1086,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto cleanup_dom;
if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d2114ca..2a6c2de 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1139,7 +1139,7 @@ libxlDomainSuspend(virDomainPtr dom)
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto endjob;
ret = 0;
@@ -1198,7 +1198,7 @@ libxlDomainResume(virDomainPtr dom)
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto endjob;
ret = 0;
@@ -2231,7 +2231,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
ret = 0;
if (flags & VIR_DOMAIN_VCPU_LIVE) {
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after changing vcpus",
vm->def->name);
}
@@ -2392,7 +2392,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
ret = 0;
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm);
+ ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps);
} else if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(cfg->configDir, cfg->caps, targetDef);
}
@@ -3742,7 +3742,7 @@ libxlDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
* update domain status forcibly because the domain status may be
* changed even if we attach the device failed.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto endjob;
}
@@ -3850,7 +3850,7 @@ libxlDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
* update domain status forcibly because the domain status may be
* changed even if we attach the device failed.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto endjob;
}
@@ -3957,7 +3957,7 @@ libxlDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
* update domain status forcibly because the domain status may be
* changed even if we attach the device failed.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
ret = -1;
}
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 93eaa87..641bd4e 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -564,7 +564,7 @@ libxlDomainMigrationFinish(virConnectPtr dconn,
event = NULL;
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto cleanup;
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
@@ -607,7 +607,7 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
VIR_DOMAIN_PAUSED_MIGRATION);
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
- ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm));
+ ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps));
}
goto cleanup;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 58c9bb4..b3399d9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -765,7 +765,7 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
}
vm->def->mem.cur_balloon = newmem;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
}
@@ -2022,7 +2022,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
@@ -3402,7 +3402,7 @@ static int lxcDomainSuspend(virDomainPtr dom)
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
ret = 0;
@@ -3452,7 +3452,7 @@ static int lxcDomainResume(virDomainPtr dom)
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
ret = 0;
@@ -5075,7 +5075,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
ret = -1;
goto cleanup;
}
@@ -5317,7 +5317,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom,
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
ret = -1;
goto cleanup;
}
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 3ee3b13..2ece14b 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -767,7 +767,7 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
}
virDomainAuditInit(vm, initpid, inode);
- if (virDomainSaveStatus(lxc_driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(lxc_driver->xmlopt, cfg->stateDir, vm, lxc_driver->caps) < 0)
VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name);
virObjectUnlock(vm);
@@ -1469,7 +1469,7 @@ int virLXCProcessStart(virConnectPtr conn,
/* Write domain status to disk for the controller to
* read when it starts */
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
/* Allow the child to exec the controller */
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index f14e70b..83a5a3f 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -185,7 +185,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
}
if (save) {
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Unable to save status on vm %s after block job",
vm->def->name);
if (persistDisk && virDomainSaveConfig(cfg->configDir,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a70b866..9d08f4f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1489,7 +1489,7 @@ qemuDomainObjSaveJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
if (virDomainObjIsActive(obj)) {
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", obj->def->name);
}
@@ -2905,7 +2905,7 @@ qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
priv->fakeReboot = value;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
cleanup:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d623831..9f38ce2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1932,7 +1932,7 @@ static int qemuDomainSuspend(virDomainPtr dom)
eventDetail);
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
ret = 0;
@@ -1995,7 +1995,7 @@ static int qemuDomainResume(virDomainPtr dom)
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
ret = 0;
@@ -2549,7 +2549,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
}
def->memballoon->period = period;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
@@ -4143,7 +4143,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
}
cleanup:
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
@@ -4177,7 +4177,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver,
if (qemuDomainRemoveDevice(driver, vm, &dev) < 0)
goto endjob;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("unable to save domain status after removing device %s",
devAlias);
@@ -4545,7 +4545,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
dev.data.chr->state = newstate;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("unable to save status of domain %s after updating state of "
"channel %s", vm->def->name, devAlias);
@@ -5084,7 +5084,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
@@ -5263,7 +5263,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
def->cputune.nvcpupin = newVcpuPinNum;
newVcpuPin = NULL;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
if (snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH,
@@ -5480,7 +5480,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
goto endjob;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
str = virBitmapFormat(pcpumap);
@@ -5967,7 +5967,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
if (snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH,
@@ -6277,7 +6277,7 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
goto endjob;
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
@@ -6835,7 +6835,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
"%s", _("failed to resume domain"));
goto cleanup;
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Failed to save status on vm %s", vm->def->name);
goto cleanup;
}
@@ -8610,7 +8610,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
ret = -1;
goto endjob;
}
@@ -8736,7 +8736,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
ret = -1;
goto endjob;
}
@@ -8856,7 +8856,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
* changed even if we failed to attach the device. For example,
* a new controller may be created.
*/
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
ret = -1;
goto endjob;
}
@@ -9387,7 +9387,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
if (ret < 0)
@@ -9975,7 +9975,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
#undef QEMU_SET_MEM_PARAMETER
if (flags & VIR_DOMAIN_AFFECT_LIVE &&
- virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
@@ -10244,7 +10244,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
-1, mode, nodeset) < 0)
goto endjob;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
@@ -10607,7 +10607,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
}
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
if (eventNparams) {
@@ -11389,7 +11389,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
goto endjob;
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto endjob;
}
@@ -14521,7 +14521,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
}
if (ret == 0 || !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0 ||
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
(persist && virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef) < 0))
ret = -1;
@@ -16527,7 +16527,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
* effort to save it now. But we can ignore failure, since there
* will be further changes when the event marks completion. */
if (save)
- ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm));
+ ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps));
/* With synchronous block cancel, we must synthesize an event, and
* we silently ignore the ABORT_ASYNC flag. With asynchronous
@@ -16649,7 +16649,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
- ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm));
+ ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps));
virObjectUnref(cfg);
}
endjob:
@@ -16902,7 +16902,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob = true;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
@@ -17301,7 +17301,7 @@ qemuDomainBlockCommit(virDomainPtr dom,
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
mirror = NULL;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Unable to save status on vm %s after block job",
vm->def->name);
virObjectUnref(cfg);
@@ -17789,7 +17789,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
goto endjob;
vm->def->disks[idx]->blkdeviotune = info;
- ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm);
+ ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps);
if (ret < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Saving live XML config failed"));
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2f5b368..b98757d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2128,7 +2128,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
}
diskPriv->migrating = true;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Failed to save status on vm %s", vm->def->name);
goto cleanup;
}
@@ -4012,7 +4012,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
}
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
}
@@ -5954,7 +5954,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
}
if (virDomainObjIsActive(vm) &&
- virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
/* Guest is successfully running, so cancel previous auto destroy */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 58f8f4f..8ed6c3a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -504,7 +504,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (priv->agent)
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
virObjectUnlock(vm);
@@ -571,7 +571,7 @@ qemuProcessFakeReboot(void *opaque)
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
@@ -675,7 +675,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_SHUTDOWN,
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
@@ -728,7 +728,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_WARN("Unable to release lease on %s", vm->def->name);
VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
@@ -781,7 +781,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
VIR_FREE(priv->lockState);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after state change",
vm->def->name);
}
@@ -825,7 +825,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
offset += vm->def->clock.data.variable.adjustment0;
vm->def->clock.data.variable.adjustment = offset;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("unable to save domain status with RTC change");
}
@@ -868,7 +868,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_WARN("Unable to release lease on %s", vm->def->name);
VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after watchdog event",
vm->def->name);
}
@@ -951,7 +951,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_WARN("Unable to release lease on %s", vm->def->name);
VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
}
virObjectUnlock(vm);
@@ -1133,7 +1133,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
else if (reason == VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE)
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after tray moved event",
vm->def->name);
}
@@ -1173,7 +1173,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_WAKEUP);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after wakeup event",
vm->def->name);
}
@@ -1211,7 +1211,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_PMSUSPENDED,
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after suspend event",
vm->def->name);
}
@@ -1245,7 +1245,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
vm->def->mem.cur_balloon, actual);
vm->def->mem.cur_balloon = actual;
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("unable to save domain status with balloon change");
virObjectUnlock(vm);
@@ -1280,7 +1280,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_PMSUSPENDED,
VIR_DOMAIN_EVENT_PMSUSPENDED_DISK);
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) {
VIR_WARN("Unable to save status on vm %s after suspend event",
vm->def->name);
}
@@ -2901,7 +2901,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
return -1;
cfg = virQEMUDriverGetConfig(driver);
- ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm);
+ ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps);
virObjectUnref(cfg);
return ret;
@@ -3605,7 +3605,7 @@ qemuProcessReconnect(void *opaque)
goto error;
/* update domain state XML with possibly updated state in virDomainObj */
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0)
goto error;
/* Run an hook to allow admins to do some magic */
@@ -4854,7 +4854,7 @@ qemuProcessLaunch(virConnectPtr conn,
}
VIR_DEBUG("Writing early domain status to disk");
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
VIR_DEBUG("Waiting for handshake from child");
@@ -5066,7 +5066,7 @@ qemuProcessFinishStartup(virConnectPtr conn,
}
VIR_DEBUG("Writing domain status to disk");
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto cleanup;
if (qemuProcessStartHook(driver, vm,
@@ -5699,7 +5699,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
}
VIR_DEBUG("Writing domain status to disk");
- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
goto error;
/* Run an hook to allow admins to do some magic */
--
2.5.0
8 years, 10 months
[libvirt] [PATCH] Fix build after recent patches
by Peter Krempa
Few build breaking mistakes in less-popular parts of our code.
---
Pushed under the build-breaker rule.
src/security/security_apparmor.c | 2 +-
src/xenapi/xenapi_driver.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 2cf333d..af2b639 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -181,7 +181,7 @@ load_profile(virSecurityManagerPtr mgr,
const char *probe = virSecurityManagerGetAllowDiskFormatProbing(mgr)
? "1" : "0";
- xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE);
+ xml = virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE);
if (!xml)
goto cleanup;
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index c4f33b9..f75f138 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1402,7 +1402,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
xen_vm vm = NULL;
xen_vm_set *vms;
xen_string_string_map *result = NULL;
- struct _xenapiPrivate *priv = conn->privateData;
+ struct _xenapiPrivate *priv = dom->conn->privateData;
xen_session *session = priv->session;
virDomainDefPtr defPtr = NULL;
char *boot_policy = NULL;
--
2.6.2
8 years, 10 months
[libvirt] [PATCH RFC v2 0/5] conf: add net device prefix capability
by Joao Martins
Hey,
Back in the pre 1.3.0 release [0] we had a regression when migrating
domains in libxl (introduced by the reverted commit d2e5538b1).
The chosen solution to address this problem was to introduce a
capability to be used by the virDomainNetDefFormat() and
virDomainNetDefParseXML() routines. RFCv1 implemented this by "caching"
netprefix in the domain definition[1]; as suggested in the review[1] v2
implements it by adding the virCapsPtr to the relevant APIs and also
propagating the API change to all drivers. It is divided as follows:
Patch 1: Adds prefix to capabilites
Patch 2: Add prefix to NetDefParseXML
Patch 3,4: API changes to include virCapsPtr and netprefix (New)
Patch 5: set prefix on libxl (Acked)
Having this series and the reverted commit applied, I can
successfully migrate a domain without seeing the same interface
name on both source and destination node with libxl.
Note: I haven't been able to compile-test all drivers, specifically bhyve,
vz and hyperv. Testing was made with libxl.
Thanks!
Joao
[0] https://www.redhat.com/archives/libvir-list/2015-December/msg00279.html
[1] https://www.redhat.com/archives/libvir-list/2016-January/msg00886.html
Joao Martins (5):
conf: add net device prefix to capabilities
conf: add prefix in virDomainNetDefParseXML
conf: add caps to virDomainDefFormat*
conf: add caps to virDomainSaveConfig
libxl: set net device prefix
src/bhyve/bhyve_driver.c | 11 +++++++++--
src/conf/capabilities.c | 22 +++++++++++++++++++++
src/conf/capabilities.h | 4 ++++
src/conf/domain_conf.c | 42 +++++++++++++++++++++++++++-------------
src/conf/domain_conf.h | 4 ++++
src/conf/snapshot_conf.c | 2 +-
src/esx/esx_driver.c | 5 +++--
src/libvirt_private.syms | 1 +
src/libxl/libxl_conf.c | 3 +++
src/libxl/libxl_conf.h | 4 ++++
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 24 +++++++++++++----------
src/libxl/libxl_migration.c | 2 +-
src/lxc/lxc_driver.c | 24 +++++++++++++----------
src/lxc/lxc_process.c | 12 ++++++------
src/network/bridge_driver.c | 4 ++--
src/openvz/openvz_driver.c | 5 +++--
src/phyp/phyp_driver.c | 2 +-
src/qemu/qemu_blockjob.c | 1 +
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 47 +++++++++++++++++++++++++--------------------
src/qemu/qemu_migration.c | 3 ++-
src/qemu/qemu_process.c | 5 +++--
src/test/test_driver.c | 6 ++++--
src/uml/uml_driver.c | 4 ++--
src/vbox/vbox_common.c | 3 ++-
src/vmware/vmware_driver.c | 5 +++--
src/vz/vz_driver.c | 3 ++-
src/xen/xen_driver.c | 4 ++--
src/xenapi/xenapi_driver.c | 5 +++--
tests/lxcconf2xmltest.c | 2 +-
tests/openvzutilstest.c | 2 +-
tests/qemuargv2xmltest.c | 2 +-
tests/qemuhotplugtest.c | 3 ++-
tests/sexpr2xmltest.c | 2 +-
tests/testutils.c | 2 +-
tests/vmx2xmltest.c | 3 ++-
tests/xlconfigtest.c | 2 +-
tests/xmconfigtest.c | 2 +-
39 files changed, 184 insertions(+), 97 deletions(-)
--
2.1.4
8 years, 10 months
[libvirt] [PATCH v3 0/4] Some logical pool/volume changes
by John Ferlan
v2: http://www.redhat.com/archives/libvir-list/2016-January/msg01249.html
Adjustments here
Patches 1-3 are based off of review comments from patch2 of v2. The changes
for patch2 of v2 are dropped.
Patch 4 is a combination of patches 3 and 6 (mostly).... A couple of minor
adjustments to utilize "attrs[0] == 'V'" and checking whether the 'devices'
field to be parsed is neither NULL nor an empty string.
Patches 4&5 from v2 are dropped. The resulting output will then be:
<volume type='block'>
<name>lv_test_thin</name>
...
<source>
</source>
...
John Ferlan (4):
logical: Use VIR_APPEND_ELEMENT instead of VIR_REALLOC_N
logical: Use 'stripes' value for mirror/raid segtype
logical: Clean up allocation when building regex on the fly
logical: Display thin lv's found in a libvirt managed volume group
src/conf/storage_conf.h | 2 +-
src/storage/storage_backend_logical.c | 60 ++++++++++++++++++++++-------------
2 files changed, 39 insertions(+), 23 deletions(-)
--
2.5.0
8 years, 10 months