Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
fcd103bb
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看板
提交
fcd103bb
编写于
4月 03, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
openvz: Remove virConnectPtr from openvzError
Also remove unused enum values OPENVZ_WARN and OPENVZ_ERR.
上级
a4f9af05
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
177 addition
and
181 deletion
+177
-181
src/openvz/openvz_conf.c
src/openvz/openvz_conf.c
+40
-43
src/openvz/openvz_conf.h
src/openvz/openvz_conf.h
+3
-6
src/openvz/openvz_driver.c
src/openvz/openvz_driver.c
+134
-132
未找到文件。
src/openvz/openvz_conf.c
浏览文件 @
fcd103bb
...
...
@@ -122,15 +122,14 @@ rewait:
return
ret
;
}
int
openvzExtractVersion
(
virConnectPtr
conn
,
struct
openvz_driver
*
driver
)
int
openvzExtractVersion
(
struct
openvz_driver
*
driver
)
{
if
(
driver
->
version
>
0
)
return
0
;
if
(
openvzExtractVersionInfo
(
VZCTL
,
&
driver
->
version
)
<
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not extract vzctl version"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not extract vzctl version"
));
return
-
1
;
}
...
...
@@ -181,8 +180,7 @@ no_memory:
static
int
openvzReadNetworkConf
(
virConnectPtr
conn
,
virDomainDefPtr
def
,
openvzReadNetworkConf
(
virDomainDefPtr
def
,
int
veid
)
{
int
ret
;
virDomainNetDefPtr
net
=
NULL
;
...
...
@@ -196,9 +194,9 @@ openvzReadNetworkConf(virConnectPtr conn,
*/
ret
=
openvzReadVPSConfigParam
(
veid
,
"IP_ADDRESS"
,
temp
,
sizeof
(
temp
));
if
(
ret
<
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'IP_ADDRESS' from config for container %d"
),
veid
);
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'IP_ADDRESS' from config for container %d"
),
veid
);
goto
error
;
}
else
if
(
ret
>
0
)
{
token
=
strtok_r
(
temp
,
" "
,
&
saveptr
);
...
...
@@ -228,9 +226,9 @@ openvzReadNetworkConf(virConnectPtr conn,
*/
ret
=
openvzReadVPSConfigParam
(
veid
,
"NETIF"
,
temp
,
sizeof
(
temp
));
if
(
ret
<
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'NETIF' from config for container %d"
),
veid
);
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'NETIF' from config for container %d"
),
veid
);
goto
error
;
}
else
if
(
ret
>
0
)
{
token
=
strtok_r
(
temp
,
";"
,
&
saveptr
);
...
...
@@ -254,8 +252,8 @@ openvzReadNetworkConf(virConnectPtr conn,
p
+=
12
;
len
=
next
-
p
;
if
(
len
>
16
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Too long network device name"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Too long network device name"
));
goto
error
;
}
...
...
@@ -263,7 +261,7 @@ openvzReadNetworkConf(virConnectPtr conn,
goto
no_memory
;
if
(
virStrncpy
(
net
->
ifname
,
p
,
len
,
len
+
1
)
==
NULL
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Network ifname %s too long for destination"
),
p
);
goto
error
;
}
...
...
@@ -271,8 +269,8 @@ openvzReadNetworkConf(virConnectPtr conn,
p
+=
7
;
len
=
next
-
p
;
if
(
len
>
16
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Too long bridge device name"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Too long bridge device name"
));
goto
error
;
}
...
...
@@ -280,7 +278,7 @@ openvzReadNetworkConf(virConnectPtr conn,
goto
no_memory
;
if
(
virStrncpy
(
net
->
data
.
bridge
.
brname
,
p
,
len
,
len
+
1
)
==
NULL
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Bridge name %s too long for destination"
),
p
);
goto
error
;
}
...
...
@@ -288,18 +286,18 @@ openvzReadNetworkConf(virConnectPtr conn,
p
+=
4
;
len
=
next
-
p
;
if
(
len
!=
17
)
{
//should be 17
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Wrong length MAC address"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Wrong length MAC address"
));
goto
error
;
}
if
(
virStrncpy
(
cpy_temp
,
p
,
len
,
sizeof
(
cpy_temp
))
==
NULL
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"MAC address %s too long for destination"
),
p
);
goto
error
;
}
if
(
virParseMacAddr
(
cpy_temp
,
net
->
mac
)
<
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Wrong MAC address"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Wrong MAC address"
));
goto
error
;
}
}
...
...
@@ -359,8 +357,7 @@ openvz_replace(const char* str,
static
int
openvzReadFSConf
(
virConnectPtr
conn
,
virDomainDefPtr
def
,
openvzReadFSConf
(
virDomainDefPtr
def
,
int
veid
)
{
int
ret
;
virDomainFSDefPtr
fs
=
NULL
;
...
...
@@ -369,7 +366,7 @@ openvzReadFSConf(virConnectPtr conn,
ret
=
openvzReadVPSConfigParam
(
veid
,
"OSTEMPLATE"
,
temp
,
sizeof
(
temp
));
if
(
ret
<
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'OSTEMPLATE' from config for container %d"
),
veid
);
goto
error
;
...
...
@@ -383,7 +380,7 @@ openvzReadFSConf(virConnectPtr conn,
/* OSTEMPLATE was not found, VE was booted from a private dir directly */
ret
=
openvzReadVPSConfigParam
(
veid
,
"VE_PRIVATE"
,
temp
,
sizeof
(
temp
));
if
(
ret
<=
0
)
{
openvzError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read 'VE_PRIVATE' from config for container %d"
),
veid
);
goto
error
;
...
...
@@ -446,7 +443,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
return
-
1
;
if
((
fp
=
popen
(
VZLIST
" -a -ovpsid,status -H 2>/dev/null"
,
"r"
))
==
NULL
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"popen failed"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"popen failed"
));
return
-
1
;
}
...
...
@@ -455,8 +452,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
if
(
feof
(
fp
))
break
;
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to parse vzlist output"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to parse vzlist output"
));
goto
cleanup
;
}
...
...
@@ -464,8 +461,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
goto
no_memory
;
if
(
virMutexInit
(
&
dom
->
lock
)
<
0
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot initialize mutex"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot initialize mutex"
));
VIR_FREE
(
dom
);
goto
cleanup
;
}
...
...
@@ -493,8 +490,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
ret
=
virUUIDParse
(
uuidstr
,
dom
->
def
->
uuid
);
if
(
ret
==
-
1
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"UUID in config file malformed"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"UUID in config file malformed"
));
goto
cleanup
;
}
...
...
@@ -505,7 +502,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
ret
=
openvzReadVPSConfigParam
(
veid
,
"CPUS"
,
temp
,
sizeof
(
temp
));
if
(
ret
<
0
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not read config for container %d"
),
veid
);
goto
cleanup
;
...
...
@@ -518,8 +515,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
/* XXX load rest of VM config data .... */
openvzReadNetworkConf
(
NULL
,
dom
->
def
,
veid
);
openvzReadFSConf
(
NULL
,
dom
->
def
,
veid
);
openvzReadNetworkConf
(
dom
->
def
,
veid
);
openvzReadFSConf
(
dom
->
def
,
veid
);
virUUIDFormat
(
dom
->
def
->
uuid
,
uuidstr
);
if
(
virHashAddEntry
(
driver
->
domains
.
objs
,
uuidstr
,
dom
)
<
0
)
...
...
@@ -914,8 +911,8 @@ openvzSetUUID(int vpsid){
unsigned
char
uuid
[
VIR_UUID_BUFLEN
];
if
(
virUUIDGenerate
(
uuid
))
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to generate UUID"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to generate UUID"
));
return
-
1
;
}
...
...
@@ -972,7 +969,7 @@ int openvzGetVEID(const char *name) {
bool
ok
;
if
(
virAsprintf
(
&
cmd
,
"%s %s -ovpsid -H"
,
VZLIST
,
name
)
<
0
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"virAsprintf failed"
));
return
-
1
;
}
...
...
@@ -981,7 +978,7 @@ int openvzGetVEID(const char *name) {
VIR_FREE
(
cmd
);
if
(
fp
==
NULL
)
{
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"popen failed"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"popen failed"
));
return
-
1
;
}
...
...
@@ -990,7 +987,7 @@ int openvzGetVEID(const char *name) {
if
(
ok
&&
veid
>=
0
)
return
veid
;
openvzError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to parse vzlist output"
));
openvzError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Failed to parse vzlist output"
));
return
-
1
;
}
src/openvz/openvz_conf.h
浏览文件 @
fcd103bb
...
...
@@ -33,10 +33,8 @@
# include "domain_conf.h"
# include "threads.h"
enum
{
OPENVZ_WARN
,
OPENVZ_ERR
};
# define openvzError(conn, code, ...) \
virReportErrorHelper(conn, VIR_FROM_OPENVZ, code, __FILE__, \
# define openvzError(code, ...) \
virReportErrorHelper(NULL, VIR_FROM_OPENVZ, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
...
...
@@ -56,8 +54,7 @@ struct openvz_driver {
};
int
openvz_readline
(
int
fd
,
char
*
ptr
,
int
maxlen
);
int
openvzExtractVersion
(
virConnectPtr
conn
,
struct
openvz_driver
*
driver
);
int
openvzExtractVersion
(
struct
openvz_driver
*
driver
);
int
openvzReadVPSConfigParam
(
int
vpsid
,
const
char
*
param
,
char
*
value
,
int
maxlen
);
int
openvzWriteVPSConfigParam
(
int
vpsid
,
const
char
*
param
,
const
char
*
value
);
int
openvzCopyDefaultConfig
(
int
vpsid
);
...
...
src/openvz/openvz_driver.c
浏览文件 @
fcd103bb
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录