[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/3 v2] daemon: Create priority workers pool



This patch annotates APIs with low or high priority.
In low set MUST be all APIs which might eventually access monitor
(and thus block indefinitely). Other APIs may be marked as high
priority. However, some must be (e.g. domainDestroy).

For high priority calls (HPC), there is new thread pool created.
HPC tries to land in usual thread pool firstly. The condition here
is it contains at least one free worker. As soon as it doesn't,
HPCs are placed into the new pool. Therefore, only those APIs which
are guaranteed to end in reasonable small amount of time can be marked
as HPC.

The size of this HPC pool is static, because HPC are expected to end
quickly, therefore jobs assigned to this pool will be served quickly.
It can be configured in libvirtd.conf via prio_workers variable.
Default is set to 5.

To mark API with low or high priority, append priority:{low|high} to
it's comment in src/remote/remote_protocol.x. This is similar to
autogen|skipgen.
---
 daemon/libvirtd.aug           |    1 +
 daemon/libvirtd.c             |   10 +-
 daemon/libvirtd.conf          |    6 +
 daemon/remote.c               |   26 ++
 daemon/remote.h               |    2 +
 src/qemu/qemu_process.c       |    2 +-
 src/remote/qemu_protocol.x    |   13 +-
 src/remote/remote_protocol.x  |  544 +++++++++++++++++++++--------------------
 src/rpc/gendispatch.pl        |   20 ++-
 src/rpc/virnetserver.c        |   32 +++-
 src/rpc/virnetserver.h        |    6 +-
 src/rpc/virnetserverprogram.h |    1 +
 src/util/threadpool.c         |   38 ++-
 src/util/threadpool.h         |    1 +
 14 files changed, 411 insertions(+), 291 deletions(-)

diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug
index 3f47ebb..ce00db5 100644
--- a/daemon/libvirtd.aug
+++ b/daemon/libvirtd.aug
@@ -57,6 +57,7 @@ module Libvirtd =
                         | int_entry "max_clients"
                         | int_entry "max_requests"
                         | int_entry "max_client_requests"
+                        | int_entry "prio_workers"
 
    let logging_entry = int_entry "log_level"
                      | str_entry "log_filters"
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 0530ba5..3a6233d 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -134,6 +134,8 @@ struct daemonConfig {
     int max_workers;
     int max_clients;
 
+    int prio_workers;
+
     int max_requests;
     int max_client_requests;
 
@@ -886,6 +888,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
     data->max_workers = 20;
     data->max_clients = 20;
 
+    data->prio_workers = 5;
+
     data->max_requests = 20;
     data->max_client_requests = 5;
 
@@ -1042,6 +1046,8 @@ daemonConfigLoad(struct daemonConfig *data,
     GET_CONF_INT (conf, filename, max_workers);
     GET_CONF_INT (conf, filename, max_clients);
 
+    GET_CONF_INT (conf, filename, prio_workers);
+
     GET_CONF_INT (conf, filename, max_requests);
     GET_CONF_INT (conf, filename, max_client_requests);
 
@@ -1433,7 +1439,9 @@ int main(int argc, char **argv) {
                                 config->max_clients,
                                 config->mdns_adv ? config->mdns_name : NULL,
                                 use_polkit_dbus,
-                                remoteClientInitHook))) {
+                                remoteClientInitHook,
+                                config->prio_workers,
+                                remoteGetProcPriority))) {
         ret = VIR_DAEMON_ERR_INIT;
         goto cleanup;
     }
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 95e43dd..da3983e 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -257,6 +257,12 @@
 #min_workers = 5
 #max_workers = 20
 
+
+# The number of priority workers. If all workers from above
+# pool will stuck, some calls marked as high priority
+# (notably domainDestroy) can be executed in this pool.
+#prio_workers = 5
+
 # Total global limit on concurrent RPC calls. Should be
 # at least as large as max_workers. Beyond this, RPC requests
 # will be read into memory and queued. This directly impact
diff --git a/daemon/remote.c b/daemon/remote.c
index 0f088c6..9b1433b 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -473,6 +473,32 @@ int remoteClientInitHook(virNetServerPtr srv ATTRIBUTE_UNUSED,
     return 0;
 }
 
+unsigned int remoteGetProcPriority(virNetMessageHeaderPtr hdr)
+{
+    u_int prog = hdr->prog;
+    int proc = hdr->proc;
+    virNetServerProgramProc *table = NULL;
+    size_t max = 0;
+
+    switch (prog) {
+        case REMOTE_PROGRAM:
+            table = remoteProcs;
+            max = remoteNProcs;
+            break;
+        case QEMU_PROGRAM:
+            table = qemuProcs;
+            max = qemuNProcs;
+            break;
+    }
+
+    if (!table || !max)
+        return 0;
+    if (proc >= max)
+        return 0;
+
+    return table[proc].priority;
+}
+
 /*----- Functions. -----*/
 
 static int
diff --git a/daemon/remote.h b/daemon/remote.h
index 5444e47..1969f22 100644
--- a/daemon/remote.h
+++ b/daemon/remote.h
@@ -38,4 +38,6 @@ extern size_t qemuNProcs;
 int remoteClientInitHook(virNetServerPtr srv,
                          virNetServerClientPtr client);
 
