Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
a6c77af6
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看板
提交
a6c77af6
编写于
4月 03, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uml: Remove virConnectPtr from umlReportError
上级
e9125be5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
99 deletion
+92
-99
src/uml/uml_conf.c
src/uml/uml_conf.c
+18
-20
src/uml/uml_conf.h
src/uml/uml_conf.h
+2
-2
src/uml/uml_driver.c
src/uml/uml_driver.c
+72
-77
未找到文件。
src/uml/uml_conf.c
浏览文件 @
a6c77af6
...
...
@@ -100,8 +100,7 @@ virCapsPtr umlCapsInit(void) {
static
int
umlConnectTapDevice
(
virConnectPtr
conn
,
virDomainNetDefPtr
net
,
umlConnectTapDevice
(
virDomainNetDefPtr
net
,
const
char
*
bridge
)
{
brControl
*
brctl
=
NULL
;
...
...
@@ -129,7 +128,7 @@ umlConnectTapDevice(virConnectPtr conn,
&
net
->
ifname
,
BR_TAP_PERSIST
,
&
tapfd
)))
{
if
(
errno
==
ENOTSUP
)
{
/* In this particular case, give a better diagnostic. */
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Failed to add tap interface to bridge. "
"%s is not a bridge device"
),
bridge
);
}
else
if
(
template_ifname
)
{
...
...
@@ -179,24 +178,24 @@ umlBuildCommandLineNet(virConnectPtr conn,
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit
(
&
buf
,
"tuntap"
);
if
(
def
->
data
.
ethernet
.
ipaddr
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"IP address not supported for ethernet inteface"
));
goto
error
;
}
if
(
def
->
data
.
ethernet
.
script
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"script execution not supported for ethernet inteface"
));
goto
error
;
}
break
;
case
VIR_DOMAIN_NET_TYPE_SERVER
:
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"TCP server networking type not supported"
));
goto
error
;
case
VIR_DOMAIN_NET_TYPE_CLIENT
:
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"TCP client networking type not supported"
));
goto
error
;
...
...
@@ -211,7 +210,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
virNetworkPtr
network
=
virNetworkLookupByName
(
conn
,
def
->
data
.
network
.
name
);
if
(
!
network
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Network '%s' not found"
),
def
->
data
.
network
.
name
);
goto
error
;
...
...
@@ -222,7 +221,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
goto
error
;
}
if
(
umlConnectTapDevice
(
conn
,
def
,
bridge
)
<
0
)
{
if
(
umlConnectTapDevice
(
def
,
bridge
)
<
0
)
{
VIR_FREE
(
bridge
);
goto
error
;
}
...
...
@@ -233,7 +232,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
}
case
VIR_DOMAIN_NET_TYPE_BRIDGE
:
if
(
umlConnectTapDevice
(
conn
,
def
,
def
->
data
.
bridge
.
brname
)
<
0
)
if
(
umlConnectTapDevice
(
def
,
def
->
data
.
bridge
.
brname
)
<
0
)
goto
error
;
/* ethNNN=tuntap,tapname,macaddr,gateway */
...
...
@@ -241,12 +240,12 @@ umlBuildCommandLineNet(virConnectPtr conn,
break
;
case
VIR_DOMAIN_NET_TYPE_INTERNAL
:
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"internal networking type not supported"
));
goto
error
;
case
VIR_DOMAIN_NET_TYPE_DIRECT
:
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"direct networking type not supported"
));
goto
error
;
...
...
@@ -277,8 +276,7 @@ error:
}
static
char
*
umlBuildCommandLineChr
(
virConnectPtr
conn
,
virDomainChrDefPtr
def
,
umlBuildCommandLineChr
(
virDomainChrDefPtr
def
,
const
char
*
dev
)
{
char
*
ret
=
NULL
;
...
...
@@ -315,8 +313,8 @@ umlBuildCommandLineChr(virConnectPtr conn,
case
VIR_DOMAIN_CHR_TYPE_TCP
:
if
(
def
->
data
.
tcp
.
listen
!=
1
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"only TCP listen is supported for chr device"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"only TCP listen is supported for chr device"
));
return
NULL
;
}
...
...
@@ -335,7 +333,7 @@ umlBuildCommandLineChr(virConnectPtr conn,
case
VIR_DOMAIN_CHR_TYPE_UDP
:
case
VIR_DOMAIN_CHR_TYPE_UNIX
:
default:
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unsupported chr device type %d"
),
def
->
type
);
break
;
}
...
...
@@ -479,7 +477,7 @@ int umlBuildCommandLine(virConnectPtr conn,
virDomainDiskDefPtr
disk
=
vm
->
def
->
disks
[
i
];
if
(
!
STRPREFIX
(
disk
->
dst
,
"ubd"
))
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unsupported disk type '%s'"
),
disk
->
dst
);
goto
error
;
}
...
...
@@ -497,7 +495,7 @@ int umlBuildCommandLine(virConnectPtr conn,
for
(
i
=
0
;
i
<
UML_MAX_CHAR_DEVICE
;
i
++
)
{
char
*
ret
;
if
(
i
==
0
&&
vm
->
def
->
console
)
ret
=
umlBuildCommandLineChr
(
conn
,
vm
->
def
->
console
,
"con"
);
ret
=
umlBuildCommandLineChr
(
vm
->
def
->
console
,
"con"
);
else
if
(
virAsprintf
(
&
ret
,
"con%d=none"
,
i
)
<
0
)
goto
no_memory
;
...
...
@@ -511,7 +509,7 @@ int umlBuildCommandLine(virConnectPtr conn,
if
(
vm
->
def
->
serials
[
j
]
->
target
.
port
==
i
)
chr
=
vm
->
def
->
serials
[
j
];
if
(
chr
)
ret
=
umlBuildCommandLineChr
(
c
onn
,
c
hr
,
"ssl"
);
ret
=
umlBuildCommandLineChr
(
chr
,
"ssl"
);
else
if
(
virAsprintf
(
&
ret
,
"ssl%d=none"
,
i
)
<
0
)
goto
no_memory
;
...
...
src/uml/uml_conf.h
浏览文件 @
a6c77af6
...
...
@@ -62,8 +62,8 @@ struct uml_driver {
};
# define umlReportError(co
nn, dom, net, code, ...)
\
virReportErrorHelper(
conn
, VIR_FROM_UML, code, __FILE__, \
# define umlReportError(co
de, ...)
\
virReportErrorHelper(
NULL
, VIR_FROM_UML, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
virCapsPtr
umlCapsInit
(
void
);
...
...
src/uml/uml_driver.c
浏览文件 @
a6c77af6
...
...
@@ -106,8 +106,7 @@ static void umlDriverUnlock(struct uml_driver *driver)
}
static
int
umlOpenMonitor
(
virConnectPtr
conn
,
struct
uml_driver
*
driver
,
static
int
umlOpenMonitor
(
struct
uml_driver
*
driver
,
virDomainObjPtr
vm
);
static
int
umlReadPidFile
(
struct
uml_driver
*
driver
,
virDomainObjPtr
vm
);
...
...
@@ -134,11 +133,10 @@ static void umlShutdownVMDaemon(virConnectPtr conn,
virDomainObjPtr
vm
);
static
int
umlMonitorCommand
(
virConnectPtr
conn
,
const
struct
uml_driver
*
driver
,
const
virDomainObjPtr
vm
,
const
char
*
cmd
,
char
**
reply
);
static
int
umlMonitorCommand
(
const
struct
uml_driver
*
driver
,
const
virDomainObjPtr
vm
,
const
char
*
cmd
,
char
**
reply
);
static
struct
uml_driver
*
uml_driver
=
NULL
;
...
...
@@ -201,7 +199,7 @@ umlIdentifyOneChrPTY(struct uml_driver *driver,
return
-
1
;
}
requery:
if
(
umlMonitorCommand
(
NULL
,
driver
,
dom
,
cmd
,
&
res
)
<
0
)
if
(
umlMonitorCommand
(
driver
,
dom
,
cmd
,
&
res
)
<
0
)
return
-
1
;
if
(
res
&&
STRPREFIX
(
res
,
"pts:"
))
{
...
...
@@ -320,7 +318,7 @@ reread:
dom
->
def
->
id
=
driver
->
nextvmid
++
;
dom
->
state
=
VIR_DOMAIN_RUNNING
;
if
(
umlOpenMonitor
(
NULL
,
driver
,
dom
)
<
0
)
{
if
(
umlOpenMonitor
(
driver
,
dom
)
<
0
)
{
VIR_WARN0
(
"Could not open monitor for new domain"
);
umlShutdownVMDaemon
(
NULL
,
driver
,
dom
);
}
else
if
(
umlIdentifyChrPTY
(
driver
,
dom
)
<
0
)
{
...
...
@@ -601,8 +599,7 @@ reopen:
return
rc
;
}
static
int
umlMonitorAddress
(
virConnectPtr
conn
,
const
struct
uml_driver
*
driver
,
static
int
umlMonitorAddress
(
const
struct
uml_driver
*
driver
,
virDomainObjPtr
vm
,
struct
sockaddr_un
*
addr
)
{
char
*
sockname
;
...
...
@@ -617,7 +614,7 @@ static int umlMonitorAddress(virConnectPtr conn,
memset
(
addr
,
0
,
sizeof
*
addr
);
addr
->
sun_family
=
AF_UNIX
;
if
(
virStrcpyStatic
(
addr
->
sun_path
,
sockname
)
==
NULL
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unix path %s too long for destination"
),
sockname
);
retval
=
-
1
;
}
...
...
@@ -625,15 +622,14 @@ static int umlMonitorAddress(virConnectPtr conn,
return
retval
;
}
static
int
umlOpenMonitor
(
virConnectPtr
conn
,
struct
uml_driver
*
driver
,
static
int
umlOpenMonitor
(
struct
uml_driver
*
driver
,
virDomainObjPtr
vm
)
{
struct
sockaddr_un
addr
;
struct
stat
sb
;
int
retries
=
0
;
umlDomainObjPrivatePtr
priv
=
vm
->
privateData
;
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
if
(
umlMonitorAddress
(
driver
,
vm
,
&
addr
)
<
0
)
return
-
1
;
VIR_DEBUG
(
"Dest address for monitor is '%s'"
,
addr
.
sun_path
);
...
...
@@ -687,8 +683,7 @@ struct monitor_response {
};
static
int
umlMonitorCommand
(
virConnectPtr
conn
,
const
struct
uml_driver
*
driver
,
static
int
umlMonitorCommand
(
const
struct
uml_driver
*
driver
,
const
virDomainObjPtr
vm
,
const
char
*
cmd
,
char
**
reply
)
...
...
@@ -705,7 +700,7 @@ static int umlMonitorCommand(virConnectPtr conn,
*
reply
=
NULL
;
if
(
umlMonitorAddress
(
conn
,
driver
,
vm
,
&
addr
)
<
0
)
if
(
umlMonitorAddress
(
driver
,
vm
,
&
addr
)
<
0
)
return
-
1
;
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -719,7 +714,7 @@ static int umlMonitorCommand(virConnectPtr conn,
return
-
1
;
}
if
(
virStrcpyStatic
(
req
.
data
,
cmd
)
==
NULL
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Command %s too long for destination"
),
cmd
);
return
-
1
;
}
...
...
@@ -826,14 +821,14 @@ static int umlStartVMDaemon(virConnectPtr conn,
FD_ZERO
(
&
keepfd
);
if
(
virDomainObjIsActive
(
vm
))
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"VM is already active"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"VM is already active"
));
return
-
1
;
}
if
(
!
vm
->
def
->
os
.
kernel
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no kernel specified"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no kernel specified"
));
return
-
1
;
}
/* Make sure the binary we are about to try exec'ing exists.
...
...
@@ -1000,14 +995,14 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
if
(
uml_driver
->
privileged
)
{
if
(
STRNEQ
(
conn
->
uri
->
path
,
"/system"
)
&&
STRNEQ
(
conn
->
uri
->
path
,
"/session"
))
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unexpected UML URI path '%s', try uml:///system"
),
conn
->
uri
->
path
);
return
VIR_DRV_OPEN_ERROR
;
}
}
else
{
if
(
STRNEQ
(
conn
->
uri
->
path
,
"/session"
))
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unexpected UML URI path '%s', try uml:///session"
),
conn
->
uri
->
path
);
return
VIR_DRV_OPEN_ERROR
;
...
...
@@ -1016,7 +1011,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
/* URI was good, but driver isn't active */
if
(
uml_driver
==
NULL
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"uml state driver is not active"
));
return
VIR_DRV_OPEN_ERROR
;
}
...
...
@@ -1116,7 +1111,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_NO_DOMAIN
,
NULL
);
umlReportError
(
VIR_ERR_NO_DOMAIN
,
NULL
);
goto
cleanup
;
}
...
...
@@ -1140,7 +1135,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_NO_DOMAIN
,
NULL
);
umlReportError
(
VIR_ERR_NO_DOMAIN
,
NULL
);
goto
cleanup
;
}
...
...
@@ -1164,7 +1159,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_NO_DOMAIN
,
NULL
);
umlReportError
(
VIR_ERR_NO_DOMAIN
,
NULL
);
goto
cleanup
;
}
...
...
@@ -1188,7 +1183,7 @@ static int umlDomainIsActive(virDomainPtr dom)
obj
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
umlDriverUnlock
(
driver
);
if
(
!
obj
)
{
umlReportError
(
dom
->
conn
,
NULL
,
NULL
,
VIR_ERR_NO_DOMAIN
,
NULL
);
umlReportError
(
VIR_ERR_NO_DOMAIN
,
NULL
);
goto
cleanup
;
}
ret
=
virDomainObjIsActive
(
obj
);
...
...
@@ -1210,7 +1205,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
obj
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
umlDriverUnlock
(
driver
);
if
(
!
obj
)
{
umlReportError
(
dom
->
conn
,
NULL
,
NULL
,
VIR_ERR_NO_DOMAIN
,
NULL
);
umlReportError
(
VIR_ERR_NO_DOMAIN
,
NULL
);
goto
cleanup
;
}
ret
=
obj
->
persistent
;
...
...
@@ -1233,7 +1228,7 @@ static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
uname
(
&
ut
);
if
(
virParseVersionString
(
ut
.
release
,
&
driver
->
umlVersion
)
<
0
)
{
umlReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"cannot parse version %s"
),
ut
.
release
);
goto
cleanup
;
}
...
...
@@ -1317,15 +1312,15 @@ static int umlDomainShutdown(virDomainPtr dom) {
vm
=
virDomainFindByID
(
&
driver
->
domains
,
dom
->
id
);
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching id %d"
),
dom
->
id
);
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching id %d"
),
dom
->
id
);
goto
cleanup
;
}
#if 0
if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
umlReportError(
dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED
,
"%s",
_("shutdown operation failed"));
umlReportError(
VIR_ERR_OPERATION_FAILED, "%s"
,
_("shutdown operation failed"));
goto cleanup;
}
ret = 0;
...
...
@@ -1347,8 +1342,8 @@ static int umlDomainDestroy(virDomainPtr dom) {
umlDriverLock
(
driver
);
vm
=
virDomainFindByID
(
&
driver
->
domains
,
dom
->
id
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching id %d"
),
dom
->
id
);
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching id %d"
),
dom
->
id
);
goto
cleanup
;
}
...
...
@@ -1377,8 +1372,8 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
...
...
@@ -1405,7 +1400,7 @@ static unsigned long umlDomainGetMaxMemory(virDomainPtr dom) {
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
dom
->
uuid
,
uuidstr
);
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
...
...
@@ -1430,14 +1425,14 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
dom
->
uuid
,
uuidstr
);
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
if
(
newmax
<
vm
->
def
->
memory
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"cannot set max memory lower than current memory"
));
umlReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"cannot set max memory lower than current memory"
));
goto
cleanup
;
}
...
...
@@ -1463,20 +1458,20 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virUUIDFormat
(
dom
->
uuid
,
uuidstr
);
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
_
(
"no domain with matching uuid '%s'"
),
uuidstr
);
goto
cleanup
;
}
if
(
virDomainObjIsActive
(
vm
))
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_NO_SUPPORT
,
"%s"
,
_
(
"cannot set memory of an active domain"
));
umlReportError
(
VIR_ERR_NO_SUPPORT
,
"%s"
,
_
(
"cannot set memory of an active domain"
));
goto
cleanup
;
}
if
(
newmem
>
vm
->
def
->
maxmem
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"cannot set memory higher than max memory"
));
umlReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"cannot set memory higher than max memory"
));
goto
cleanup
;
}
...
...
@@ -1500,8 +1495,8 @@ static int umlDomainGetInfo(virDomainPtr dom,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
...
...
@@ -1511,8 +1506,8 @@ static int umlDomainGetInfo(virDomainPtr dom,
info
->
cpuTime
=
0
;
}
else
{
if
(
umlGetProcessInfo
(
&
(
info
->
cpuTime
),
vm
->
pid
)
<
0
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"cannot read cputime for domain"
));
umlReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"cannot read cputime for domain"
));
goto
cleanup
;
}
}
...
...
@@ -1540,8 +1535,8 @@ static char *umlDomainDumpXML(virDomainPtr dom,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
...
...
@@ -1589,8 +1584,8 @@ static int umlDomainStart(virDomainPtr dom) {
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
...
...
@@ -1652,20 +1647,20 @@ static int umlDomainUndefine(virDomainPtr dom) {
umlDriverLock
(
driver
);
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
if
(
virDomainObjIsActive
(
vm
))
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot delete active domain"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot delete active domain"
));
goto
cleanup
;
}
if
(
!
vm
->
persistent
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot undefine transient domain"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot undefine transient domain"
));
goto
cleanup
;
}
...
...
@@ -1696,8 +1691,8 @@ static int umlDomainGetAutostart(virDomainPtr dom,
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
...
...
@@ -1722,14 +1717,14 @@ static int umlDomainSetAutostart(virDomainPtr dom,
vm
=
virDomainFindByUUID
(
&
driver
->
domains
,
dom
->
uuid
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
if
(
!
vm
->
persistent
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot set autostart for transient domain"
));
umlReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot set autostart for transient domain"
));
goto
cleanup
;
}
...
...
@@ -1796,14 +1791,14 @@ umlDomainBlockPeek (virDomainPtr dom,
umlDriverUnlock
(
driver
);
if
(
!
vm
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
umlReportError
(
VIR_ERR_INVALID_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
goto
cleanup
;
}
if
(
!
path
||
path
[
0
]
==
'\0'
)
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"NULL or empty path"
));
umlReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"NULL or empty path"
));
goto
cleanup
;
}
...
...
@@ -1839,8 +1834,8 @@ umlDomainBlockPeek (virDomainPtr dom,
ret
=
0
;
}
else
{
umlReportError
(
dom
->
conn
,
dom
,
NULL
,
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"invalid path"
));
umlReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"invalid path"
));
}
cleanup:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录