[libvirt] [PATCH 0/2] cfg.mk: Prohibit backspace alignment attempts
by Andrea Bolognani
Andrea Bolognani (2):
Remove backslash alignment attempts
cfg.mk: Prohibit backspace alignment attempts
Makefile.am | 10 +-
cfg.mk | 830 ++++++++--------
config-post.h | 2 +-
daemon/Makefile.am | 172 ++--
daemon/remote.c | 46 +-
docs/Makefile.am | 56 +-
examples/Makefile.am | 2 +-
examples/domsuspend/suspend.c | 26 +-
examples/domtop/domtop.c | 26 +-
examples/object-events/event-test.c | 8 +-
src/Makefile.am | 1510 ++++++++++++++---------------
src/access/viraccessdriverpolkit.c | 4 +-
src/access/viraccessmanager.c | 4 +-
src/conf/cpu_conf.c | 4 +-
src/conf/domain_capabilities.c | 32 +-
src/conf/domain_capabilities.h | 12 +-
src/conf/domain_conf.c | 62 +-
src/conf/interface_conf.h | 2 +-
src/conf/network_conf.h | 10 +-
src/conf/secret_conf.h | 6 +-
src/conf/snapshot_conf.h | 10 +-
src/conf/storage_conf.h | 12 +-
src/conf/virdomainobjlist.h | 14 +-
src/cpu/cpu_x86.c | 48 +-
src/datatypes.c | 12 +-
src/datatypes.h | 590 +++++------
src/driver.h | 4 +-
src/esx/esx_driver.c | 8 +-
src/esx/esx_vi.c | 258 ++---
src/esx/esx_vi.h | 42 +-
src/esx/esx_vi_methods.c | 196 ++--
src/esx/esx_vi_types.c | 1094 ++++++++++-----------
src/internal.h | 260 ++---
src/libxl/libxl_domain.h | 4 +-
src/libxl/libxl_driver.c | 40 +-
src/libxl/libxl_migration.h | 14 +-
src/locking/lock_driver.h | 6 +-
src/locking/lock_manager.c | 20 +-
src/lxc/lxc_driver.c | 30 +-
src/node_device/node_device_udev.c | 20 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 60 +-
src/openvz/openvz_driver.h | 4 +-
src/phyp/phyp_driver.c | 8 +-
src/qemu/qemu_command.c | 8 +-
src/qemu/qemu_conf.c | 84 +-
src/qemu/qemu_domain.c | 20 +-
src/qemu/qemu_domain.h | 20 +-
src/qemu/qemu_driver.c | 226 ++---
src/qemu/qemu_migration.c | 40 +-
src/qemu/qemu_migration.h | 66 +-
src/qemu/qemu_monitor.c | 44 +-
src/qemu/qemu_monitor_json.c | 102 +-
src/qemu/qemu_monitor_text.c | 18 +-
src/qemu/qemu_parse_command.c | 12 +-
src/remote/remote_driver.c | 56 +-
src/rpc/virnetclient.c | 8 +-
src/security/security_manager.h | 2 +-
src/storage/storage_backend.c | 4 +-
src/util/viralloc.h | 32 +-
src/util/viratomic.h | 114 +--
src/util/viraudit.h | 8 +-
src/util/vircommand.c | 4 +-
src/util/virconf.c | 8 +-
src/util/virdbus.c | 70 +-
src/util/virdnsmasq.h | 10 +-
src/util/virendian.h | 56 +-
src/util/virerror.h | 180 ++--
src/util/virfile.h | 12 +-
src/util/virfirewall.c | 38 +-
src/util/virhash.c | 8 +-
src/util/virlog.c | 10 +-
src/util/virlog.h | 30 +-
src/util/virnetdev.c | 4 +-
src/util/virnetdevopenvswitch.c | 40 +-
src/util/virobject.c | 26 +-
src/util/virpci.c | 6 +-
src/util/virprobe.h | 60 +-
src/util/virsocketaddr.h | 6 +-
src/util/virstring.h | 2 +-
src/util/virsysinfo.c | 14 +-
src/util/virsystemd.c | 20 +-
src/util/virthread.h | 48 +-
src/util/virtypedparam.c | 18 +-
src/util/virtypedparam.h | 26 +-
src/util/virutil.h | 30 +-
src/util/viruuid.h | 18 +-
src/util/virxml.c | 4 +-
src/util/virxml.h | 12 +-
src/vbox/vbox_CAPI_v4_0.h | 6 +-
src/vbox/vbox_CAPI_v4_1.h | 6 +-
src/vbox/vbox_CAPI_v4_2.h | 6 +-
src/vbox/vbox_CAPI_v4_2_20.h | 6 +-
src/vbox/vbox_CAPI_v4_3.h | 6 +-
src/vbox/vbox_CAPI_v4_3_4.h | 6 +-
src/vbox/vbox_CAPI_v5_0.h | 2 +-
src/vbox/vbox_CAPI_v5_1.h | 2 +-
src/vbox/vbox_common.h | 104 +-
src/vbox/vbox_tmpl.c | 36 +-
src/vmx/vmx.c | 4 +-
src/vz/vz_driver.c | 70 +-
src/vz/vz_sdk.c | 80 +-
src/vz/vz_utils.h | 22 +-
src/xen/xen_driver.c | 4 +-
src/xen/xen_driver.h | 8 +-
src/xen/xen_hypervisor.c | 398 ++++----
tests/Makefile.am | 78 +-
tests/bhyveargv2xmltest.c | 24 +-
tests/bhyvexml2argvtest.c | 20 +-
tests/bhyvexml2xmltest.c | 12 +-
tests/commandtest.c | 6 +-
tests/cputest.c | 160 +--
tests/domaincapstest.c | 128 +--
tests/domainconftest.c | 16 +-
tests/domainsnapshotxml2xmltest.c | 14 +-
tests/esxutilstest.c | 12 +-
tests/genericxml2xmltest.c | 14 +-
tests/interfacexml2xmltest.c | 6 +-
tests/libxlxml2domconfigtest.c | 16 +-
tests/lxcconf2xmltest.c | 12 +-
tests/lxcxml2xmltest.c | 14 +-
tests/metadatatest.c | 18 +-
tests/networkxml2conftest.c | 20 +-
tests/networkxml2firewalltest.c | 16 +-
tests/networkxml2xmltest.c | 12 +-
tests/networkxml2xmlupdatetest.c | 32 +-
tests/nodedevxml2xmltest.c | 6 +-
tests/nsstest.c | 16 +-
tests/nwfilterxml2firewalltest.c | 16 +-
tests/nwfilterxml2xmltest.c | 18 +-
tests/openvzutilstest.c | 12 +-
tests/qemuagenttest.c | 4 +-
tests/qemuargv2xmltest.c | 14 +-
tests/qemucapabilitiestest.c | 18 +-
tests/qemucaps2xmltest.c | 8 +-
tests/qemucapsprobemock.c | 14 +-
tests/qemucommandutiltest.c | 22 +-
tests/qemuhelptest.c | 24 +-
tests/qemuhotplugtest.c | 94 +-
tests/qemumonitorjsontest.c | 346 +++----
tests/qemumonitortest.c | 12 +-
tests/qemuxml2argvtest.c | 60 +-
tests/qemuxml2xmltest.c | 48 +-
tests/secretxml2xmltest.c | 12 +-
tests/securityselinuxlabeltest.c | 4 +-
tests/securityselinuxtest.c | 24 +-
tests/sexpr2xmltest.c | 14 +-
tests/sockettest.c | 132 +--
tests/storagebackendsheepdogtest.c | 38 +-
tests/storagepoolxml2xmltest.c | 6 +-
tests/storagevolxml2argvtest.c | 18 +-
tests/storagevolxml2xmltest.c | 14 +-
tests/testutils.h | 64 +-
tests/utiltest.c | 24 +-
tests/vboxsnapshotxmltest.c | 6 +-
tests/virauthconfigtest.c | 14 +-
tests/virbitmaptest.c | 44 +-
tests/virbuftest.c | 72 +-
tests/vircaps2xmltest.c | 12 +-
tests/vircgroupmock.c | 28 +-
tests/vircgrouptest.c | 40 +-
tests/virconftest.c | 30 +-
tests/vircryptotest.c | 40 +-
tests/virdbustest.c | 36 +-
tests/virdrivermoduletest.c | 12 +-
tests/virfilecachetest.c | 14 +-
tests/virfiletest.c | 44 +-
tests/virfilewrapper.c | 14 +-
tests/virfirewalltest.c | 96 +-
tests/virhashtest.c | 22 +-
tests/virhostdevtest.c | 28 +-
tests/viriscsitest.c | 20 +-
tests/virjsontest.c | 14 +-
tests/virkeycodetest.c | 32 +-
tests/virkmodtest.c | 14 +-
tests/virlogtest.c | 26 +-
tests/virmacmaptest.c | 66 +-
tests/virmock.h | 186 ++--
tests/virnetdaemontest.c | 16 +-
tests/virnetdevbandwidthtest.c | 60 +-
tests/virnetdevtest.c | 12 +-
tests/virnettlscontexttest.c | 52 +-
tests/virnettlshelpers.c | 36 +-
tests/virnettlssessiontest.c | 90 +-
tests/virpcimock.c | 32 +-
tests/virpcitest.c | 80 +-
tests/virschematest.c | 80 +-
tests/virscsitest.c | 10 +-
tests/virshtest.c | 14 +-
tests/virstoragetest.c | 98 +-
tests/virstorageutiltest.c | 30 +-
tests/virstringtest.c | 232 ++---
tests/virsystemdtest.c | 72 +-
tests/virtimetest.c | 66 +-
tests/viruritest.c | 24 +-
tests/virusbtest.c | 36 +-
tests/vmwarevertest.c | 16 +-
tests/vmx2xmltest.c | 16 +-
tests/xlconfigtest.c | 40 +-
tests/xmconfigtest.c | 32 +-
tests/xml2sexprtest.c | 14 +-
tests/xml2vmxtest.c | 16 +-
tools/Makefile.am | 252 ++---
tools/nss/libvirt_nss.c | 22 +-
tools/virsh-domain-monitor.c | 16 +-
tools/virsh-domain.c | 144 +--
tools/virsh-interface.c | 22 +-
tools/virsh-interface.h | 4 +-
tools/virsh-network.c | 26 +-
tools/virsh-network.h | 4 +-
tools/virsh-nwfilter.c | 14 +-
tools/virsh-nwfilter.h | 4 +-
tools/virsh-pool.c | 200 ++--
tools/virsh-pool.h | 4 +-
tools/virsh-snapshot.c | 40 +-
tools/virsh-volume.c | 36 +-
tools/virsh-volume.h | 4 +-
tools/virsh.h | 76 +-
tools/virt-admin.c | 32 +-
tools/virt-host-validate-bhyve.c | 18 +-
tools/vsh.h | 136 +--
tools/wireshark/src/packet-libvirt.c | 30 +-
221 files changed, 6427 insertions(+), 6421 deletions(-)
--
2.13.6
7 years, 1 month
[libvirt] [PATCH RFC 0/2] virsh: Introduce basic autocompletion
by Michal Privoznik
This is supposed to go on the top of:
https://www.redhat.com/archives/libvir-list/2017-October/msg01367.html
Before digging any deeper to this hole I want to make sure that
this approach is acceptable.
So how does this work. The idea is to have handful of generic
functions that fetch names (so called completers). Basically, one
completer per each libvirt object. The returned names are then
matched against (partial) user input and only matching strings
are then offered to the user. Moreover, among having .completer
each option has .completer_flags which can refine the completer's
behaviour.
For instance, in 2/2 I'm introducing virshDomainNameCompleter()
which does nothing more than virConnectListAllDomains(). However,
since it doesn't make much sense to start already running domain,
for the 'start' command .completer_flags is set to
VIR_CONNECT_LIST_DOMAINS_INACTIVE so that only inactive domains
are returned in the list.
What is missing?
What is implemented here are vshCmdOptDef completers. The general
vshCmdDef completers are still missing. Therefore:
virsh # start --domain<TAB><TAB>
works and lists inactive domains, but:
virsh # start<TAB><TAB>
doesn't (well, apart from offering options for the 'start'
command). While that would be certainly nice feature to have,
it'd require more work, because some arguments are "implicit"
based on position. For instance:
virsh # attach-interface fedora network default
which is equivalent to:
virsh # attach-interface --domain fedora --type network --source default
Also, bash autocompletion is missing. The idea there is to have
an unlisted virsh command that the bash script can call in order
to fetch list of options. But again, no movement in that area
yet.
Michal Privoznik (2):
vsh: Call vshCmdOptDef.completer properly
virsh: Introduce virshDomainNameCompleter
tools/virsh-domain-monitor.c | 30 +++----
tools/virsh-domain.c | 182 ++++++++++++++++++++++---------------------
tools/virsh-snapshot.c | 24 +++---
tools/virsh.c | 43 ++++++++++
tools/virsh.h | 8 +-
tools/vsh.c | 45 ++++++-----
6 files changed, 194 insertions(+), 138 deletions(-)
--
2.13.6
7 years, 1 month
[libvirt] [PATCH RFC] lib: provide error message in new blockjob event
by Nikolay Shirokovskiy
If block job is completed with error qemu additionally provides error message.
This patch introduces new event VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3 to pass error
message to client.
---
The patch is applied on top of [1] patch series (not yet pushed though). Looks
like this patch consists of too much boilerplate code only to pass extra string
parameter for blockjob event but looks like there is no other way now.
Especially ugly looking is adding event3 in src/qemu/qemu_blockjob.c.
Actually there is old RFC for providing error message for blockjob event [2].
Hope this one gain more attention.
[1] https://www.redhat.com/archives/libvir-list/2017-October/msg01292.html
[2] https://www.redhat.com/archives/libvir-list/2016-December/msg00093.html
daemon/remote.c | 47 ++++++++++++++++++++++++++++++++
examples/object-events/event-test.c | 21 +++++++++++++++
include/libvirt/libvirt-domain.h | 23 ++++++++++++++++
src/conf/domain_event.c | 54 ++++++++++++++++++++++++++++++++-----
src/conf/domain_event.h | 13 +++++++++
src/libvirt_private.syms | 2 ++
src/qemu/qemu_blockjob.c | 9 +++++--
src/qemu/qemu_blockjob.h | 3 ++-
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 10 ++++---
src/qemu/qemu_process.c | 12 ++++++---
src/remote/remote_driver.c | 34 +++++++++++++++++++++++
src/remote/remote_protocol.x | 17 +++++++++++-
src/remote_protocol-structs | 9 +++++++
tools/virsh-domain.c | 25 +++++++++++++++++
15 files changed, 264 insertions(+), 16 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 3f7d2d3..a5b87e6 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1342,6 +1342,52 @@ remoteRelayDomainEventBlockThreshold(virConnectPtr conn,
}
+static int
+remoteRelayDomainEventBlockJob3(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status,
+ const char *error,
+ void *opaque)
+{
+ daemonClientEventCallbackPtr callback = opaque;
+ remote_domain_event_block_job_3_msg data;
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
+ return -1;
+
+ VIR_DEBUG("Relaying domain block job 3 event %s %d %s %i, %i, %s, callback %d",
+ dom->name, dom->id, dst, type, status, NULLSTR(error),
+ callback->callbackID);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+ data.callbackID = callback->callbackID;
+ if (VIR_STRDUP(data.dst, dst) < 0)
+ return -1;
+ if (error) {
+ if (VIR_ALLOC(data.error) < 0 ||
+ VIR_STRDUP(*(data.error), error) < 0)
+ goto error;
+ }
+ data.type = type;
+ data.status = status;
+ make_nonnull_domain(&data.dom, dom);
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_3,
+ (xdrproc_t)xdr_remote_domain_event_block_job_3_msg, &data);
+ return 0;
+
+ error:
+ VIR_FREE(data.dst);
+ VIR_FREE(data.error);
+
+ return -1;
+}
+
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
@@ -1368,6 +1414,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDeviceRemovalFailed),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMetadataChange),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockThreshold),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockJob3),
};
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index a144638..623dbd6 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -936,6 +936,26 @@ myDomainEventBlockJobCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
static int
+myDomainEventBlockJob3Callback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *disk,
+ int type,
+ int status,
+ void *opaque,
+ const char *error)
+{
+ const char *eventName = opaque;
+
+ printf("%s EVENT: Domain %s(%d) block job callback '%s' disk '%s', "
+ "type '%s' status '%s' error '%s'",
+ __func__, virDomainGetName(dom), virDomainGetID(dom), eventName,
+ disk, blockJobTypeToStr(type), blockJobStatusToStr(status),
+ NULLSTR(error));
+ return 0;
+}
+
+
+static int
myDomainEventBlockThresholdCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainPtr dom,
const char *dev,
@@ -1082,6 +1102,7 @@ struct domainEventData domainEvents[] = {
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, myDomainEventMetadataChangeCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD, myDomainEventBlockThresholdCallback),
+ DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3, myDomainEventBlockJob3Callback),
};
struct storagePoolEventData {
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 4048acf..4f942da 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -4363,6 +4363,28 @@ typedef void (*virConnectDomainEventBlockThresholdCallback)(virConnectPtr conn,
unsigned long long excess,
void *opaque);
+
+/**
+ * virConnectDomainEventBlockJob3Callback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @disk: name associated with the affected disk (filename or target
+ * device, depending on how the callback was registered)
+ * @type: type of block job (virDomainBlockJobType)
+ * @status: status of the operation (virConnectDomainEventBlockJobStatus)
+ * @error: error string
+ * @opaque: application specified data
+ *
+ */
+
+
+typedef void (*virConnectDomainEventBlockJob3Callback)(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *disk,
+ int type,
+ int status,
+ const char *error,
+ void *opaque);
/**
* VIR_DOMAIN_EVENT_CALLBACK:
*
@@ -4405,6 +4427,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED = 22, /* virConnectDomainEventDeviceRemovalFailedCallback */
VIR_DOMAIN_EVENT_ID_METADATA_CHANGE = 23, /* virConnectDomainEventMetadataChangeCallback */
VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD = 24, /* virConnectDomainEventBlockThresholdCallback */
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3 = 25, /* virConnectDomainEventBlockJob3Callback */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_ID_LAST
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 7baccd5..2ea170d 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -145,6 +145,7 @@ struct _virDomainEventBlockJob {
virDomainEvent parent;
char *disk; /* path or dst, depending on event id */
+ char *error;
int type;
int status;
};
@@ -501,6 +502,7 @@ virDomainEventBlockJobDispose(void *obj)
VIR_DEBUG("obj=%p", event);
VIR_FREE(event->disk);
+ VIR_FREE(event->error);
}
static void
@@ -995,7 +997,8 @@ virDomainEventBlockJobNew(int event,
unsigned char *uuid,
const char *disk,
int type,
- int status)
+ int status,
+ const char *error)
{
virDomainEventBlockJobPtr ev;
@@ -1007,7 +1010,8 @@ virDomainEventBlockJobNew(int event,
id, name, uuid)))
return NULL;
- if (VIR_STRDUP(ev->disk, disk) < 0) {
+ if (VIR_STRDUP(ev->disk, disk) < 0 ||
+ VIR_STRDUP(ev->error, error) < 0) {
virObjectUnref(ev);
return NULL;
}
@@ -1025,7 +1029,7 @@ virDomainEventBlockJobNewFromObj(virDomainObjPtr obj,
{
return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
obj->def->id, obj->def->name,
- obj->def->uuid, path, type, status);
+ obj->def->uuid, path, type, status, NULL);
}
virObjectEventPtr
@@ -1036,7 +1040,7 @@ virDomainEventBlockJobNewFromDom(virDomainPtr dom,
{
return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
dom->id, dom->name, dom->uuid,
- path, type, status);
+ path, type, status, NULL);
}
virObjectEventPtr
@@ -1047,7 +1051,7 @@ virDomainEventBlockJob2NewFromObj(virDomainObjPtr obj,
{
return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
obj->def->id, obj->def->name,
- obj->def->uuid, dst, type, status);
+ obj->def->uuid, dst, type, status, NULL);
}
virObjectEventPtr
@@ -1058,7 +1062,31 @@ virDomainEventBlockJob2NewFromDom(virDomainPtr dom,
{
return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
dom->id, dom->name, dom->uuid,
- dst, type, status);
+ dst, type, status, NULL);
+}
+
+virObjectEventPtr
+virDomainEventBlockJob3NewFromObj(virDomainObjPtr obj,
+ const char *dst,
+ int type,
+ int status,
+ const char *error)
+{
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3,
+ obj->def->id, obj->def->name,
+ obj->def->uuid, dst, type, status, error);
+}
+
+virObjectEventPtr
+virDomainEventBlockJob3NewFromDom(virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status,
+ const char *error)
+{
+ return virDomainEventBlockJobNew(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3,
+ dom->id, dom->name, dom->uuid,
+ dst, type, status, error);
}
virObjectEventPtr
@@ -1871,6 +1899,20 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
goto cleanup;
}
+ case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_3:
+ {
+ virDomainEventBlockJobPtr blockJobEvent;
+
+ blockJobEvent = (virDomainEventBlockJobPtr)event;
+ ((virConnectDomainEventBlockJob3Callback)cb)(conn, dom,
+ blockJobEvent->disk,
+ blockJobEvent->type,
+ blockJobEvent->status,
+ blockJobEvent->error,
+ cbopaque);
+ goto cleanup;
+ }
+
case VIR_DOMAIN_EVENT_ID_DISK_CHANGE:
{
virDomainEventDiskChangePtr diskChangeEvent;
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 3992a29..1a0f16b 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -138,6 +138,19 @@ virDomainEventBlockJob2NewFromDom(virDomainPtr dom,
int status);
virObjectEventPtr
+virDomainEventBlockJob3NewFromObj(virDomainObjPtr obj,
+ const char *dst,
+ int type,
+ int status,
+ const char *error);
+virObjectEventPtr
+virDomainEventBlockJob3NewFromDom(virDomainPtr dom,
+ const char *dst,
+ int type,
+ int status,
+ const char *error);
+
+virObjectEventPtr
virDomainEventDiskChangeNewFromObj(virDomainObjPtr obj,
const char *oldSrcPath,
const char *newSrcPath,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 448d962..5f0a212 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -562,6 +562,8 @@ virDomainEventBalloonChangeNewFromDom;
virDomainEventBalloonChangeNewFromObj;
virDomainEventBlockJob2NewFromDom;
virDomainEventBlockJob2NewFromObj;
+virDomainEventBlockJob3NewFromDom;
+virDomainEventBlockJob3NewFromObj;
virDomainEventBlockJobNewFromDom;
virDomainEventBlockJobNewFromObj;
virDomainEventBlockThresholdNewFromDom;
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 0b1616a..5266823 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -70,7 +70,8 @@ qemuBlockJobUpdate(virQEMUDriverPtr driver,
if (status != -1) {
qemuBlockJobEventProcess(driver, vm, disk, asyncJob,
diskPriv->blockJobType,
- diskPriv->blockJobStatus);
+ diskPriv->blockJobStatus,
+ diskPriv->blockJobError);
diskPriv->blockJobStatus = -1;
if (error)
VIR_STEAL_PTR(*error, diskPriv->blockJobError);
@@ -100,10 +101,12 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk,
qemuDomainAsyncJob asyncJob,
int type,
- int status)
+ int status,
+ const char *error)
{
virObjectEventPtr event = NULL;
virObjectEventPtr event2 = NULL;
+ virObjectEventPtr event3 = NULL;
const char *path;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virDomainDiskDefPtr persistDisk = NULL;
@@ -123,6 +126,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
path = virDomainDiskGetSource(disk);
event = virDomainEventBlockJobNewFromObj(vm, path, type, status);
event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type, status);
+ event3 = virDomainEventBlockJob3NewFromObj(vm, disk->dst, type, status, error);
/* If we completed a block pull or commit, then update the XML
* to match. */
@@ -212,6 +216,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
qemuDomainEventQueue(driver, event);
qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event3);
virObjectUnref(cfg);
}
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index e71d691..18bcaaa 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -36,7 +36,8 @@ void qemuBlockJobEventProcess(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk,
qemuDomainAsyncJob asyncJob,
int type,
- int status);
+ int status,
+ const char *error);
void qemuBlockJobSyncBegin(virDomainDiskDefPtr disk);
void qemuBlockJobSyncEnd(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 735e810..99a71b3 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -457,6 +457,7 @@ struct qemuProcessEvent {
int action;
int status;
void *data;
+ char *error;
};
typedef struct _qemuDomainLogContext qemuDomainLogContext;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 725b46a..c6626bb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4715,7 +4715,8 @@ processBlockJobEvent(virQEMUDriverPtr driver,
virDomainObjPtr vm,
char *diskAlias,
int type,
- int status)
+ int status,
+ char *error)
{
virDomainDiskDefPtr disk;
@@ -4728,12 +4729,14 @@ processBlockJobEvent(virQEMUDriverPtr driver,
}
if ((disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias)))
- qemuBlockJobEventProcess(driver, vm, disk, QEMU_ASYNC_JOB_NONE, type, status);
+ qemuBlockJobEventProcess(driver, vm, disk, QEMU_ASYNC_JOB_NONE,
+ type, status, error);
endjob:
qemuDomainObjEndJob(driver, vm);
cleanup:
VIR_FREE(diskAlias);
+ VIR_FREE(error);
}
@@ -4815,7 +4818,8 @@ static void qemuProcessEventHandler(void *data, void *opaque)
processBlockJobEvent(driver, vm,
processEvent->data,
processEvent->action,
- processEvent->status);
+ processEvent->status,
+ processEvent->error);
break;
case QEMU_PROCESS_EVENT_MONITOR_EOF:
processMonitorEOFEvent(driver, vm);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4bfad5d..6a3d9bc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1008,6 +1008,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainDiskDefPtr disk;
qemuDomainDiskPrivatePtr diskPriv;
char *data = NULL;
+ char *errorCopy = NULL;
virObjectLock(vm);
@@ -1018,13 +1019,14 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
goto error;
diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+ ignore_value(VIR_STRDUP_QUIET(errorCopy, error));
+
if (diskPriv->blockJobSync) {
/* We have a SYNC API waiting for this event, dispatch it back */
diskPriv->blockJobType = type;
diskPriv->blockJobStatus = status;
VIR_FREE(diskPriv->blockJobError);
- if (error && VIR_STRDUP_QUIET(diskPriv->blockJobError, error) < 0)
- VIR_WARN("Can not pass error message further: %s", error);
+ VIR_STEAL_PTR(diskPriv->blockJobError, errorCopy);
virDomainObjBroadcast(vm);
} else {
/* there is no waiting SYNC API, dispatch the update to a thread */
@@ -1038,6 +1040,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
processEvent->vm = vm;
processEvent->action = type;
processEvent->status = status;
+ VIR_STEAL_PTR(processEvent->error, errorCopy);
virObjectRef(vm);
if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
@@ -1047,11 +1050,14 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
cleanup:
+ VIR_FREE(errorCopy);
virObjectUnlock(vm);
return 0;
error:
- if (processEvent)
+ if (processEvent) {
VIR_FREE(processEvent->data);
+ VIR_FREE(processEvent->error);
+ }
VIR_FREE(processEvent);
goto cleanup;
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 06719bb..c73461d 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -405,6 +405,11 @@ remoteConnectNotifyEventConnectionClosed(virNetClientProgramPtr prog ATTRIBUTE_U
virNetClientPtr client ATTRIBUTE_UNUSED,
void *evdata, void *opaque);
+static void
+remoteDomainBuildEventBlockJob3(virNetClientProgramPtr prog,
+ virNetClientPtr client,
+ void *evdata, void *opaque);
+
static virNetClientProgramEvent remoteEvents[] = {
{ REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE,
remoteDomainBuildEventLifecycle,
@@ -611,6 +616,10 @@ static virNetClientProgramEvent remoteEvents[] = {
remoteDomainBuildEventBlockThreshold,
sizeof(remote_domain_event_block_threshold_msg),
(xdrproc_t)xdr_remote_domain_event_block_threshold_msg },
+ { REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_3,
+ remoteDomainBuildEventBlockJob3,
+ sizeof(remote_domain_event_block_job_3_msg),
+ (xdrproc_t)xdr_remote_domain_event_block_job_3_msg },
};
static void
@@ -5610,6 +5619,31 @@ remoteDomainBuildEventBlockThreshold(virNetClientProgramPtr prog ATTRIBUTE_UNUSE
}
+static void
+remoteDomainBuildEventBlockJob3(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ remote_domain_event_block_job_3_msg *msg = evdata;
+ struct private_data *priv = conn->privateData;
+ virDomainPtr dom;
+ virObjectEventPtr event = NULL;
+
+ dom = get_nonnull_domain(conn, msg->dom);
+ if (!dom)
+ return;
+
+ event = virDomainEventBlockJob3NewFromDom(dom, msg->dst, msg->type,
+ msg->status,
+ msg->error ? *msg->error : NULL);
+
+ virObjectUnref(dom);
+
+ remoteEventQueue(priv, event, msg->callbackID);
+}
+
+
static int
remoteStreamSend(virStreamPtr st,
const char *data,
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 0aed252..371b640 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3095,6 +3095,15 @@ struct remote_domain_event_block_job_2_msg {
int status;
};
+struct remote_domain_event_block_job_3_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string dst;
+ remote_string error;
+ int type;
+ int status;
+};
+
struct remote_domain_event_block_threshold_msg {
int callbackID;
remote_nonnull_domain dom;
@@ -6120,5 +6129,11 @@ enum remote_procedure {
* @generate: both
* @acl: domain:write
*/
- REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION = 390
+ REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION = 390,
+
+ /**
+ * @generate: none
+ * @acl: none
+ */
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_3 = 391
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 59b0ace..b8f4065 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2535,6 +2535,14 @@ struct remote_domain_event_block_job_2_msg {
int type;
int status;
};
+struct remote_domain_event_block_job_3_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string dst;
+ remote_string error;
+ int type;
+ int status;
+};
struct remote_domain_event_block_threshold_msg {
int callbackID;
remote_nonnull_domain dom;
@@ -3262,4 +3270,5 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC = 388,
REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML = 389,
REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION = 390,
+ REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_3 = 391,
};
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1e33e82..6377c91 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13253,6 +13253,29 @@ virshEventBlockThresholdPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
}
+static void
+virshEventBlockJob3Print(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ const char *disk,
+ int type,
+ int status,
+ const char *error,
+ void *opaque)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAsprintf(&buf, _("event '%s' for domain %s: %s for %s %s, "
+ "error: %s\n"),
+ ((virshDomEventData *) opaque)->cb->name,
+ virDomainGetName(dom),
+ virshDomainBlockJobToString(type),
+ disk,
+ virshDomainBlockJobStatusToString(status),
+ NULLSTR(error));
+ virshEventPrint(opaque, &buf);
+}
+
+
static vshEventCallback vshEventCallbacks[] = {
{ "lifecycle",
VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), },
@@ -13302,6 +13325,8 @@ static vshEventCallback vshEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(virshEventMetadataChangePrint), },
{ "block-threshold",
VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockThresholdPrint), },
+ { "block-job-3",
+ VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockJob3Print), },
};
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
--
1.8.3.1
7 years, 1 month
[libvirt] [PATCH] virsh: Define multi line macros properly
by Michal Privoznik
In some cases there's dangling backward slash at the end of multi
line macros. While technically the code works, it will stop if
some empty lines are removed.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain-monitor.c | 2 +-
tools/virsh-domain.c | 20 ++++++++++----------
tools/virsh-interface.c | 2 +-
tools/virsh-network.c | 2 +-
tools/virsh-pool.c | 10 +++++-----
tools/virsh-snapshot.c | 2 +-
tools/virsh-volume.c | 8 ++++----
tools/virsh.h | 12 ++++++------
tools/virt-host-validate-bhyve.c | 2 +-
9 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 35d04b22a..e09508248 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -41,7 +41,7 @@
#include "virstring.h"
#define VIRSH_COMMON_OPT_DOMAIN_FULL \
- VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \
+ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"))
VIR_ENUM_DECL(virshDomainIOError)
VIR_ENUM_IMPL(virshDomainIOError,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1e33e8295..53ce5b82f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -66,22 +66,22 @@
#endif
#define VIRSH_COMMON_OPT_DOMAIN_FULL \
- VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \
+ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"))
#define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \
{.name = "persistent", \
.type = VSH_OT_BOOL, \
.help = N_("make live change persistent") \
- } \
+ }
#define VIRSH_COMMON_OPT_DOMAIN_CONFIG \
- VIRSH_COMMON_OPT_CONFIG(N_("affect next boot")) \
+ VIRSH_COMMON_OPT_CONFIG(N_("affect next boot"))
#define VIRSH_COMMON_OPT_DOMAIN_LIVE \
- VIRSH_COMMON_OPT_LIVE(N_("affect running domain")) \
+ VIRSH_COMMON_OPT_LIVE(N_("affect running domain"))
#define VIRSH_COMMON_OPT_DOMAIN_CURRENT \
- VIRSH_COMMON_OPT_CURRENT(N_("affect current domain")) \
+ VIRSH_COMMON_OPT_CURRENT(N_("affect current domain"))
static virDomainPtr
@@ -781,7 +781,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
* 'average,peak,burst,floor', in which peak and burst are optional,
* thus 'average,,burst' and 'average,peak' are also legal. */
-#define VIRSH_PARSE_RATE_FIELD(index, name) \
+#define VIRSH_PARSE_RATE_FIELD(index, name) \
do { \
if (index < ntok && \
*tok[index] != '\0' && \
@@ -1302,7 +1302,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \
value) < 0) \
goto save_error; \
- } \
+ }
VSH_ADD_IOTUNE_SCALED(total-bytes-sec, TOTAL_BYTES_SEC);
VSH_ADD_IOTUNE_SCALED(read-bytes-sec, READ_BYTES_SEC);
@@ -1320,7 +1320,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
VIR_DOMAIN_BLOCK_IOTUNE_##CONST, \
value) < 0) \
goto save_error; \
- } \
+ }
VSH_ADD_IOTUNE(total-iops-sec, TOTAL_IOPS_SEC);
VSH_ADD_IOTUNE(read-iops-sec, READ_IOPS_SEC);
@@ -9096,7 +9096,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
return false;
#define PARSE_MEMTUNE_PARAM(NAME, FIELD) \
- if ((rc = virshMemtuneGetSize(ctl, cmd, NAME, &tmpVal)) < 0) { \
+ if ((rc = virshMemtuneGetSize(ctl, cmd, NAME, &tmpVal)) < 0) { \
vshError(ctl, _("Unable to parse integer parameter %s"), NAME); \
goto cleanup; \
} \
@@ -9104,7 +9104,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
if (virTypedParamsAddULLong(¶ms, &nparams, &maxparams, \
FIELD, tmpVal) < 0) \
goto save_error; \
- } \
+ }
PARSE_MEMTUNE_PARAM("hard-limit", VIR_DOMAIN_MEMORY_HARD_LIMIT);
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 25e21710f..5ca7393d1 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -28,7 +28,7 @@
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = N_("interface name or MAC address") \
- } \
+ }
#include <config.h>
#include "virsh-interface.h"
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index eacc2771b..14f7e7f77 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -39,7 +39,7 @@
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = N_("network name or uuid") \
- } \
+ }
virNetworkPtr
virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 96a623284..58a336de8 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -35,28 +35,28 @@
#include "virtime.h"
#define VIRSH_COMMON_OPT_POOL_FULL \
- VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \
+ VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"))
#define VIRSH_COMMON_OPT_POOL_BUILD \
{.name = "build", \
.type = VSH_OT_BOOL, \
.flags = 0, \
.help = N_("build the pool as normal") \
- } \
+ }
#define VIRSH_COMMON_OPT_POOL_NO_OVERWRITE \
{.name = "no-overwrite", \
.type = VSH_OT_BOOL, \
.flags = 0, \
.help = N_("do not overwrite any existing data") \
- } \
+ }
#define VIRSH_COMMON_OPT_POOL_OVERWRITE \
{.name = "overwrite", \
.type = VSH_OT_BOOL, \
.flags = 0, \
.help = N_("overwrite any existing data") \
- } \
+ }
#define VIRSH_COMMON_OPT_POOL_X_AS \
{.name = "name", \
@@ -128,7 +128,7 @@
{.name = "adapter-parent", \
.type = VSH_OT_STRING, \
.help = N_("adapter parent to be used for underlying storage") \
- } \
+ }
virStoragePoolPtr
virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 24cd4abd9..8789ee7b0 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -43,7 +43,7 @@
#include "conf/snapshot_conf.h"
#define VIRSH_COMMON_OPT_DOMAIN_FULL \
- VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid")) \
+ VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"))
/* Helper for snapshot-create and snapshot-create-as */
static bool
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 0736bdcdb..007657002 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -44,23 +44,23 @@
#include "virstring.h"
#define VIRSH_COMMON_OPT_POOL_FULL \
- VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) \
+ VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"))
#define VIRSH_COMMON_OPT_POOL_NAME \
- VIRSH_COMMON_OPT_POOL(N_("pool name")) \
+ VIRSH_COMMON_OPT_POOL(N_("pool name"))
#define VIRSH_COMMON_OPT_POOL_OPTIONAL \
{.name = "pool", \
.type = VSH_OT_STRING, \
.help = N_("pool name or uuid") \
- } \
+ }
#define VIRSH_COMMON_OPT_VOLUME_VOL \
{.name = "vol", \
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = N_("vol name, key or path") \
- } \
+ }
virStorageVolPtr
virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
diff --git a/tools/virsh.h b/tools/virsh.h
index 9e42ef9bb..9bcf467d4 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -68,39 +68,39 @@
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr \
- } \
+ }
# define VIRSH_COMMON_OPT_DOMAIN(_helpstr) \
{.name = "domain", \
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr \
- } \
+ }
# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
{.name = "config", \
.type = VSH_OT_BOOL, \
.help = _helpstr \
- } \
+ }
# define VIRSH_COMMON_OPT_LIVE(_helpstr) \
{.name = "live", \
.type = VSH_OT_BOOL, \
.help = _helpstr \
- } \
+ }
# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \
{.name = "current", \
.type = VSH_OT_BOOL, \
.help = _helpstr \
- } \
+ }
# define VIRSH_COMMON_OPT_FILE(_helpstr) \
{.name = "file", \
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
.help = _helpstr \
- } \
+ }
typedef struct _virshControl virshControl;
typedef virshControl *virshControlPtr;
diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bhyve.c
index c7bf96f05..bd85f8ab0 100644
--- a/tools/virt-host-validate-bhyve.c
+++ b/tools/virt-host-validate-bhyve.c
@@ -37,7 +37,7 @@
_("%s module is not loaded, " err_msg), \
#mod); \
ret = -1; \
- } \
+ }
#define MODULE_STATUS_FAIL(mod, err_msg) \
MODULE_STATUS(mod, err_msg, VIR_HOST_VALIDATE_FAIL)
--
2.13.6
7 years, 1 month
[libvirt] [libvirt-glib] [PATCH v2] spec: Enable unit tests during build
by mkasik@redhat.com
From: Marek Kasik <mkasik(a)redhat.com>
Enable unit tests so that we can catch some problems soon enough
before the package gets to the users.
Show test suite log if a test fail.
---
libvirt-glib.spec.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libvirt-glib.spec.in b/libvirt-glib.spec.in
index a1ca11f..2b9296e 100644
--- a/libvirt-glib.spec.in
+++ b/libvirt-glib.spec.in
@@ -116,6 +116,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt-gobject-1.0.la
%find_lang %{name}
+%check
+if ! make %{?_smp_mflags} check; then
+ cat tests/test-suite.log
+ exit 1
+fi
+
%clean
rm -rf $RPM_BUILD_ROOT
--
2.14.2
7 years, 1 month
[libvirt] [PATCH 0/2] qemu: Fix QoS for vhostuser
by Michal Privoznik
Setting QoS on the fly does work for vhostuser. However, it doesn't when
starting a domain. So when looking into this, I realized that we should be more
explicit about types of interface that do support QoS.
Michal Privoznik (2):
qemuDomainSetInterfaceParameters: Explicitly reject unsupported net
types
virNetDevSupportBandwidth: Enable QoS for vhostuser
src/conf/netdev_bandwidth_conf.h | 2 +-
src/qemu/qemu_driver.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
--
2.13.6
7 years, 1 month
[libvirt] [libvirt-glib] [PATCH] spec: Enable unit tests during build
by mkasik@redhat.com
Hi,
libvirt-glib has unit tests which can be evaluated as a part of build of RPM.
It is generally recommended to run these tests so that some problems can be
cought soon enough before the package gets to the users.
Please, enable these tests for libvirt-glib.
I've done scratch-build of this in koji and the build passes as well
as the tests.
7 years, 1 month
[libvirt] [PATCH] qemu: snapshot: Keep non-persistent changes alive in snapshot
by Kothapally Madhu Pavan
Restoring to a snapshot should not overwrite the persistent configuration
xml of a snapshot as a side effect. This patch fixes the same. Currently,
virDomainSnapshotDef only saves active domain definition of the guest.
And on restore the active domain definition is used as both active and
inactive domain definitions. Thiswill make the non-persistent changes
persistent in snapshot image. This patch allows to save inactive domain
definition as well and on snapshot-revert non-persistent configuration is
restored as is.
Currently, snapshot-revert is making non-presistent changes as persistent.
Here are the steps to reproduce.
Step1: virsh define $dom
Step2: virsh attach-device $dom $memory-device.xml --live
Step3: virsh snapshot-create $dom
Step4: virsh destroy $dom
Step5: virsh snapshot-revert $dom $snapshot-name
Step6: virsh destroy $dom
Step7: virsh start $dom
Here we still have $memory-device attached in Step2.
This patch is attempting to solve this issue.
Signed-off-by: Kothapally Madhu Pavan <kmp(a)linux.vnet.ibm.com>
---
src/conf/snapshot_conf.c | 1 +
src/conf/snapshot_conf.h | 1 +
src/qemu/qemu_driver.c | 23 +++++++++++++++++++++++
3 files changed, 25 insertions(+)
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index f0e852c..e32fb4d 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -102,6 +102,7 @@ void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
virDomainSnapshotDiskDefClear(&def->disks[i]);
VIR_FREE(def->disks);
virDomainDefFree(def->dom);
+ virDomainDefFree(def->newDom);
virObjectUnref(def->cookie);
VIR_FREE(def);
}
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 1d663c7..0bc915f 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -75,6 +75,7 @@ struct _virDomainSnapshotDef {
virDomainSnapshotDiskDef *disks;
virDomainDefPtr dom;
+ virDomainDefPtr newDom;
virObjectPtr cookie;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 74fdfdb..c7cdb43 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15035,6 +15035,15 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto endjob;
+ if (vm->newDef) {
+ if (!(xml = qemuDomainDefFormatLive(driver, vm->newDef, priv->origCPU,
+ true, true)) ||
+ !(def->newDom = virDomainDefParseString(xml, caps, driver->xmlopt, NULL,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE |
+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
+ goto endjob;
+ }
+
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) {
align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
align_match = false;
@@ -15567,6 +15576,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuDomainObjPrivatePtr priv;
int rc;
virDomainDefPtr config = NULL;
+ virDomainDefPtr newConfig = NULL;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
bool was_running = false;
@@ -15678,6 +15688,13 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
goto endjob;
}
+ if (snap->def->newDom) {
+ newConfig = virDomainDefCopy(snap->def->newDom, caps,
+ driver->xmlopt, NULL, true);
+ if (!newConfig)
+ goto endjob;
+ }
+
cookie = (qemuDomainSaveCookiePtr) snap->def->cookie;
switch ((virDomainState) snap->def->state) {
@@ -15775,12 +15792,16 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virCPUDefFree(priv->origCPU);
VIR_STEAL_PTR(priv->origCPU, origCPU);
}
+ if (newConfig)
+ vm->newDef = newConfig;
} else {
/* Transitions 2, 3 */
load:
was_stopped = true;
if (config)
virDomainObjAssignDef(vm, config, false, NULL);
+ if (newConfig)
+ vm->newDef = newConfig;
/* No cookie means libvirt which saved the domain was too old to
* mess up the CPU definitions.
@@ -15874,6 +15895,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
}
if (config)
virDomainObjAssignDef(vm, config, false, NULL);
+ if (newConfig)
+ vm->newDef = newConfig;
if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
--
1.8.3.1
7 years, 1 month
[libvirt] Using XML returned from domain hook script
by Jim Fehlig
Hi All,
It may be a foolish en devour, but I'm trying to make a qemu hook script that
provides the semantics of an old, custom xen block script. The script parses
<disk> info, does some setup based on that, and then rewrites part of the config
based on results of the setup. As an example, here is an XML snippet of a <disk>
device on input to the hook script
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='some-dev-config'/>
<target dev='vdb' bus='virtio'/>
</disk>
and XML returned by the script
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/foo'/>
<target dev='vdb' bus='virtio'/>
</disk>
The hook script performs the setup and substitution in the "prepare" phase, but
I noticed the results are never used when subsequently starting the domain.
Indeed qemuProcessStartHook passes a NULL buffer to virHookCall, so the output
XML of the hook is never collected. Does anyone have objections to using the XML
returned from the "prepare" and "release" hook script phases, similar to how it
is used in the "restore" and "migrate" phases?
WRT the "release" phase, for my hack to work I'd need the original value of the
dev attribute ('some-dev-config' in the above example). ISTR some patches on the
list to add a metadata element for <devices>. Perhaps those patches would come
in handy as a place to store the original dev attribute value.
Thanks for your comments!
Regards,
Jim
7 years, 1 month
[libvirt] [PATCH v4 0/2] daemon: fix termination/reload issues
by John Ferlan
This is a repost/fixup of Nikolay's v3:
https://www.redhat.com/archives/libvir-list/2017-October/msg01089.html
The primary difference here is a reorder of the patches to perform
the proper refcnt operations before reordering the shutdown path in
order to clean up servers out of the hash table sooner than later.
In particular, the lock_manager sequencing in order to make sure that
the virObjectUnref is done "orderly".
Nikolay - if you're fine with these changes let me know and I can
then push them (unless of course someone else ACK's before that).
Hopefully the change to lock_daemon makes sense.
Theoretically spaking the virHashFree in virNetDaemonDispose is
probably now superfluous since patch 2/2 will remove all the servers
much sooner, but let's keep it there just to be safe!
Nikolay Shirokovskiy (2):
rpc: When adding srv to dmn servers, need to add ref
libvirtd: fix crash on termination
src/locking/lock_daemon.c | 19 ++++++++++++++-----
src/rpc/virnetdaemon.c | 4 ++++
2 files changed, 18 insertions(+), 5 deletions(-)
--
2.13.6
7 years, 1 month