Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
fcf967f2
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcf967f2
编写于
5月 10, 2011
作者:
L
Lai Jiangshan
提交者:
Eric Blake
5月 10, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu,inject-nmi: Implement the driver methods
上级
a083d44c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
118 addition
and
1 deletion
+118
-1
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+45
-1
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.c
+14
-0
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor.h
+2
-0
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.c
+27
-0
src/qemu/qemu_monitor_json.h
src/qemu/qemu_monitor_json.h
+1
-0
src/qemu/qemu_monitor_text.c
src/qemu/qemu_monitor_text.c
+28
-0
src/qemu/qemu_monitor_text.h
src/qemu/qemu_monitor_text.h
+1
-0
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
fcf967f2
...
...
@@ -1705,6 +1705,50 @@ static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long memory)
return
qemudDomainSetMemoryFlags
(
dom
,
memory
,
VIR_DOMAIN_MEM_MAXIMUM
);
}
static
int
qemuDomainInjectNMI
(
virDomainPtr
domain
,
unsigned
int
flags
)
{
struct
qemud_driver
*
driver
=
domain
->
conn
->
privateData
;
virDomainObjPtr
vm
=
NULL
;
int
ret
=
-
1
;
qemuDomainObjPrivatePtr
priv
;
virCheckFlags
(
0
,
-
1
);
qemuDriverLock
(
driver
);
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
domain
->
uuid
);
if
(
!
vm
)
{
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
domain
->
uuid
,
uuidstr
);
qemuReportError
(
VIR_ERR_NO_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
if
(
!
virDomainObjIsActive
(
vm
))
{
qemuReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
goto
cleanup
;
}
priv
=
vm
->
privateData
;
if
(
qemuDomainObjBeginJobWithDriver
(
driver
,
vm
)
<
0
)
goto
cleanup
;
qemuDomainObjEnterMonitorWithDriver
(
driver
,
vm
);
ret
=
qemuMonitorInjectNMI
(
priv
->
mon
);
qemuDomainObjExitMonitorWithDriver
(
driver
,
vm
);
if
(
qemuDomainObjEndJob
(
vm
)
==
0
)
{
vm
=
NULL
;
goto
cleanup
;
}
cleanup:
if
(
vm
)
virDomainObjUnlock
(
vm
);
qemuDriverUnlock
(
driver
);
return
ret
;
}
static
int
qemudDomainGetInfo
(
virDomainPtr
dom
,
virDomainInfoPtr
info
)
{
...
...
@@ -7192,7 +7236,7 @@ static virDriver qemuDriver = {
qemuDomainSnapshotDelete
,
/* domainSnapshotDelete */
qemuDomainMonitorCommand
,
/* qemuDomainMonitorCommand */
qemuDomainOpenConsole
,
/* domainOpenConsole */
NULL
,
/* domainInjectNMI */
qemuDomainInjectNMI
,
/* domainInjectNMI */
};
...
...
src/qemu/qemu_monitor.c
浏览文件 @
fcf967f2
...
...
@@ -2228,3 +2228,17 @@ int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
ret
=
qemuMonitorTextArbitraryCommand
(
mon
,
cmd
,
reply
);
return
ret
;
}
int
qemuMonitorInjectNMI
(
qemuMonitorPtr
mon
)
{
int
ret
;
VIR_DEBUG
(
"mon=%p"
,
mon
);
if
(
mon
->
json
)
ret
=
qemuMonitorJSONInjectNMI
(
mon
);
else
ret
=
qemuMonitorTextInjectNMI
(
mon
);
return
ret
;
}
src/qemu/qemu_monitor.h
浏览文件 @
fcf967f2
...
...
@@ -423,6 +423,8 @@ int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
char
**
reply
,
bool
hmp
);
int
qemuMonitorInjectNMI
(
qemuMonitorPtr
mon
);
/**
* When running two dd process and using <> redirection, we need a
* shell that will not truncate files. These two strings serve that
...
...
src/qemu/qemu_monitor_json.c
浏览文件 @
fcf967f2
...
...
@@ -2513,3 +2513,30 @@ cleanup:
return
ret
;
}
int
qemuMonitorJSONInjectNMI
(
qemuMonitorPtr
mon
)
{
int
ret
;
virJSONValuePtr
cmd
;
virJSONValuePtr
reply
=
NULL
;
cmd
=
qemuMonitorJSONMakeCommand
(
"inject-nmi"
,
NULL
);
if
(
!
cmd
)
return
-
1
;
if
((
ret
=
qemuMonitorJSONCommand
(
mon
,
cmd
,
&
reply
))
<
0
)
goto
cleanup
;
if
(
qemuMonitorJSONHasError
(
reply
,
"CommandNotFound"
)
&&
qemuMonitorCheckHMP
(
mon
,
"inject-nmi"
))
{
VIR_DEBUG0
(
"inject-nmi command not found, trying HMP"
);
ret
=
qemuMonitorTextInjectNMI
(
mon
);
}
else
{
ret
=
qemuMonitorJSONCheckError
(
cmd
,
reply
);
}
cleanup:
virJSONValueFree
(
cmd
);
virJSONValueFree
(
reply
);
return
ret
;
}
src/qemu/qemu_monitor_json.h
浏览文件 @
fcf967f2
...
...
@@ -204,4 +204,5 @@ int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon,
char
**
reply_str
,
bool
hmp
);
int
qemuMonitorJSONInjectNMI
(
qemuMonitorPtr
mon
);
#endif
/* QEMU_MONITOR_JSON_H */
src/qemu/qemu_monitor_text.c
浏览文件 @
fcf967f2
...
...
@@ -2628,3 +2628,31 @@ int qemuMonitorTextArbitraryCommand(qemuMonitorPtr mon, const char *cmd,
return
ret
;
}
int
qemuMonitorTextInjectNMI
(
qemuMonitorPtr
mon
)
{
const
char
*
cmd
=
"inject-nmi"
;
char
*
reply
=
NULL
;
if
(
qemuMonitorHMPCommand
(
mon
,
cmd
,
&
reply
)
<
0
)
goto
fail
;
if
(
strstr
(
reply
,
"unknown command"
)
!=
NULL
)
{
VIR_FREE
(
reply
);
/* fallback to 'nmi' if qemu has not supported "inject-nmi" yet. */
cmd
=
"nmi 0"
;
reply
=
NULL
;
if
(
qemuMonitorHMPCommand
(
mon
,
cmd
,
&
reply
)
<
0
)
goto
fail
;
}
VIR_FREE
(
reply
);
return
0
;
fail:
qemuReportError
(
VIR_ERR_OPERATION_FAILED
,
_
(
"failed to inject NMI using command '%s'"
),
cmd
);
return
-
1
;
}
src/qemu/qemu_monitor_text.h
浏览文件 @
fcf967f2
...
...
@@ -198,4 +198,5 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name);
int
qemuMonitorTextArbitraryCommand
(
qemuMonitorPtr
mon
,
const
char
*
cmd
,
char
**
reply
);
int
qemuMonitorTextInjectNMI
(
qemuMonitorPtr
mon
);
#endif
/* QEMU_MONITOR_TEXT_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录