Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
79995893
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,发现更多精彩内容 >>
提交
79995893
编写于
10月 27, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make qemudMonitorCommand append line endings
上级
27185132
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
24 deletion
+36
-24
ChangeLog
ChangeLog
+5
-0
src/qemu_driver.c
src/qemu_driver.c
+31
-24
未找到文件。
ChangeLog
浏览文件 @
79995893
Fri Oct 26 21:10:44 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_driver.c: make qemudMonitorCommand responsible for
adding appropriate line ending instead of the caller
Fri Oct 26 15:40:44 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xml.c: fix build when configured without Xen
...
...
src/qemu_driver.c
浏览文件 @
79995893
...
...
@@ -1311,10 +1311,12 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
char
**
reply
)
{
int
size
=
0
;
char
*
buf
=
NULL
;
size_t
cmdlen
=
strlen
(
cmd
);
if
(
write
(
vm
->
monitor
,
cmd
,
strlen
(
cmd
))
<
0
)
{
if
(
safewrite
(
vm
->
monitor
,
cmd
,
cmdlen
)
!=
cmdlen
)
return
-
1
;
if
(
safewrite
(
vm
->
monitor
,
"
\r
"
,
1
)
!=
1
)
return
-
1
;
}
*
reply
=
NULL
;
...
...
@@ -1328,32 +1330,24 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
int
got
=
read
(
vm
->
monitor
,
data
,
sizeof
(
data
));
char
*
b
;
if
(
got
==
0
)
{
if
(
buf
)
free
(
buf
);
return
-
1
;
}
if
(
got
==
0
)
goto
error
;
if
(
got
<
0
)
{
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EAGAIN
)
break
;
if
(
buf
)
free
(
buf
);
return
-
1
;
}
if
(
!
(
b
=
realloc
(
buf
,
size
+
got
+
1
)))
{
free
(
buf
);
return
-
1
;
goto
error
;
}
if
(
!
(
b
=
realloc
(
buf
,
size
+
got
+
1
)))
goto
error
;
buf
=
b
;
memmove
(
buf
+
size
,
data
,
got
);
buf
[
size
+
got
]
=
'\0'
;
size
+=
got
;
}
if
(
buf
)
qemudDebug
(
"Mon [%s]"
,
buf
);
/* Look for QEMU prompt to indicate completion */
if
(
buf
&&
((
tmp
=
strstr
(
buf
,
"
\n
(qemu) "
))
!=
NULL
))
{
tmp
[
0
]
=
'\0'
;
...
...
@@ -1364,14 +1358,27 @@ static int qemudMonitorCommand(struct qemud_driver *driver ATTRIBUTE_UNUSED,
if
(
poll
(
&
fd
,
1
,
-
1
)
<
0
)
{
if
(
errno
==
EINTR
)
goto
pollagain
;
free
(
buf
);
return
-
1
;
goto
error
;
}
}
/* Log, but ignore failures to write logfile for VM */
if
(
safewrite
(
vm
->
logfile
,
buf
,
strlen
(
buf
))
<
0
)
qemudLog
(
QEMUD_WARN
,
"Unable to log VM console data: %s"
,
strerror
(
errno
));
*
reply
=
buf
;
return
0
;
error:
if
(
buf
)
{
/* Log, but ignore failures to write logfile for VM */
if
(
safewrite
(
vm
->
logfile
,
buf
,
strlen
(
buf
))
<
0
)
qemudLog
(
QEMUD_WARN
,
"Unable to log VM console data: %s"
,
strerror
(
errno
));
free
(
buf
);
}
return
-
1
;
}
...
...
@@ -1806,7 +1813,7 @@ static int qemudDomainSuspend(virDomainPtr dom) {
if
(
vm
->
state
==
VIR_DOMAIN_PAUSED
)
return
0
;
if
(
qemudMonitorCommand
(
driver
,
vm
,
"stop
\r
"
,
&
info
)
<
0
)
{
if
(
qemudMonitorCommand
(
driver
,
vm
,
"stop"
,
&
info
)
<
0
)
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_FAILED
,
"suspend operation failed"
);
return
-
1
;
}
...
...
@@ -1831,7 +1838,7 @@ static int qemudDomainResume(virDomainPtr dom) {
}
if
(
vm
->
state
==
VIR_DOMAIN_RUNNING
)
return
0
;
if
(
qemudMonitorCommand
(
driver
,
vm
,
"cont
\r
"
,
&
info
)
<
0
)
{
if
(
qemudMonitorCommand
(
driver
,
vm
,
"cont"
,
&
info
)
<
0
)
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_FAILED
,
"resume operation failed"
);
return
-
1
;
}
...
...
@@ -2063,7 +2070,7 @@ static int qemudDomainSave(virDomainPtr dom,
}
if
(
asprintf
(
&
command
,
"migrate
\"
exec:"
"dd of='%s' oflag=append conv=notrunc 2>/dev/null"
"
\"
\r
"
,
safe_path
)
==
-
1
)
{
"
\"
"
,
safe_path
)
==
-
1
)
{
qemudReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_FAILED
,
"out of memory"
);
free
(
safe_path
);
...
...
@@ -2190,7 +2197,7 @@ static int qemudDomainRestore(virConnectPtr conn,
/* If it was running before, resume it now. */
if
(
header
.
was_running
)
{
char
*
info
;
if
(
qemudMonitorCommand
(
driver
,
vm
,
"cont
\r
"
,
&
info
)
<
0
)
{
if
(
qemudMonitorCommand
(
driver
,
vm
,
"cont"
,
&
info
)
<
0
)
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_OPERATION_FAILED
,
"failed to resume domain"
);
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录