+unsigned int remoteGetProcPriority(virNetMessageHeaderPtr hdr);
+
 #endif /* __LIBVIRTD_REMOTE_H__ */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 6f54b30..21e73a5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -576,7 +576,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
              * deleted before handling watchdog event is finished.
              */
             virDomainObjRef(vm);
-            if (virThreadPoolSendJob(driver->workerPool, wdEvent) < 0) {
+            if (virThreadPoolSendJob(driver->workerPool, false, wdEvent) < 0) {
                 if (virDomainObjUnref(vm) == 0)
                     vm = NULL;
                 VIR_FREE(wdEvent);
diff --git a/src/remote/qemu_protocol.x b/src/remote/qemu_protocol.x
index 3279405..39f9adf 100644
--- a/src/remote/qemu_protocol.x
+++ b/src/remote/qemu_protocol.x
@@ -52,9 +52,14 @@ const QEMU_PROGRAM = 0x20008087;
 const QEMU_PROTOCOL_VERSION = 1;
 
 enum qemu_procedure {
-    /* Each function must have a two-word comment.  The first word is
+    /* Each function must have a three-word comment.  The first word is
      * whether gendispatch.pl handles daemon, the second whether
-     * it handles src/remote.  */
-    QEMU_PROC_MONITOR_COMMAND = 1, /* skipgen skipgen */
-    QEMU_PROC_DOMAIN_ATTACH = 2 /* autogen autogen */
+     * it handles src/remote.
+     * The last argument describes priority of API. There are two accepted
+     * values: low, high; Each API that might eventually access hypervisor's
+     * monitor (and thus block) MUST fall into low priority. However, there
+     * are some exceptions to this rule, e.g. domainDestroy. Other APIs MAY
+     * be marked as high priority. If in doubt, it's safe to choose low. */
+    QEMU_PROC_MONITOR_COMMAND = 1, /* skipgen skipgen priority:low */
+    QEMU_PROC_DOMAIN_ATTACH = 2 /* autogen autogen priority:low */
 };
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 8f68808..3dd23cc 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2201,290 +2201,300 @@ const REMOTE_PROGRAM = 0x20008086;
 const REMOTE_PROTOCOL_VERSION = 1;
 
 enum remote_procedure {
-    /* Each function must have a two-word comment.  The first word is
+    /* Each function must have a three-word comment.  The first word is
      * whether gendispatch.pl handles daemon, the second whether
      * it handles src/remote.  Additional flags can be specified after a
      * pipe.
+     * The last argument describes priority of API. There are two accepted
+     * values: low, high; Each API that might eventually access hypervisor's
+     * monitor (and thus block) MUST fall into low priority. However, there
+     * are some exceptions to this rule, e.g. domainDestroy. Other APIs MAY
+     * be marked as high priority. If in doubt, it's safe to choose low.
      *
      * The (readstream|writestream)@<offset> flag lets daemon and src/remote
      * create a stream.  The direction is defined from the src/remote point
      * of view.  A readstream transfers data from daemon to src/remote.  The
      * <offset> specifies at which offset the stream parameter is inserted
      * in the function parameter list. */
-    REMOTE_PROC_OPEN = 1, /* skipgen skipgen */
-    REMOTE_PROC_CLOSE = 2, /* skipgen skipgen */
-    REMOTE_PROC_GET_TYPE = 3, /* autogen skipgen */
-    REMOTE_PROC_GET_VERSION = 4, /* autogen autogen */
-    REMOTE_PROC_GET_MAX_VCPUS = 5, /* autogen autogen */
-    REMOTE_PROC_NODE_GET_INFO = 6, /* autogen autogen */
-    REMOTE_PROC_GET_CAPABILITIES = 7, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_ATTACH_DEVICE = 8, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_CREATE = 9, /* autogen skipgen */
-    REMOTE_PROC_DOMAIN_CREATE_XML = 10, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_DEFINE_XML = 11, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_XML_DESC = 14, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_INFO = 16, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_MAX_MEMORY = 17, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_MAX_VCPUS = 18, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_OS_TYPE = 19, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_VCPUS = 20, /* skipgen skipgen */
-
-    REMOTE_PROC_LIST_DEFINED_DOMAINS = 21, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_LOOKUP_BY_ID = 22, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME = 23, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID = 24, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_DEFINED_DOMAINS = 25, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_PIN_VCPU = 26, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_REBOOT = 27, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_RESUME = 28, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_AUTOSTART = 29, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_MAX_MEMORY = 30, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_SET_MEMORY = 31, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_VCPUS = 32, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SHUTDOWN = 33, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SUSPEND = 34, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_UNDEFINE = 35, /* autogen autogen */
-    REMOTE_PROC_LIST_DEFINED_NETWORKS = 36, /* autogen autogen */
-    REMOTE_PROC_LIST_DOMAINS = 37, /* autogen skipgen */
-    REMOTE_PROC_LIST_NETWORKS = 38, /* autogen autogen */
-    REMOTE_PROC_NETWORK_CREATE = 39, /* autogen autogen */
-    REMOTE_PROC_NETWORK_CREATE_XML = 40, /* autogen autogen */
-
-    REMOTE_PROC_NETWORK_DEFINE_XML = 41, /* autogen autogen */
-    REMOTE_PROC_NETWORK_DESTROY = 42, /* autogen autogen */
-    REMOTE_PROC_NETWORK_GET_XML_DESC = 43, /* autogen autogen */
-    REMOTE_PROC_NETWORK_GET_AUTOSTART = 44, /* autogen autogen */
-    REMOTE_PROC_NETWORK_GET_BRIDGE_NAME = 45, /* autogen autogen */
-    REMOTE_PROC_NETWORK_LOOKUP_BY_NAME = 46, /* autogen autogen */
-    REMOTE_PROC_NETWORK_LOOKUP_BY_UUID = 47, /* autogen autogen */
-    REMOTE_PROC_NETWORK_SET_AUTOSTART = 48, /* autogen autogen */
-    REMOTE_PROC_NETWORK_UNDEFINE = 49, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_DEFINED_NETWORKS = 50, /* autogen autogen */
-
-    REMOTE_PROC_NUM_OF_DOMAINS = 51, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_NETWORKS = 52, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_CORE_DUMP = 53, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_RESTORE = 54, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SAVE = 55, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE = 56, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57, /* skipgen autogen */
-    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58, /* autogen autogen */
-    REMOTE_PROC_GET_HOSTNAME = 59, /* autogen autogen */
-    REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MIGRATE_FINISH = 63, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_BLOCK_STATS = 64, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_INTERFACE_STATS = 65, /* autogen autogen */
-    REMOTE_PROC_AUTH_LIST = 66, /* skipgen skipgen */
-    REMOTE_PROC_AUTH_SASL_INIT = 67, /* skipgen skipgen */
-    REMOTE_PROC_AUTH_SASL_START = 68, /* skipgen skipgen */
-    REMOTE_PROC_AUTH_SASL_STEP = 69, /* skipgen skipgen */
-    REMOTE_PROC_AUTH_POLKIT = 70, /* skipgen skipgen */
-
-    REMOTE_PROC_NUM_OF_STORAGE_POOLS = 71, /* autogen autogen */
-    REMOTE_PROC_LIST_STORAGE_POOLS = 72, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_DEFINED_STORAGE_POOLS = 73, /* autogen autogen */
-    REMOTE_PROC_LIST_DEFINED_STORAGE_POOLS = 74, /* autogen autogen */
-    REMOTE_PROC_FIND_STORAGE_POOL_SOURCES = 75, /* autogen skipgen */
-    REMOTE_PROC_STORAGE_POOL_CREATE_XML = 76, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_DEFINE_XML = 77, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_CREATE = 78, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_BUILD = 79, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_DESTROY = 80, /* autogen autogen */
-
-    REMOTE_PROC_STORAGE_POOL_DELETE = 81, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_UNDEFINE = 82, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_REFRESH = 83, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME = 84, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID = 85, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME = 86, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_GET_INFO = 87, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_GET_XML_DESC = 88, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART = 89, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART = 90, /* autogen autogen */
-
-    REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES = 91, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES = 92, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_CREATE_XML = 93, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_DELETE = 94, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME = 95, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY = 96, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_GET_INFO = 98, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_GET_XML_DESC = 99, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_GET_PATH = 100, /* autogen autogen */
-
-    REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101, /* autogen skipgen */
-    REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE = 107, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 = 108, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 = 109, /* autogen autogen */
-    REMOTE_PROC_GET_URI = 110, /* autogen skipgen */
-
-    REMOTE_PROC_NODE_NUM_OF_DEVICES = 111, /* autogen autogen */
-    REMOTE_PROC_NODE_LIST_DEVICES = 112, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME = 113, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_GET_XML_DESC = 114, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, /* skipgen autogen */
-    REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_DETTACH = 118, /* autogen skipgen */
-    REMOTE_PROC_NODE_DEVICE_RE_ATTACH = 119, /* autogen skipgen */
-    REMOTE_PROC_NODE_DEVICE_RESET = 120, /* autogen skipgen */
-
-    REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL = 121, /* skipgen skipgen */
-    REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122, /* skipgen skipgen */
-    REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123, /* autogen autogen */
-    REMOTE_PROC_NODE_DEVICE_DESTROY = 124, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM = 125, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_INTERFACES = 126, /* autogen autogen */
-    REMOTE_PROC_LIST_INTERFACES = 127, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME = 128, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING = 129, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_GET_XML_DESC = 130, /* autogen autogen */
-
-    REMOTE_PROC_INTERFACE_DEFINE_XML = 131, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_UNDEFINE = 132, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_CREATE = 133, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_DESTROY = 134, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_XML_FROM_NATIVE = 135, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137, /* autogen autogen */
-    REMOTE_PROC_LIST_DEFINED_INTERFACES = 138, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_SECRETS = 139, /* autogen autogen */
-    REMOTE_PROC_LIST_SECRETS = 140, /* autogen autogen */
-
-    REMOTE_PROC_SECRET_LOOKUP_BY_UUID = 141, /* autogen autogen */
-    REMOTE_PROC_SECRET_DEFINE_XML = 142, /* autogen autogen */
-    REMOTE_PROC_SECRET_GET_XML_DESC = 143, /* autogen autogen */
-    REMOTE_PROC_SECRET_SET_VALUE = 144, /* autogen autogen */
-    REMOTE_PROC_SECRET_GET_VALUE = 145, /* skipgen skipgen */
-    REMOTE_PROC_SECRET_UNDEFINE = 146, /* autogen autogen */
-    REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148, /* autogen autogen | writestream 1 */
-    REMOTE_PROC_IS_SECURE = 149, /* autogen skipgen */
-    REMOTE_PROC_DOMAIN_IS_ACTIVE = 150, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_IS_PERSISTENT = 151, /* autogen autogen */
-    REMOTE_PROC_NETWORK_IS_ACTIVE = 152, /* autogen autogen */
-    REMOTE_PROC_NETWORK_IS_PERSISTENT = 153, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154, /* autogen autogen */
-    REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_IS_ACTIVE = 156, /* autogen autogen */
-    REMOTE_PROC_GET_LIB_VERSION = 157, /* autogen autogen */
-    REMOTE_PROC_CPU_COMPARE = 158, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MEMORY_STATS = 159, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161, /* autogen autogen */
-    REMOTE_PROC_CPU_BASELINE = 162, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_ABORT_JOB = 164, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_WIPE = 165, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY = 167, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY = 168, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_EVENT_REBOOT = 169, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE = 170, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_EVENT_WATCHDOG = 171, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_EVENT_IO_ERROR = 172, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_EVENT_GRAPHICS = 173, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS = 174, /* autogen autogen */
-    REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME = 175, /* autogen autogen */
-    REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID = 176, /* autogen autogen */
-    REMOTE_PROC_NWFILTER_GET_XML_DESC = 177, /* autogen autogen */
-    REMOTE_PROC_NUM_OF_NWFILTERS = 178, /* autogen autogen */
-    REMOTE_PROC_LIST_NWFILTERS = 179, /* autogen autogen */
-    REMOTE_PROC_NWFILTER_DEFINE_XML = 180, /* autogen autogen */
-
-    REMOTE_PROC_NWFILTER_UNDEFINE = 181, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MANAGED_SAVE = 182, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE = 183, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE = 184, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML = 185, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC = 186, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_NUM = 187, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES = 188, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME = 189, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT = 190, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, /* autogen autogen | readstream 2 */
-    REMOTE_PROC_DOMAIN_IS_UPDATED = 202, /* autogen autogen */
-    REMOTE_PROC_GET_SYSINFO = 203, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 205, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207, /* autogen autogen */
-    REMOTE_PROC_STORAGE_VOL_UPLOAD = 208, /* autogen autogen | writestream 1 */
-    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209, /* autogen autogen | readstream 1 */
-    REMOTE_PROC_DOMAIN_INJECT_NMI = 210, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_SCREENSHOT = 211, /* autogen autogen | readstream 1 */
-    REMOTE_PROC_DOMAIN_GET_STATE = 212, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 = 213, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 = 214, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 = 215, /* autogen skipgen | writestream 1 */
-    REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 = 216, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 = 217, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 = 218, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS = 219, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_CHANGE_BEGIN = 220, /* autogen autogen */
-
-    REMOTE_PROC_INTERFACE_CHANGE_COMMIT = 221, /* autogen autogen */
-    REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK = 222, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 223, /* skipgen autogen */
-    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SEND_KEY = 226, /* autogen autogen */
-    REMOTE_PROC_NODE_GET_CPU_STATS = 227, /* skipgen skipgen */
-    REMOTE_PROC_NODE_GET_MEMORY_STATS = 228, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_GET_CONTROL_INFO = 229, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO = 230, /* skipgen skipgen */
-
-    REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS = 231, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SAVE_FLAGS = 232, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_RESTORE_FLAGS = 233, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_DESTROY_FLAGS = 234, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML = 236, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT = 237, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO = 238, /* skipgen skipgen */
-    REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED = 239, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_BLOCK_PULL = 240, /* autogen autogen */
-
-    REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB = 241 /* skipgen skipgen */
+    REMOTE_PROC_OPEN = 1, /* skipgen skipgen priority:high */
+    REMOTE_PROC_CLOSE = 2, /* skipgen skipgen priority:high */
+    REMOTE_PROC_GET_TYPE = 3, /* autogen skipgen priority:high */
+    REMOTE_PROC_GET_VERSION = 4, /* autogen autogen priority:high */
+    REMOTE_PROC_GET_MAX_VCPUS = 5, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_GET_INFO = 6, /* autogen autogen priority:high */
+    REMOTE_PROC_GET_CAPABILITIES = 7, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_ATTACH_DEVICE = 8, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_CREATE = 9, /* autogen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_CREATE_XML = 10, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_DEFINE_XML = 11, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_DESTROY = 12, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_DETACH_DEVICE = 13, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_XML_DESC = 14, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_AUTOSTART = 15, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_INFO = 16, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_MAX_MEMORY = 17, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_MAX_VCPUS = 18, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_OS_TYPE = 19, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_VCPUS = 20, /* skipgen skipgen priority:low */
+
+    REMOTE_PROC_LIST_DEFINED_DOMAINS = 21, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_LOOKUP_BY_ID = 22, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME = 23, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID = 24, /* autogen autogen priority:high */
+    REMOTE_PROC_NUM_OF_DEFINED_DOMAINS = 25, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_PIN_VCPU = 26, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_REBOOT = 27, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_RESUME = 28, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_AUTOSTART = 29, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_MAX_MEMORY = 30, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_SET_MEMORY = 31, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_VCPUS = 32, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SHUTDOWN = 33, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SUSPEND = 34, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_UNDEFINE = 35, /* autogen autogen priority:low */
+    REMOTE_PROC_LIST_DEFINED_NETWORKS = 36, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_DOMAINS = 37, /* autogen skipgen priority:high */
+    REMOTE_PROC_LIST_NETWORKS = 38, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_CREATE = 39, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_CREATE_XML = 40, /* autogen autogen priority:high */
+
+    REMOTE_PROC_NETWORK_DEFINE_XML = 41, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_DESTROY = 42, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_GET_XML_DESC = 43, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_GET_AUTOSTART = 44, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_GET_BRIDGE_NAME = 45, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_LOOKUP_BY_NAME = 46, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_LOOKUP_BY_UUID = 47, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_SET_AUTOSTART = 48, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_UNDEFINE = 49, /* autogen autogen priority:high */
+    REMOTE_PROC_NUM_OF_DEFINED_NETWORKS = 50, /* autogen autogen priority:high */
+
+    REMOTE_PROC_NUM_OF_DOMAINS = 51, /* autogen autogen priority:high */
+    REMOTE_PROC_NUM_OF_NETWORKS = 52, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_CORE_DUMP = 53, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_RESTORE = 54, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SAVE = 55, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE = 56, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS = 57, /* skipgen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS = 58, /* autogen autogen priority:low */
+    REMOTE_PROC_GET_HOSTNAME = 59, /* autogen autogen priority:low */
+    REMOTE_PROC_SUPPORTS_FEATURE = 60, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE = 61, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_PERFORM = 62, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_FINISH = 63, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_BLOCK_STATS = 64, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_INTERFACE_STATS = 65, /* autogen autogen priority:high */
+    REMOTE_PROC_AUTH_LIST = 66, /* skipgen skipgen priority:high */
+    REMOTE_PROC_AUTH_SASL_INIT = 67, /* skipgen skipgen priority:high */
+    REMOTE_PROC_AUTH_SASL_START = 68, /* skipgen skipgen priority:high */
+    REMOTE_PROC_AUTH_SASL_STEP = 69, /* skipgen skipgen priority:high */
+    REMOTE_PROC_AUTH_POLKIT = 70, /* skipgen skipgen priority:high */
+
+    REMOTE_PROC_NUM_OF_STORAGE_POOLS = 71, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_STORAGE_POOLS = 72, /* autogen autogen priority:low */
+    REMOTE_PROC_NUM_OF_DEFINED_STORAGE_POOLS = 73, /* autogen autogen priority:low */
+    REMOTE_PROC_LIST_DEFINED_STORAGE_POOLS = 74, /* autogen autogen priority:low */
+    REMOTE_PROC_FIND_STORAGE_POOL_SOURCES = 75, /* autogen skipgen priority:low */
+    REMOTE_PROC_STORAGE_POOL_CREATE_XML = 76, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_DEFINE_XML = 77, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_CREATE = 78, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_BUILD = 79, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_DESTROY = 80, /* autogen autogen priority:low */
+
+    REMOTE_PROC_STORAGE_POOL_DELETE = 81, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_UNDEFINE = 82, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_REFRESH = 83, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME = 84, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID = 85, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME = 86, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_GET_INFO = 87, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_GET_XML_DESC = 88, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART = 89, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART = 90, /* autogen autogen priority:low */
+
+    REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES = 91, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES = 92, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_CREATE_XML = 93, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_DELETE = 94, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME = 95, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY = 96, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH = 97, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_GET_INFO = 98, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_GET_XML_DESC = 99, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_GET_PATH = 100, /* autogen autogen priority:low */
+
+    REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101, /* autogen skipgen priority:high */
+    REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE = 107, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 = 108, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 = 109, /* autogen autogen priority:low */
+    REMOTE_PROC_GET_URI = 110, /* autogen skipgen priority:high */
+
+    REMOTE_PROC_NODE_NUM_OF_DEVICES = 111, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_LIST_DEVICES = 112, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME = 113, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_GET_XML_DESC = 114, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_GET_PARENT = 115, /* skipgen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS = 116, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_LIST_CAPS = 117, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_DETTACH = 118, /* autogen skipgen priority:high */
+    REMOTE_PROC_NODE_DEVICE_RE_ATTACH = 119, /* autogen skipgen priority:high */
+    REMOTE_PROC_NODE_DEVICE_RESET = 120, /* autogen skipgen priority:high */
+
+    REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL = 121, /* skipgen skipgen priority:low */
+    REMOTE_PROC_NODE_GET_SECURITY_MODEL = 122, /* skipgen skipgen priority:high */
+    REMOTE_PROC_NODE_DEVICE_CREATE_XML = 123, /* autogen autogen priority:high */
+    REMOTE_PROC_NODE_DEVICE_DESTROY = 124, /* autogen autogen priority:high */
+    REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM = 125, /* autogen autogen priority:low */
+    REMOTE_PROC_NUM_OF_INTERFACES = 126, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_INTERFACES = 127, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME = 128, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING = 129, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_GET_XML_DESC = 130, /* autogen autogen priority:high */
+
+    REMOTE_PROC_INTERFACE_DEFINE_XML = 131, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_UNDEFINE = 132, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_CREATE = 133, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_DESTROY = 134, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_XML_FROM_NATIVE = 135, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136, /* autogen autogen priority:low */
+    REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_DEFINED_INTERFACES = 138, /* autogen autogen priority:high */
+    REMOTE_PROC_NUM_OF_SECRETS = 139, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_SECRETS = 140, /* autogen autogen priority:high */
+
+    REMOTE_PROC_SECRET_LOOKUP_BY_UUID = 141, /* autogen autogen priority:high */
+    REMOTE_PROC_SECRET_DEFINE_XML = 142, /* autogen autogen priority:high */
+    REMOTE_PROC_SECRET_GET_XML_DESC = 143, /* autogen autogen priority:high */
+    REMOTE_PROC_SECRET_SET_VALUE = 144, /* autogen autogen priority:high */
+    REMOTE_PROC_SECRET_GET_VALUE = 145, /* skipgen skipgen priority:high */
+    REMOTE_PROC_SECRET_UNDEFINE = 146, /* autogen autogen priority:high */
+    REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148, /* autogen autogen | writestream 1 priority:low */
+    REMOTE_PROC_IS_SECURE = 149, /* autogen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_IS_ACTIVE = 150, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_IS_PERSISTENT = 151, /* autogen autogen priority:low */
+    REMOTE_PROC_NETWORK_IS_ACTIVE = 152, /* autogen autogen priority:high */
+    REMOTE_PROC_NETWORK_IS_PERSISTENT = 153, /* autogen autogen priority:high */
+    REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155, /* autogen autogen priority:low */
+    REMOTE_PROC_INTERFACE_IS_ACTIVE = 156, /* autogen autogen priority:high */
+    REMOTE_PROC_GET_LIB_VERSION = 157, /* autogen autogen priority:low */
+    REMOTE_PROC_CPU_COMPARE = 158, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_MEMORY_STATS = 159, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161, /* autogen autogen priority:low */
+    REMOTE_PROC_CPU_BASELINE = 162, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_JOB_INFO = 163, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_ABORT_JOB = 164, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_WIPE = 165, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME = 166, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY = 167, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY = 168, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_REBOOT = 169, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE = 170, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_EVENT_WATCHDOG = 171, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_IO_ERROR = 172, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_GRAPHICS = 173, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS = 174, /* autogen autogen priority:low */
+    REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME = 175, /* autogen autogen priority:high */
+    REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID = 176, /* autogen autogen priority:high */
+    REMOTE_PROC_NWFILTER_GET_XML_DESC = 177, /* autogen autogen priority:high */
+    REMOTE_PROC_NUM_OF_NWFILTERS = 178, /* autogen autogen priority:high */
+    REMOTE_PROC_LIST_NWFILTERS = 179, /* autogen autogen priority:high */
+    REMOTE_PROC_NWFILTER_DEFINE_XML = 180, /* autogen autogen priority:high */
+
+    REMOTE_PROC_NWFILTER_UNDEFINE = 181, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_MANAGED_SAVE = 182, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE = 183, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE = 184, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML = 185, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC = 186, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_NUM = 187, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES = 188, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME = 189, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT = 190, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT = 191, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT = 192, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, /* autogen autogen | readstream 2 priority:low */
+    REMOTE_PROC_DOMAIN_IS_UPDATED = 202, /* autogen autogen priority:low */
+    REMOTE_PROC_GET_SYSINFO = 203, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS = 204, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 205, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207, /* autogen autogen priority:low */
+    REMOTE_PROC_STORAGE_VOL_UPLOAD = 208, /* autogen autogen | writestream 1 priority:low */
+    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209, /* autogen autogen | readstream 1 priority:low */
+    REMOTE_PROC_DOMAIN_INJECT_NMI = 210, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_SCREENSHOT = 211, /* autogen autogen | readstream 1 priority:low */
+    REMOTE_PROC_DOMAIN_GET_STATE = 212, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 = 213, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 = 214, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 = 215, /* autogen skipgen | writestream 1 priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 = 216, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 = 217, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 = 218, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS = 219, /* autogen autogen priority:low */
+    REMOTE_PROC_INTERFACE_CHANGE_BEGIN = 220, /* autogen autogen priority:high */
+
+    REMOTE_PROC_INTERFACE_CHANGE_COMMIT = 221, /* autogen autogen priority:high */
+    REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK = 222, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 223, /* skipgen autogen priority:low */
+    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SEND_KEY = 226, /* autogen autogen priority:low */
+    REMOTE_PROC_NODE_GET_CPU_STATS = 227, /* skipgen skipgen priority:high */
+    REMOTE_PROC_NODE_GET_MEMORY_STATS = 228, /* skipgen skipgen priority:high */
+    REMOTE_PROC_DOMAIN_GET_CONTROL_INFO = 229, /* autogen autogen priority:high */
+    REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO = 230, /* skipgen skipgen priority:low */
+
+    REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS = 231, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SAVE_FLAGS = 232, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_RESTORE_FLAGS = 233, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_DESTROY_FLAGS = 234, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML = 236, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT = 237, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO = 238, /* skipgen skipgen priority:low */
+    REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED = 239, /* autogen autogen priority:low */
+    REMOTE_PROC_DOMAIN_BLOCK_PULL = 240, /* autogen autogen priority:low */
+
+    REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB = 241 /* skipgen skipgen priority:low */
 
     /*
      * Notice how the entries are grouped in sets of 10 ?
      * Nice isn't it. Please keep it this way when adding more.
      *
-     * Each function must have a two-word comment.  The first word is
+     * Each function must have a three-word comment.  The first word is
      * whether gendispatch.pl handles daemon, the second whether
      * it handles src/remote.  Additional flags can be specified after a
      * pipe.
+     * The last argument describes priority of API. There are two accepted
+     * values: low, high; Each API that might eventually access hypervisor's
+     * monitor (and thus block) MUST fall into low priority. However, there
+     * are some exceptions to this rule, e.g. domainDestroy. Other APIs MAY
+     * be marked as high priority. If in doubt, it's safe to choose low.
      *
      * The (readstream|writestream)@<offset> flag lets daemon and src/remote
      * create a stream.  The direction is defined from the src/remote point
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 0d344e8..1ca3bc0 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -146,12 +146,13 @@ while (<PROTOCOL>) {
         }
 
         if ($opt_b or $opt_k) {
-            if (!($flags =~ m/^\s*\/\*\s*(\S+)\s+(\S+)\s*(.*)\*\/\s*$/)) {
+            if (!($flags =~ m/^\s*\/\*\s*(\S+)\s+(\S+)\s*(.*)\s+priority:(\S+)\s*\*\/\s*$/)) {
                 die "invalid generator flags for ${procprefix}_PROC_${name}"
             }
 
             my $genmode = $opt_b ? $1 : $2;
             my $genflags = $3;
+            my $priority = $4;
 
             if ($genmode eq "autogen") {
                 push(@autogen, $ProcName);
@@ -171,6 +172,16 @@ while (<PROTOCOL>) {
             } else {
                 $calls{$name}->{streamflag} = "none";
             }
+
+            # for now, we distinguish only two levels of prioroty:
+            # low (0) and high (1)
+            if ($priority eq "high") {
+                $calls{$name}->{priority} = 1;
+            } elsif ($priority eq "low") {
+                $calls{$name}->{priority} = 0;
+            } else {
+                die "invalid priority ${priority} for ${procprefix}_PROC_${name}"
+            }
         }
 
         $calls[$id] = $calls{$name};
@@ -259,6 +270,7 @@ if ($opt_d) {
         print "$_:\n";
         print "        name $calls{$_}->{name} ($calls{$_}->{ProcName})\n";
         print "        $calls{$_}->{args} -> $calls{$_}->{ret}\n";
+        print "        priority -> $calls{$_}->{priority}\n";
     }
 }
 
@@ -927,7 +939,7 @@ elsif ($opt_b) {
 
     print "virNetServerProgramProc ${structprefix}Procs[] = {\n";
     for ($id = 0 ; $id <= $#calls ; $id++) {
-	my ($comment, $name, $argtype, $arglen, $argfilter, $retlen, $retfilter);
+	my ($comment, $name, $argtype, $arglen, $argfilter, $retlen, $retfilter, $priority);
 
 	if (defined $calls[$id] && !$calls[$id]->{msg}) {
 	    $comment = "/* Method $calls[$id]->{ProcName} => $id */";
@@ -950,7 +962,9 @@ elsif ($opt_b) {
 	    $retfilter = "xdr_void";
 	}
 
-	print "{ $comment\n   ${name},\n   $arglen,\n   (xdrproc_t)$argfilter,\n   $retlen,\n   (xdrproc_t)$retfilter,\n   true \n},\n";
+    $priority = defined $calls[$id]->{priority} ? $calls[$id]->{priority} : 0;
+
+	print "{ $comment\n   ${name},\n   $arglen,\n   (xdrproc_t)$argfilter,\n   $retlen,\n   (xdrproc_t)$retfilter,\n   true,\n   $priority\n},\n";
     }
     print "};\n";
     print "size_t ${structprefix}NProcs = ARRAY_CARDINALITY(${structprefix}Procs);\n";
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 1a49dbb..b8150b7 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -72,9 +72,12 @@ struct _virNetServer {
     virMutex lock;
 
     virThreadPoolPtr workers;
+    virThreadPoolPtr prio_workers;
 
     bool privileged;
 
+    virNetServerPriorityProcFunc prio_func;
+
     size_t nsignals;
     virNetServerSignalPtr *signals;
     int sigread;
@@ -182,6 +185,7 @@ static int virNetServerDispatchNewMessage(virNetServerClientPtr client,
 {
     virNetServerPtr srv = opaque;
     virNetServerJobPtr job;
+    bool priority = false;
     int ret;
 
     VIR_DEBUG("server=%p client=%p message=%p",
@@ -192,11 +196,25 @@ static int virNetServerDispatchNewMessage(virNetServerClientPtr client,
         return -1;
     }
 
+    if (srv->prio_func)
+        priority = srv->prio_func(&msg->header);
+
     job->client = client;
     job->msg = msg;
 
     virNetServerLock(srv);
-    if ((ret = virThreadPoolSendJob(srv->workers, job)) < 0)
+    ret = virThreadPoolSendJob(srv->workers, priority, job);
+    if (ret < -1) {
+        goto cleanup;
+    } else if (ret == -1) {
+        /* try placing job into priority pool */
+        VIR_DEBUG("worker pool full, placing proc %d into priority pool",
+                  msg->header.proc);
+        ret = virThreadPoolSendJob(srv->prio_workers, false, job);
+    }
+
+cleanup:
+    if (ret < 0)
         VIR_FREE(job);
     virNetServerUnlock(srv);
 
@@ -277,7 +295,9 @@ virNetServerPtr virNetServerNew(size_t min_workers,
                                 size_t max_clients,
                                 const char *mdnsGroupName,
                                 bool connectDBus ATTRIBUTE_UNUSED,
-                                virNetServerClientInitHook clientInitHook)
+                                virNetServerClientInitHook clientInitHook,
+                                size_t priority_workers,
+                                virNetServerPriorityProcFunc func)
 {
     virNetServerPtr srv;
     struct sigaction sig_action;
@@ -294,6 +314,13 @@ virNetServerPtr virNetServerNew(size_t min_workers,
                                           srv)))
         goto error;
 
+    if (!(srv->prio_workers = virThreadPoolNew(priority_workers,
+                                               priority_workers,
+                                               virNetServerHandleJob,
+                                               srv)))
+        goto error;
+
+    srv->prio_func = func;
     srv->nclients_max = max_clients;
     srv->sigwrite = srv->sigread = -1;
     srv->clientInitHook = clientInitHook;
@@ -759,6 +786,7 @@ void virNetServerFree(virNetServerPtr srv)
         virNetServerServiceToggle(srv->services[i], false);
 
     virThreadPoolFree(srv->workers);
+    virThreadPoolFree(srv->prio_workers);
 
     for (i = 0 ; i < srv->nsignals ; i++) {
         sigaction(srv->signals[i]->signum, &srv->signals[i]->oldaction, NULL);
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 324cfb7..1bdc105 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -37,12 +37,16 @@
 typedef int (*virNetServerClientInitHook)(virNetServerPtr srv,
                                           virNetServerClientPtr client);
 
+typedef unsigned int (*virNetServerPriorityProcFunc) (virNetMessageHeaderPtr hdr);
+
 virNetServerPtr virNetServerNew(size_t min_workers,
                                 size_t max_workers,
                                 size_t max_clients,
                                 const char *mdnsGroupName,
                                 bool connectDBus,
-                                virNetServerClientInitHook clientInitHook);
+                                virNetServerClientInitHook clientInitHook,
+                                size_t priority_workers,
+                                virNetServerPriorityProcFunc func);
 
 typedef int (*virNetServerAutoShutdownFunc)(virNetServerPtr srv, void *opaque);
 
diff --git a/src/rpc/virnetserverprogram.h b/src/rpc/virnetserverprogram.h
index ca31b7e..75d969c 100644
--- a/src/rpc/virnetserverprogram.h
+++ b/src/rpc/virnetserverprogram.h
@@ -53,6 +53,7 @@ struct _virNetServerProgramProc {
     size_t ret_len;
     xdrproc_t ret_filter;
     bool needAuth;
+    unsigned int priority;
 };
 
 virNetServerProgramPtr virNetServerProgramNew(unsigned program,
diff --git a/src/util/threadpool.c b/src/util/threadpool.c
index 8217591..ad2d249 100644
--- a/src/util/threadpool.c
+++ b/src/util/threadpool.c
@@ -185,27 +185,41 @@ void virThreadPoolFree(virThreadPoolPtr pool)
     VIR_FREE(pool);
 }
 
+/*
+ * @only_if_free - place job in pool iff there is
+ * a free worker(s).
+ *
+ * Return: 0 on success,
+ * -1 if no free worker available but requested
+ * -2 otherwise
+ */
 int virThreadPoolSendJob(virThreadPoolPtr pool,
+                         bool only_if_free,
                          void *jobData)
 {
     virThreadPoolJobPtr job;
+    int ret = -2;
 
     virMutexLock(&pool->mutex);
     if (pool->quit)
         goto error;
 
-    if (pool->freeWorkers == 0 &&
-        pool->nWorkers < pool->maxWorkers) {
-        if (VIR_EXPAND_N(pool->workers, pool->nWorkers, 1) < 0) {
-            virReportOOMError();
-            goto error;
-        }
+    if (pool->freeWorkers == 0) {
+        if (pool->nWorkers < pool->maxWorkers) {
+            if (VIR_EXPAND_N(pool->workers, pool->nWorkers, 1) < 0) {
+                virReportOOMError();
+                goto error;
+            }
 
-        if (virThreadCreate(&pool->workers[pool->nWorkers - 1],
-                            true,
-                            virThreadPoolWorker,
-                            pool) < 0) {
-            pool->nWorkers--;
+            if (virThreadCreate(&pool->workers[pool->nWorkers - 1],
+                                true,
+                                virThreadPoolWorker,
+                                pool) < 0) {
+                pool->nWorkers--;
+                goto error;
+            }
+        } else if (only_if_free) {
+            ret = -1;
             goto error;
         }
     }
@@ -227,5 +241,5 @@ int virThreadPoolSendJob(virThreadPoolPtr pool,
 
 error:
     virMutexUnlock(&pool->mutex);
-    return -1;
+    return ret;
 }
diff --git a/src/util/threadpool.h b/src/util/threadpool.h
index 8b8c676..d791b55 100644
--- a/src/util/threadpool.h
+++ b/src/util/threadpool.h
@@ -41,6 +41,7 @@ virThreadPoolPtr virThreadPoolNew(size_t minWorkers,
 void virThreadPoolFree(virThreadPoolPtr pool);
 
 int virThreadPoolSendJob(virThreadPoolPtr pool,
+                         bool only_if_free,
                          void *jobdata) ATTRIBUTE_NONNULL(1)
                                         ATTRIBUTE_RETURN_CHECK;
 
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]