Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e6a8f9a1
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,发现更多精彩内容 >>
提交
e6a8f9a1
编写于
3月 14, 2011
作者:
M
Michal Privoznik
提交者:
Eric Blake
3月 14, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Insert error messages to avoid a quiet abortion of commands
in case of incorrect option parsing.
上级
013427e6
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
38 addition
and
14 deletion
+38
-14
tools/virsh.c
tools/virsh.c
+38
-14
未找到文件。
tools/virsh.c
浏览文件 @
e6a8f9a1
...
@@ -706,8 +706,10 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
...
@@ -706,8 +706,10 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
}
}
VIR_FREE
(
ctl
->
name
);
VIR_FREE
(
ctl
->
name
);
if
(
vshCommandOptString
(
cmd
,
"name"
,
&
name
)
<=
0
)
if
(
vshCommandOptString
(
cmd
,
"name"
,
&
name
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Please specify valid connection URI"
));
return
FALSE
;
return
FALSE
;
}
ctl
->
name
=
vshStrdup
(
ctl
,
name
);
ctl
->
name
=
vshStrdup
(
ctl
,
name
);
if
(
!
ro
)
{
if
(
!
ro
)
{
...
@@ -773,7 +775,7 @@ static int
...
@@ -773,7 +775,7 @@ static int
cmdConsole
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
cmdConsole
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
{
virDomainPtr
dom
;
virDomainPtr
dom
;
int
ret
;
int
ret
=
FALSE
;
const
char
*
name
=
NULL
;
const
char
*
name
=
NULL
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
...
@@ -782,11 +784,14 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
...
@@ -782,11 +784,14 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
FALSE
;
return
FALSE
;
if
(
vshCommandOptString
(
cmd
,
"devname"
,
&
name
)
<
0
)
if
(
vshCommandOptString
(
cmd
,
"devname"
,
&
name
)
<
0
)
{
return
FALSE
;
vshError
(
ctl
,
"%s"
,
_
(
"Invalid devname"
));
goto
cleanup
;
}
ret
=
cmdRunConsole
(
ctl
,
dom
,
name
);
ret
=
cmdRunConsole
(
ctl
,
dom
,
name
);
cleanup:
virDomainFree
(
dom
);
virDomainFree
(
dom
);
return
ret
;
return
ret
;
}
}
...
@@ -2410,8 +2415,10 @@ cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
...
@@ -2410,8 +2415,10 @@ cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
const
char
*
type
=
NULL
;
const
char
*
type
=
NULL
;
int
vcpus
;
int
vcpus
;
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<
0
)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"Invalid type"
));
return
FALSE
;
return
FALSE
;
}
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
return
FALSE
;
return
FALSE
;
...
@@ -2856,8 +2863,10 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
...
@@ -2856,8 +2863,10 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
FALSE
;
return
FALSE
;
if
(
vshCommandOptInt
(
cmd
,
"count"
,
&
count
)
<
0
)
if
(
vshCommandOptInt
(
cmd
,
"count"
,
&
count
)
<
0
)
{
return
FALSE
;
vshError
(
ctl
,
"%s"
,
_
(
"Invalid number of virtual CPUs"
));
goto
cleanup
;
}
if
(
!
flags
)
{
if
(
!
flags
)
{
if
(
virDomainSetVcpus
(
dom
,
count
)
!=
0
)
{
if
(
virDomainSetVcpus
(
dom
,
count
)
!=
0
)
{
...
@@ -3705,8 +3714,10 @@ doMigrate (void *opaque)
...
@@ -3705,8 +3714,10 @@ doMigrate (void *opaque)
if
(
vshCommandOptString
(
cmd
,
"desturi"
,
&
desturi
)
<=
0
||
if
(
vshCommandOptString
(
cmd
,
"desturi"
,
&
desturi
)
<=
0
||
vshCommandOptString
(
cmd
,
"migrateuri"
,
&
migrateuri
)
<
0
||
vshCommandOptString
(
cmd
,
"migrateuri"
,
&
migrateuri
)
<
0
||
vshCommandOptString
(
cmd
,
"dname"
,
&
dname
)
<
0
)
vshCommandOptString
(
cmd
,
"dname"
,
&
dname
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing argument"
));
goto
out
;
goto
out
;
}
if
(
vshCommandOptBool
(
cmd
,
"live"
))
if
(
vshCommandOptBool
(
cmd
,
"live"
))
flags
|=
VIR_MIGRATE_LIVE
;
flags
|=
VIR_MIGRATE_LIVE
;
...
@@ -5509,8 +5520,10 @@ static int buildPoolXML(const vshCmd *cmd, const char **retname, char **xml) {
...
@@ -5509,8 +5520,10 @@ static int buildPoolXML(const vshCmd *cmd, const char **retname, char **xml) {
vshCommandOptString
(
cmd
,
"source-dev"
,
&
srcDev
)
<
0
||
vshCommandOptString
(
cmd
,
"source-dev"
,
&
srcDev
)
<
0
||
vshCommandOptString
(
cmd
,
"source-name"
,
&
srcName
)
<
0
||
vshCommandOptString
(
cmd
,
"source-name"
,
&
srcName
)
<
0
||
vshCommandOptString
(
cmd
,
"source-format"
,
&
srcFormat
)
<
0
||
vshCommandOptString
(
cmd
,
"source-format"
,
&
srcFormat
)
<
0
||
vshCommandOptString
(
cmd
,
"target"
,
&
target
)
<
0
)
vshCommandOptString
(
cmd
,
"target"
,
&
target
)
<
0
)
{
vshError
(
NULL
,
"%s"
,
_
(
"missing argument"
));
goto
cleanup
;
goto
cleanup
;
}
virBufferVSprintf
(
&
buf
,
"<pool type='%s'>
\n
"
,
type
);
virBufferVSprintf
(
&
buf
,
"<pool type='%s'>
\n
"
,
type
);
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
name
);
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
name
);
...
@@ -6314,8 +6327,10 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
...
@@ -6314,8 +6327,10 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
||
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
||
vshCommandOptString
(
cmd
,
"host"
,
&
host
)
<
0
||
vshCommandOptString
(
cmd
,
"host"
,
&
host
)
<
0
||
vshCommandOptString
(
cmd
,
"initiator"
,
&
initiator
)
<
0
)
vshCommandOptString
(
cmd
,
"initiator"
,
&
initiator
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing argument"
));
return
FALSE
;
return
FALSE
;
}
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
return
FALSE
;
return
FALSE
;
...
@@ -6386,8 +6401,10 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
...
@@ -6386,8 +6401,10 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
)
return
FALSE
;
return
FALSE
;
if
(
vshCommandOptString
(
cmd
,
"srcSpec"
,
&
srcSpecFile
)
<
0
)
if
(
vshCommandOptString
(
cmd
,
"srcSpec"
,
&
srcSpecFile
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing option"
));
return
FALSE
;
return
FALSE
;
}
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
return
FALSE
;
return
FALSE
;
...
@@ -8862,8 +8879,10 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
...
@@ -8862,8 +8879,10 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
vshCommandOptString
(
cmd
,
"target"
,
&
target
)
<
0
||
vshCommandOptString
(
cmd
,
"target"
,
&
target
)
<
0
||
vshCommandOptString
(
cmd
,
"mac"
,
&
mac
)
<
0
||
vshCommandOptString
(
cmd
,
"mac"
,
&
mac
)
<
0
||
vshCommandOptString
(
cmd
,
"script"
,
&
script
)
<
0
||
vshCommandOptString
(
cmd
,
"script"
,
&
script
)
<
0
||
vshCommandOptString
(
cmd
,
"model"
,
&
model
)
<
0
)
vshCommandOptString
(
cmd
,
"model"
,
&
model
)
<
0
)
{
vshError
(
ctl
,
"missing argument"
);
goto
cleanup
;
goto
cleanup
;
}
/* check interface type */
/* check interface type */
if
(
STREQ
(
type
,
"network"
))
{
if
(
STREQ
(
type
,
"network"
))
{
...
@@ -8969,8 +8988,10 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
...
@@ -8969,8 +8988,10 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
)
if
(
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<=
0
)
goto
cleanup
;
goto
cleanup
;
if
(
vshCommandOptString
(
cmd
,
"mac"
,
&
mac
)
<
0
)
if
(
vshCommandOptString
(
cmd
,
"mac"
,
&
mac
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing option"
));
goto
cleanup
;
goto
cleanup
;
}
doc
=
virDomainGetXMLDesc
(
dom
,
0
);
doc
=
virDomainGetXMLDesc
(
dom
,
0
);
if
(
!
doc
)
if
(
!
doc
)
...
@@ -9120,6 +9141,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
...
@@ -9120,6 +9141,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<
0
||
vshCommandOptString
(
cmd
,
"type"
,
&
type
)
<
0
||
vshCommandOptString
(
cmd
,
"mode"
,
&
mode
)
<
0
||
vshCommandOptString
(
cmd
,
"mode"
,
&
mode
)
<
0
||
vshCommandOptString
(
cmd
,
"sourcetype"
,
&
stype
)
<
0
)
{
vshCommandOptString
(
cmd
,
"sourcetype"
,
&
stype
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing option"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -11272,8 +11294,10 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
...
@@ -11272,8 +11294,10 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
if
(
vshCommandOptString
(
cmd
,
optname
,
&
n
)
<=
0
)
if
(
vshCommandOptString
(
cmd
,
optname
,
&
n
)
<=
0
)
return
NULL
;
return
NULL
;
if
(
vshCommandOptString
(
cmd
,
pooloptname
,
&
p
)
<
0
)
if
(
vshCommandOptString
(
cmd
,
pooloptname
,
&
p
)
<
0
)
{
vshError
(
ctl
,
"%s"
,
_
(
"missing option"
));
return
NULL
;
return
NULL
;
}
if
(
p
)
if
(
p
)
pool
=
vshCommandOptPoolBy
(
ctl
,
cmd
,
pooloptname
,
name
,
flag
);
pool
=
vshCommandOptPoolBy
(
ctl
,
cmd
,
pooloptname
,
name
,
flag
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录