提交 2fd5880b 编写于 作者: M Martin Kletzander

conf: De-duplicate scheduling policy enums

Since adding the support for scheduler policy settings in commit
8680ea97, there are two enums with the same information.  That was
caused by rewriting the patch since first draft.

Find out thanks to clang, but there was no impact whatsoever.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 b3ea0a8f
...@@ -772,13 +772,6 @@ VIR_ENUM_IMPL(virDomainLoader, ...@@ -772,13 +772,6 @@ VIR_ENUM_IMPL(virDomainLoader,
"rom", "rom",
"pflash") "pflash")
VIR_ENUM_IMPL(virDomainThreadSched, VIR_DOMAIN_THREAD_SCHED_LAST,
"other", /* default */
"batch",
"idle",
"fifo",
"rr")
/* Internal mapping: subset of block job types that can be present in /* Internal mapping: subset of block job types that can be present in
* <mirror> XML (remaining types are not two-phase). */ * <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob) VIR_ENUM_DECL(virDomainBlockJob)
...@@ -12894,7 +12887,7 @@ virDomainThreadSchedParse(xmlNodePtr node, ...@@ -12894,7 +12887,7 @@ virDomainThreadSchedParse(xmlNodePtr node,
virDomainThreadSchedParamPtr sp) virDomainThreadSchedParamPtr sp)
{ {
char *tmp = NULL; char *tmp = NULL;
int sched = 0; int pol = 0;
tmp = virXMLPropString(node, name); tmp = virXMLPropString(node, name);
if (!tmp) { if (!tmp) {
...@@ -12919,16 +12912,17 @@ virDomainThreadSchedParse(xmlNodePtr node, ...@@ -12919,16 +12912,17 @@ virDomainThreadSchedParse(xmlNodePtr node,
tmp = virXMLPropString(node, "scheduler"); tmp = virXMLPropString(node, "scheduler");
if (tmp) { if (tmp) {
if ((sched = virDomainThreadSchedTypeFromString(tmp)) <= 0) { if ((pol = virProcessSchedPolicyTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid scheduler attribute: '%s'"), _("Invalid scheduler attribute: '%s'"),
tmp); tmp);
goto error; goto error;
} }
sp->scheduler = sched; sp->policy = pol;
VIR_FREE(tmp); VIR_FREE(tmp);
if (sp->scheduler >= VIR_DOMAIN_THREAD_SCHED_FIFO) { if (sp->policy == VIR_PROC_POLICY_FIFO ||
sp->policy == VIR_PROC_POLICY_RR) {
tmp = virXMLPropString(node, "priority"); tmp = virXMLPropString(node, "priority");
if (!tmp) { if (!tmp) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
...@@ -19915,7 +19909,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -19915,7 +19909,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (!(ids = virBitmapFormat(sp->ids))) if (!(ids = virBitmapFormat(sp->ids)))
goto error; goto error;
virBufferAsprintf(buf, "<vcpusched vcpus='%s' scheduler='%s'", virBufferAsprintf(buf, "<vcpusched vcpus='%s' scheduler='%s'",
ids, virDomainThreadSchedTypeToString(sp->scheduler)); ids, virProcessSchedPolicyTypeToString(sp->policy));
VIR_FREE(ids); VIR_FREE(ids);
if (sp->priority) if (sp->priority)
...@@ -19930,7 +19924,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -19930,7 +19924,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (!(ids = virBitmapFormat(sp->ids))) if (!(ids = virBitmapFormat(sp->ids)))
goto error; goto error;
virBufferAsprintf(buf, "<iothreadsched iothreads='%s' scheduler='%s'", virBufferAsprintf(buf, "<iothreadsched iothreads='%s' scheduler='%s'",
ids, virDomainThreadSchedTypeToString(sp->scheduler)); ids, virProcessSchedPolicyTypeToString(sp->policy));
VIR_FREE(ids); VIR_FREE(ids);
if (sp->priority) if (sp->priority)
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
# include "virbitmap.h" # include "virbitmap.h"
# include "virstoragefile.h" # include "virstoragefile.h"
# include "virseclabel.h" # include "virseclabel.h"
# include "virprocess.h"
/* forward declarations of all device types, required by /* forward declarations of all device types, required by
* virDomainDeviceDef * virDomainDeviceDef
...@@ -1813,21 +1814,11 @@ typedef enum { ...@@ -1813,21 +1814,11 @@ typedef enum {
VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
} virDomainCpuPlacementMode; } virDomainCpuPlacementMode;
typedef enum {
VIR_DOMAIN_THREAD_SCHED_OTHER = 0,
VIR_DOMAIN_THREAD_SCHED_BATCH,
VIR_DOMAIN_THREAD_SCHED_IDLE,
VIR_DOMAIN_THREAD_SCHED_FIFO,
VIR_DOMAIN_THREAD_SCHED_RR,
VIR_DOMAIN_THREAD_SCHED_LAST
} virDomainThreadSched;
typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam; typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam;
typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr; typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr;
struct _virDomainThreadSchedParam { struct _virDomainThreadSchedParam {
virBitmapPtr ids; virBitmapPtr ids;
virDomainThreadSched scheduler; virProcessSchedPolicy policy;
int priority; int priority;
}; };
...@@ -2882,7 +2873,6 @@ VIR_ENUM_DECL(virDomainRNGModel) ...@@ -2882,7 +2873,6 @@ VIR_ENUM_DECL(virDomainRNGModel)
VIR_ENUM_DECL(virDomainRNGBackend) VIR_ENUM_DECL(virDomainRNGBackend)
VIR_ENUM_DECL(virDomainTPMModel) VIR_ENUM_DECL(virDomainTPMModel)
VIR_ENUM_DECL(virDomainTPMBackend) VIR_ENUM_DECL(virDomainTPMBackend)
VIR_ENUM_DECL(virDomainThreadSched)
/* from libvirt.h */ /* from libvirt.h */
VIR_ENUM_DECL(virDomainState) VIR_ENUM_DECL(virDomainState)
VIR_ENUM_DECL(virDomainNostateReason) VIR_ENUM_DECL(virDomainNostateReason)
......
...@@ -416,8 +416,6 @@ virDomainStateTypeFromString; ...@@ -416,8 +416,6 @@ virDomainStateTypeFromString;
virDomainStateTypeToString; virDomainStateTypeToString;
virDomainTaintTypeFromString; virDomainTaintTypeFromString;
virDomainTaintTypeToString; virDomainTaintTypeToString;
virDomainThreadSchedTypeFromString;
virDomainThreadSchedTypeToString;
virDomainTimerModeTypeFromString; virDomainTimerModeTypeFromString;
virDomainTimerModeTypeToString; virDomainTimerModeTypeToString;
virDomainTimerNameTypeFromString; virDomainTimerNameTypeFromString;
......
...@@ -2614,7 +2614,7 @@ qemuProcessSetSchedParams(int id, ...@@ -2614,7 +2614,7 @@ qemuProcessSetSchedParams(int id,
if (!s) if (!s)
return 0; return 0;
return virProcessSetScheduler(pid, s->scheduler, s->priority); return virProcessSetScheduler(pid, s->policy, s->priority);
} }
static int static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册