Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
896761e5
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,发现更多精彩内容 >>
提交
896761e5
编写于
1月 30, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix numerous bugs in QEMU domain startup
上级
05436ab7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
70 addition
and
23 deletion
+70
-23
ChangeLog
ChangeLog
+9
-0
src/domain_conf.c
src/domain_conf.c
+1
-0
src/qemu_driver.c
src/qemu_driver.c
+60
-23
未找到文件。
ChangeLog
浏览文件 @
896761e5
Fri Jan 30 16:58:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Misc QEMU driver startup fixes
* src/domain_conf.c: Add initialization of monitor_watch
* src/qemud_driver.c: Fix infinite loop when QEMU quits on
startup. Fix watch removal if watch isn't added. Fix use
of VNC password from global driver config. Avoid zombies
from daemonizing QEMU. Fix memory leak in monitorpath
Fri Jan 30 16:51:22 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/lxc_driver.c: Avoid probing for LXC until we know we're
...
...
src/domain_conf.c
浏览文件 @
896761e5
...
...
@@ -497,6 +497,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
virDomainObjLock
(
domain
);
domain
->
state
=
VIR_DOMAIN_SHUTOFF
;
domain
->
def
=
def
;
domain
->
monitor_watch
=
-
1
;
if
(
VIR_REALLOC_N
(
doms
->
objs
,
doms
->
count
+
1
)
<
0
)
{
virReportOOMError
(
conn
);
...
...
src/qemu_driver.c
浏览文件 @
896761e5
...
...
@@ -355,10 +355,9 @@ qemudReconnectVMs(struct qemud_driver *driver)
qemudLog
(
QEMUD_ERR
,
_
(
"Failed to reconnect monitor for %s: %d
\n
"
),
vm
->
def
->
name
,
rc
);
goto
next_error
;
}
else
vm
->
monitorpath
=
status
->
monitorpath
;
}
if
((
vm
->
logfile
=
qemudLogFD
(
NULL
,
driver
->
logDir
,
vm
->
def
->
name
))
<
0
)
if
((
vm
->
logfile
=
qemudLogFD
(
NULL
,
driver
->
logDir
,
vm
->
def
->
name
))
<
0
)
return
-
1
;
if
(
vm
->
def
->
id
>=
driver
->
nextvmid
)
...
...
@@ -376,6 +375,8 @@ next_error:
vm
->
newDef
=
NULL
;
next:
virDomainObjUnlock
(
vm
);
if
(
status
)
VIR_FREE
(
status
->
monitorpath
);
VIR_FREE
(
status
);
VIR_FREE
(
config
);
}
...
...
@@ -617,6 +618,9 @@ typedef int qemudHandlerMonitorOutput(virConnectPtr conn,
const
char
*
output
,
int
fd
);
/*
* Returns -1 for error, 0 on end-of-file, 1 for success
*/
static
int
qemudReadMonitorOutput
(
virConnectPtr
conn
,
virDomainObjPtr
vm
,
...
...
@@ -670,11 +674,17 @@ qemudReadMonitorOutput(virConnectPtr conn,
_
(
"Failure while reading %s startup output"
),
what
);
return
-
1
;
}
}
else
if
(
ret
==
0
)
{
return
0
;
}
else
{
got
+=
ret
;
buf
[
got
]
=
'\0'
;
if
((
ret
=
func
(
conn
,
vm
,
buf
,
fd
))
!=
1
)
return
ret
;
ret
=
func
(
conn
,
vm
,
buf
,
fd
);
if
(
ret
==
-
1
)
return
-
1
;
if
(
ret
==
1
)
continue
;
return
1
;
}
}
...
...
@@ -724,11 +734,14 @@ static int qemudOpenMonitor(virConnectPtr conn,
}
if
(
!
reconnect
)
{
ret
=
qemudReadMonitorOutput
(
conn
,
if
(
qemudReadMonitorOutput
(
conn
,
vm
,
monfd
,
buf
,
sizeof
(
buf
),
qemudCheckMonitorPrompt
,
"monitor"
,
10000
);
"monitor"
,
10000
)
<=
0
)
ret
=
-
1
;
else
ret
=
0
;
}
else
{
vm
->
monitor
=
monfd
;
ret
=
0
;
...
...
@@ -858,7 +871,7 @@ static int qemudWaitForMonitor(virConnectPtr conn,
if
((
logfd
=
qemudLogReadFD
(
conn
,
driver
->
logDir
,
vm
->
def
->
name
,
pos
))
<
0
)
return
logfd
;
return
-
1
;
ret
=
qemudReadMonitorOutput
(
conn
,
vm
,
logfd
,
buf
,
sizeof
(
buf
),
qemudFindCharDevicePTYs
,
...
...
@@ -866,7 +879,17 @@ static int qemudWaitForMonitor(virConnectPtr conn,
if
(
close
(
logfd
)
<
0
)
qemudLog
(
QEMUD_WARN
,
_
(
"Unable to close logfile: %s
\n
"
),
strerror
(
errno
));
return
ret
;
if
(
ret
==
1
)
/* Success */
return
0
;
if
(
ret
==
-
1
)
return
-
1
;
/* Unexpected end of file - inform user of QEMU log data */
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"unable to start guest: %s"
),
buf
);
return
-
1
;
}
static
int
...
...
@@ -1033,7 +1056,7 @@ qemudInitPasswords(virConnectPtr conn,
if
(
vm
->
def
->
graphics
&&
vm
->
def
->
graphics
->
type
==
VIR_DOMAIN_GRAPHICS_TYPE_VNC
&&
vm
->
def
->
graphics
->
data
.
vnc
.
passwd
)
{
(
vm
->
def
->
graphics
->
data
.
vnc
.
passwd
||
driver
->
vncPassword
)
)
{
if
(
qemudMonitorCommandExtra
(
vm
,
"change vnc password"
,
vm
->
def
->
graphics
->
data
.
vnc
.
passwd
?
...
...
@@ -1212,6 +1235,12 @@ static int qemudStartVMDaemon(virConnectPtr conn,
/* wait for qemu process to to show up */
if
(
ret
==
0
)
{
int
retries
=
100
;
int
childstat
;
while
(
waitpid
(
child
,
&
childstat
,
0
)
==
-
1
&&
errno
==
EINTR
);
if
(
childstat
==
0
)
{
while
(
retries
)
{
if
((
ret
=
virFileReadPid
(
driver
->
stateDir
,
vm
->
def
->
name
,
&
vm
->
pid
))
==
0
)
break
;
...
...
@@ -1220,6 +1249,11 @@ static int qemudStartVMDaemon(virConnectPtr conn,
}
if
(
ret
)
qemudLog
(
QEMUD_WARN
,
_
(
"Domain %s didn't show up
\n
"
),
vm
->
def
->
name
);
}
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unable to daemonize QEMU process"
));
ret
=
-
1
;
}
}
if
(
ret
==
0
)
{
...
...
@@ -1262,14 +1296,17 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
if
(
!
virDomainIsActive
(
vm
))
return
;
qemudLog
(
QEMUD_
INFO
,
_
(
"Shutting down VM '%s'
\n
"
),
vm
->
def
->
name
);
qemudLog
(
QEMUD_
DEBUG
,
_
(
"Shutting down VM '%s'
\n
"
),
vm
->
def
->
name
);
if
(
virKillProcess
(
vm
->
pid
,
0
)
==
0
&&
virKillProcess
(
vm
->
pid
,
SIGTERM
)
<
0
)
qemudLog
(
QEMUD_ERROR
,
_
(
"Failed to send SIGTERM to %s (%d): %s
\n
"
),
vm
->
def
->
name
,
vm
->
pid
,
strerror
(
errno
));
if
(
vm
->
monitor_watch
!=
-
1
)
{
virEventRemoveHandle
(
vm
->
monitor_watch
);
vm
->
monitor_watch
=
-
1
;
}
if
(
close
(
vm
->
logfile
)
<
0
)
qemudLog
(
QEMUD_WARN
,
_
(
"Unable to close logfile %d: %s
\n
"
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录