Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
7cce4768
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,发现更多精彩内容 >>
提交
7cce4768
编写于
6月 03, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misc User Mode Linux startup/shutdown bugs
上级
7d633ec4
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
33 addition
and
20 deletion
+33
-20
ChangeLog
ChangeLog
+9
-0
src/uml_driver.c
src/uml_driver.c
+23
-19
src/util.c
src/util.c
+1
-1
未找到文件。
ChangeLog
浏览文件 @
7cce4768
Wed Jun 3 11:53:52 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Misc User Mode Linux startup/shutdown bugs
* src/util.c: Make virKillProcess refuse to kill PID==1 too
* src/uml_driver.c: Increment retries counter when starting
guest. Check for monitor command failure. Use unique source
socket per domain for talking to monitor. Use virKillProcess
for killing guests. Fix guest cleanup when getting inotify
Wed Jun 3 11:32:52 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Wed Jun 3 11:32:52 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* qemud/qemud.c: Honour LIBVIRT_LOG_FILTERS/OUTPUTS env variables
* qemud/qemud.c: Honour LIBVIRT_LOG_FILTERS/OUTPUTS env variables
...
...
src/uml_driver.c
浏览文件 @
7cce4768
...
@@ -166,9 +166,10 @@ umlIdentifyOneChrPTY(virConnectPtr conn,
...
@@ -166,9 +166,10 @@ umlIdentifyOneChrPTY(virConnectPtr conn,
return
-
1
;
return
-
1
;
}
}
requery:
requery:
umlMonitorCommand
(
NULL
,
driver
,
dom
,
cmd
,
&
res
);
if
(
umlMonitorCommand
(
NULL
,
driver
,
dom
,
cmd
,
&
res
)
<
0
)
return
-
1
;
if
(
STRPREFIX
(
res
,
"pts:"
))
{
if
(
res
&&
STRPREFIX
(
res
,
"pts:"
))
{
VIR_FREE
(
def
->
data
.
file
.
path
);
VIR_FREE
(
def
->
data
.
file
.
path
);
if
((
def
->
data
.
file
.
path
=
strdup
(
res
+
4
))
==
NULL
)
{
if
((
def
->
data
.
file
.
path
=
strdup
(
res
+
4
))
==
NULL
)
{
virReportOOMError
(
conn
);
virReportOOMError
(
conn
);
...
@@ -176,7 +177,7 @@ requery:
...
@@ -176,7 +177,7 @@ requery:
VIR_FREE
(
cmd
);
VIR_FREE
(
cmd
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
STRPREFIX
(
res
,
"pts"
))
{
}
else
if
(
!
res
||
STRPREFIX
(
res
,
"pts"
))
{
/* It can take a while to startup, so retry for
/* It can take a while to startup, so retry for
upto 5 seconds */
upto 5 seconds */
/* XXX should do this in a better non-blocking
/* XXX should do this in a better non-blocking
...
@@ -263,19 +264,15 @@ reread:
...
@@ -263,19 +264,15 @@ reread:
}
}
if
(
e
->
mask
&
IN_DELETE
)
{
if
(
e
->
mask
&
IN_DELETE
)
{
VIR_DEBUG
(
"Got inotify domain shutdown '%s'"
,
name
);
if
(
!
virDomainIsActive
(
dom
))
{
if
(
!
virDomainIsActive
(
dom
))
{
virDomainObjUnlock
(
dom
);
virDomainObjUnlock
(
dom
);
continue
;
continue
;
}
}
dom
->
def
->
id
=
-
1
;
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
dom
->
pid
=
-
1
;
if
(
dom
->
newDef
)
{
virDomainDefFree
(
dom
->
def
);
dom
->
def
=
dom
->
newDef
;
}
dom
->
state
=
VIR_DOMAIN_SHUTOFF
;
}
else
if
(
e
->
mask
&
(
IN_CREATE
|
IN_MODIFY
))
{
}
else
if
(
e
->
mask
&
(
IN_CREATE
|
IN_MODIFY
))
{
VIR_DEBUG
(
"Got inotify domain startup '%s'"
,
name
);
if
(
virDomainIsActive
(
dom
))
{
if
(
virDomainIsActive
(
dom
))
{
virDomainObjUnlock
(
dom
);
virDomainObjUnlock
(
dom
);
continue
;
continue
;
...
@@ -289,12 +286,14 @@ reread:
...
@@ -289,12 +286,14 @@ reread:
dom
->
def
->
id
=
driver
->
nextvmid
++
;
dom
->
def
->
id
=
driver
->
nextvmid
++
;
dom
->
state
=
VIR_DOMAIN_RUNNING
;
dom
->
state
=
VIR_DOMAIN_RUNNING
;
if
(
umlOpenMonitor
(
NULL
,
driver
,
dom
)
<
0
)
if
(
umlOpenMonitor
(
NULL
,
driver
,
dom
)
<
0
)
{
VIR_WARN0
(
"Could not open monitor for new domain"
);
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
}
else
if
(
umlIdentifyChrPTY
(
NULL
,
driver
,
dom
)
<
0
)
{
if
(
umlIdentifyChrPTY
(
NULL
,
driver
,
dom
)
<
0
)
VIR_WARN0
(
"Could not identify charater devices for new domain"
);
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
}
}
}
virDomainObjUnlock
(
dom
);
virDomainObjUnlock
(
dom
);
}
}
...
@@ -383,6 +382,7 @@ umlStartup(void) {
...
@@ -383,6 +382,7 @@ umlStartup(void) {
goto
error
;
goto
error
;
}
}
VIR_INFO
(
"Adding inotify watch on %s"
,
uml_driver
->
monitorDir
);
if
(
inotify_add_watch
(
uml_driver
->
inotifyFD
,
if
(
inotify_add_watch
(
uml_driver
->
inotifyFD
,
uml_driver
->
monitorDir
,
uml_driver
->
monitorDir
,
IN_CREATE
|
IN_MODIFY
|
IN_DELETE
)
<
0
)
{
IN_CREATE
|
IN_MODIFY
|
IN_DELETE
)
<
0
)
{
...
@@ -595,10 +595,11 @@ static int umlOpenMonitor(virConnectPtr conn,
...
@@ -595,10 +595,11 @@ static int umlOpenMonitor(virConnectPtr conn,
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
return
-
1
;
return
-
1
;
VIR_DEBUG
(
"Dest address for monitor is '%s'"
,
addr
.
sun_path
);
restat:
restat:
if
(
stat
(
addr
.
sun_path
,
&
sb
)
<
0
)
{
if
(
stat
(
addr
.
sun_path
,
&
sb
)
<
0
)
{
if
(
errno
==
ENOENT
&&
if
(
errno
==
ENOENT
&&
retries
<
50
)
{
retries
++
<
50
)
{
usleep
(
1000
*
100
);
usleep
(
1000
*
100
);
goto
restat
;
goto
restat
;
}
}
...
@@ -612,7 +613,8 @@ restat:
...
@@ -612,7 +613,8 @@ restat:
}
}
memset
(
addr
.
sun_path
,
0
,
sizeof
addr
.
sun_path
);
memset
(
addr
.
sun_path
,
0
,
sizeof
addr
.
sun_path
);
sprintf
(
addr
.
sun_path
+
1
,
"%u"
,
getpid
());
sprintf
(
addr
.
sun_path
+
1
,
"libvirt-uml-%u"
,
vm
->
pid
);
VIR_DEBUG
(
"Reply address for monitor is '%s'"
,
addr
.
sun_path
+
1
);
if
(
bind
(
vm
->
monitor
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
addr
)
<
0
)
{
if
(
bind
(
vm
->
monitor
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
addr
)
<
0
)
{
virReportSystemError
(
conn
,
errno
,
virReportSystemError
(
conn
,
errno
,
"%s"
,
_
(
"cannot bind socket"
));
"%s"
,
_
(
"cannot bind socket"
));
...
@@ -657,6 +659,8 @@ static int umlMonitorCommand(virConnectPtr conn,
...
@@ -657,6 +659,8 @@ static int umlMonitorCommand(virConnectPtr conn,
struct
sockaddr_un
addr
;
struct
sockaddr_un
addr
;
unsigned
int
addrlen
;
unsigned
int
addrlen
;
VIR_DEBUG
(
"Run command '%s'"
,
cmd
);
*
reply
=
NULL
;
*
reply
=
NULL
;
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
...
@@ -706,6 +710,8 @@ static int umlMonitorCommand(virConnectPtr conn,
...
@@ -706,6 +710,8 @@ static int umlMonitorCommand(virConnectPtr conn,
}
while
(
res
.
extra
);
}
while
(
res
.
extra
);
VIR_DEBUG
(
"Command reply is '%s'"
,
NULLSTR
(
retdata
));
*
reply
=
retdata
;
*
reply
=
retdata
;
return
ret
;
return
ret
;
...
@@ -852,12 +858,10 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
...
@@ -852,12 +858,10 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr
vm
)
virDomainObjPtr
vm
)
{
{
int
ret
;
int
ret
;
if
(
!
virDomainIsActive
(
vm
)
||
if
(
!
virDomainIsActive
(
vm
))
vm
->
pid
<=
1
)
return
;
return
;
virKillProcess
(
vm
->
pid
,
SIGTERM
);
kill
(
vm
->
pid
,
SIGTERM
);
if
(
vm
->
monitor
!=
-
1
)
if
(
vm
->
monitor
!=
-
1
)
close
(
vm
->
monitor
);
close
(
vm
->
monitor
);
...
...
src/util.c
浏览文件 @
7cce4768
...
@@ -1680,7 +1680,7 @@ char *virGetHostname(void)
...
@@ -1680,7 +1680,7 @@ char *virGetHostname(void)
/* send signal to a single process */
/* send signal to a single process */
int
virKillProcess
(
pid_t
pid
,
int
sig
)
int
virKillProcess
(
pid_t
pid
,
int
sig
)
{
{
if
(
pid
<
1
)
{
if
(
pid
<
=
1
)
{
errno
=
ESRCH
;
errno
=
ESRCH
;
return
-
1
;
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录