Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
8f7e086f
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,发现更多精彩内容 >>
提交
8f7e086f
编写于
11月 25, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement autostart for XM driver
上级
1eeceaa6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
111 addition
and
14 deletion
+111
-14
ChangeLog
ChangeLog
+9
-0
src/Makefile.am
src/Makefile.am
+2
-4
src/xen_unified.c
src/xen_unified.c
+16
-10
src/xm_internal.c
src/xm_internal.c
+81
-0
src/xm_internal.h
src/xm_internal.h
+3
-0
未找到文件。
ChangeLog
浏览文件 @
8f7e086f
Tue Nov 25 10:49:40 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
* src/Makefile.am: Remove unneccessary $(builddir) usage which
breaks on older automake. Remove duplicate CFLAGS from merge
error
* src/xen_unified.c: Wire up XM driver for autostart
* src/xm_internal.h, src/xm_internal.c: Implement domain
autostart functions for /etc/xen/auto
Tue Nov 25 10:43:40 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
Xen domain lifecycle events (Ben Guthro & Daniel Berrange)
...
...
src/Makefile.am
浏览文件 @
8f7e086f
...
...
@@ -192,8 +192,6 @@ libvirt_driver_la_SOURCES = \
libvirt_driver_la_CFLAGS
=
$(XEN_CFLAGS)
libvirt_driver_la_LDFLAGS
=
$(XEN_LIBS)
libvirt_driver_la_CFLAGS
=
$(XEN_CFLAGS)
if
WITH_TEST
if
WITH_DRIVER_MODULES
mod_LTLIBRARIES
+=
libvirt_driver_test.la
...
...
@@ -397,14 +395,14 @@ EXTRA_DIST += \
libvirt_la_SOURCES
=
libvirt_la_LIBADD
+=
\
@CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
libvirt_la_LDFLAGS
=
-Wl
,--version-script
=
$(builddir)
/
libvirt_sym.version
\
libvirt_la_LDFLAGS
=
-Wl
,--version-script
=
libvirt_sym.version
\
-version-info
@LIBVIRT_VERSION_INFO@
\
$
(
COVERAGE_CFLAGS:-f%
=
-Wc
,-f%
)
\
$(LIBXML_LIBS)
$(SELINUX_LIBS)
\
$(XEN_LIBS)
$(DRIVER_MODULE_LIBS)
\
@CYGWIN_EXTRA_LDFLAGS@ @MINGW_EXTRA_LDFLAGS@
libvirt_la_CFLAGS
=
$(COVERAGE_CFLAGS)
-DIN_LIBVIRT
libvirt_la_DEPENDENCIES
=
$(libvirt_la_LIBADD)
$(builddir)
/
libvirt_sym.version
libvirt_la_DEPENDENCIES
=
$(libvirt_la_LIBADD)
libvirt_sym.version
# Create an automake "convenience library" version of libvirt_la,
# just for testing, since the test harness requires access to internal
...
...
src/xen_unified.c
浏览文件 @
8f7e086f
...
...
@@ -1159,13 +1159,16 @@ static int
xenUnifiedDomainGetAutostart
(
virDomainPtr
dom
,
int
*
autostart
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainGetAutostart
&&
drivers
[
i
]
->
domainGetAutostart
(
dom
,
autostart
)
==
0
)
return
0
;
if
(
priv
->
xendConfigVersion
<
3
)
{
if
(
priv
->
opened
[
XEN_UNIFIED_XM_OFFSET
])
return
xenXMDomainGetAutostart
(
dom
,
autostart
);
}
else
{
if
(
priv
->
opened
[
XEN_UNIFIED_XEND_OFFSET
])
return
xenDaemonDomainGetAutostart
(
dom
,
autostart
);
}
xenUnifiedError
(
dom
->
conn
,
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
return
-
1
;
}
...
...
@@ -1173,13 +1176,16 @@ static int
xenUnifiedDomainSetAutostart
(
virDomainPtr
dom
,
int
autostart
)
{
GET_PRIVATE
(
dom
->
conn
);
int
i
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
if
(
priv
->
opened
[
i
]
&&
drivers
[
i
]
->
domainSetAutostart
&&
drivers
[
i
]
->
domainSetAutostart
(
dom
,
autostart
)
==
0
)
return
0
;
if
(
priv
->
xendConfigVersion
<
3
)
{
if
(
priv
->
opened
[
XEN_UNIFIED_XM_OFFSET
])
return
xenXMDomainSetAutostart
(
dom
,
autostart
);
}
else
{
if
(
priv
->
opened
[
XEN_UNIFIED_XEND_OFFSET
])
return
xenDaemonDomainSetAutostart
(
dom
,
autostart
);
}
xenUnifiedError
(
dom
->
conn
,
VIR_ERR_NO_SUPPORT
,
__FUNCTION__
);
return
-
1
;
}
...
...
src/xm_internal.c
浏览文件 @
8f7e086f
...
...
@@ -2669,3 +2669,84 @@ xenXMDomainBlockPeek (virDomainPtr dom,
return
-
1
;
}
static
char
*
xenXMAutostartLinkName
(
virDomainPtr
dom
)
{
char
*
ret
;
if
(
asprintf
(
&
ret
,
"/etc/xen/auto/%s"
,
dom
->
name
)
<
0
)
return
NULL
;
return
ret
;
}
static
char
*
xenXMDomainConfigName
(
virDomainPtr
dom
)
{
char
*
ret
;
if
(
asprintf
(
&
ret
,
"/etc/xen/%s"
,
dom
->
name
)
<
0
)
return
NULL
;
return
ret
;
}
int
xenXMDomainGetAutostart
(
virDomainPtr
dom
,
int
*
autostart
)
{
char
*
linkname
=
xenXMAutostartLinkName
(
dom
);
char
*
config
=
xenXMDomainConfigName
(
dom
);
int
ret
=
-
1
;
if
(
!
linkname
||
!
config
)
{
xenXMError
(
dom
->
conn
,
VIR_ERR_NO_MEMORY
,
NULL
);
goto
cleanup
;
}
*
autostart
=
virFileLinkPointsTo
(
linkname
,
config
);
if
(
*
autostart
<
0
)
{
xenXMError
(
dom
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to check autostart link %s: %s"
),
linkname
,
strerror
(
errno
));
goto
cleanup
;
}
ret
=
0
;
cleanup:
VIR_FREE
(
linkname
);
VIR_FREE
(
config
);
return
ret
;
}
int
xenXMDomainSetAutostart
(
virDomainPtr
dom
,
int
autostart
)
{
char
*
linkname
=
xenXMAutostartLinkName
(
dom
);
char
*
config
=
xenXMDomainConfigName
(
dom
);
int
ret
=
-
1
;
if
(
!
linkname
||
!
config
)
{
xenXMError
(
dom
->
conn
,
VIR_ERR_NO_MEMORY
,
NULL
);
goto
cleanup
;
}
if
(
autostart
)
{
if
(
symlink
(
config
,
linkname
)
<
0
&&
errno
!=
EEXIST
)
{
xenXMError
(
dom
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
"failed to create link %s: %s"
,
linkname
,
strerror
(
errno
));
goto
cleanup
;
}
}
else
{
if
(
unlink
(
linkname
)
<
0
&&
errno
!=
ENOENT
)
{
xenXMError
(
dom
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
"failed to remove link %s: %s"
,
linkname
,
strerror
(
errno
));
goto
cleanup
;
}
}
ret
=
0
;
cleanup:
VIR_FREE
(
linkname
);
VIR_FREE
(
config
);
return
ret
;
}
src/xm_internal.h
浏览文件 @
8f7e086f
...
...
@@ -65,4 +65,7 @@ virDomainDefPtr xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf);
int
xenXMDomainBlockPeek
(
virDomainPtr
dom
,
const
char
*
path
,
unsigned
long
long
offset
,
size_t
size
,
void
*
buffer
);
int
xenXMDomainGetAutostart
(
virDomainPtr
dom
,
int
*
autostart
);
int
xenXMDomainSetAutostart
(
virDomainPtr
dom
,
int
autostart
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录