Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
b7762220
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,发现更多精彩内容 >>
提交
b7762220
编写于
3月 08, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added --readonly flag to virsh
上级
1e95c630
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
9 deletion
+26
-9
ChangeLog
ChangeLog
+6
-0
src/virsh.c
src/virsh.c
+20
-9
未找到文件。
ChangeLog
浏览文件 @
b7762220
Thu Mar 8 08:45:46 EST 2007 Daniel P., Berrange <berrange@redhat.com>
* src/virsh.c: Added an explicit --readonly option to virsh
to override the simple Xen-specific heuristic when running
as non-root. Patch from Rich Jones
Thu Mar 8 09:54:46 CET 2007 Daniel Veillard <veillard@redhat.com>
* src/xml.c: applied patch from Nobuhiro Itou to allow the
...
...
src/virsh.c
浏览文件 @
b7762220
...
...
@@ -171,6 +171,9 @@ typedef struct __vshControl {
int
quiet
;
/* quiet mode */
int
debug
;
/* print debug messages? */
int
timing
;
/* print timing info? */
int
readonly
;
/* connect readonly (first time only, not
* during explicit connect command)
*/
}
__vshControl
;
...
...
@@ -371,10 +374,13 @@ cmdConnect(vshControl * ctl, vshCmd * cmd)
free
(
ctl
->
name
);
ctl
->
name
=
vshStrdup
(
ctl
,
vshCommandOptString
(
cmd
,
"name"
,
NULL
));
if
(
!
ro
)
if
(
!
ro
)
{
ctl
->
conn
=
virConnectOpen
(
ctl
->
name
);
else
ctl
->
readonly
=
0
;
}
else
{
ctl
->
conn
=
virConnectOpenReadOnly
(
ctl
->
name
);
ctl
->
readonly
=
1
;
}
if
(
!
ctl
->
conn
)
vshError
(
ctl
,
FALSE
,
_
(
"Failed to connect to the hypervisor"
));
...
...
@@ -3137,12 +3143,12 @@ vshInit(vshControl * ctl)
/* set up the library error handler */
virSetErrorFunc
(
NULL
,
virshErrorHandler
);
/*
basic connection to hypervisor, for Xen connections unless
we're root open a read only connections. Allow 'test' HV
to be RW all the time though */
if
(
ctl
->
uid
==
0
||
(
ctl
->
name
&&
(
!
strncmp
(
ctl
->
name
,
"test"
,
4
)
||
!
strncmp
(
ctl
->
name
,
"qemu"
,
4
)))
)
/*
Force a non-root, Xen connection to readonly */
if
((
ctl
->
name
==
NULL
||
!
strcasecmp
(
ctl
->
name
,
"xen"
))
&&
ctl
->
uid
!=
0
)
ctl
->
readonly
=
1
;
if
(
!
ctl
->
readonly
)
ctl
->
conn
=
virConnectOpen
(
ctl
->
name
);
else
ctl
->
conn
=
virConnectOpenReadOnly
(
ctl
->
name
);
...
...
@@ -3299,6 +3305,7 @@ vshUsage(vshControl * ctl, const char *cmdname)
fprintf
(
stdout
,
_
(
"
\n
%s [options] [commands]
\n\n
"
" options:
\n
"
" -c | --connect <uri> hypervisor connection URI
\n
"
" -r | --readonly connect readonly
\n
"
" -d | --debug <num> debug level [0-5]
\n
"
" -h | --help this help
\n
"
" -q | --quiet quiet mode
\n
"
...
...
@@ -3336,6 +3343,7 @@ vshParseArgv(vshControl * ctl, int argc, char **argv)
{
"timing"
,
0
,
0
,
't'
},
{
"version"
,
0
,
0
,
'v'
},
{
"connect"
,
1
,
0
,
'c'
},
{
"readonly"
,
0
,
0
,
'r'
},
{
0
,
0
,
0
,
0
}
};
...
...
@@ -3378,7 +3386,7 @@ vshParseArgv(vshControl * ctl, int argc, char **argv)
end
=
end
?
:
argc
;
/* standard (non-command) options */
while
((
arg
=
getopt_long
(
end
,
argv
,
"d:hqtc:v"
,
opt
,
&
idx
))
!=
-
1
)
{
while
((
arg
=
getopt_long
(
end
,
argv
,
"d:hqtc:v
r
"
,
opt
,
&
idx
))
!=
-
1
)
{
switch
(
arg
)
{
case
'd'
:
ctl
->
debug
=
atoi
(
optarg
);
...
...
@@ -3398,6 +3406,9 @@ vshParseArgv(vshControl * ctl, int argc, char **argv)
case
'v'
:
fprintf
(
stdout
,
"%s
\n
"
,
VERSION
);
exit
(
EXIT_SUCCESS
);
case
'r'
:
ctl
->
readonly
=
TRUE
;
break
;
default:
vshError
(
ctl
,
TRUE
,
_
(
"unsupported option '-%c'. See --help."
),
arg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录