Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f0817018
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看板
提交
f0817018
编写于
4月 03, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow autoconnect to virsh console in create/start. Refuse to connect to remote consoles
上级
92ff72b5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
8 deletion
+54
-8
ChangeLog
ChangeLog
+6
-0
src/virsh.c
src/virsh.c
+48
-8
未找到文件。
ChangeLog
浏览文件 @
f0817018
Fri Apr 3 15:03:00 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* src/virsh.c: Add --console arg for create & start commands
to auto-attach to console. Print info about escape key for
console. Refuse to connect to remote consoles.
Fri Apr 3 13:41:00 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Misc NUMA memory fixes
...
...
src/virsh.c
浏览文件 @
f0817018
...
...
@@ -500,20 +500,30 @@ static const vshCmdOptDef opts_console[] = {
#ifndef __MINGW32__
static
int
cmd
Console
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
cmd
RunConsole
(
vshControl
*
ctl
,
virDomainPtr
dom
)
{
xmlDocPtr
xml
=
NULL
;
xmlXPathObjectPtr
obj
=
NULL
;
xmlXPathContextPtr
ctxt
=
NULL
;
virDomainPtr
dom
;
int
ret
=
FALSE
;
char
*
doc
;
char
*
thatHost
=
NULL
;
char
*
thisHost
=
NULL
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
thisHost
=
virGetHostname
()))
{
vshError
(
ctl
,
FALSE
,
"%s"
,
_
(
"Failed to get local hostname"
));
goto
cleanup
;
}
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
FALSE
;
if
(
!
(
thatHost
=
virConnectGetHostname
(
ctl
->
conn
)))
{
vshError
(
ctl
,
FALSE
,
"%s"
,
_
(
"Failed to get connection hostname"
));
goto
cleanup
;
}
if
(
STRNEQ
(
thisHost
,
thatHost
))
{
vshError
(
ctl
,
FALSE
,
"%s"
,
_
(
"Cannot connect to a remote console device"
));
goto
cleanup
;
}
doc
=
virDomainGetXMLDesc
(
dom
,
0
);
if
(
!
doc
)
...
...
@@ -532,6 +542,8 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/devices/console/@tty)"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
((
obj
->
type
==
XPATH_STRING
)
&&
(
obj
->
stringval
!=
NULL
)
&&
(
obj
->
stringval
[
0
]
!=
0
)))
{
vshPrintExtra
(
ctl
,
_
(
"Connected to domain %s
\n
"
),
virDomainGetName
(
dom
));
vshPrintExtra
(
ctl
,
"%s"
,
_
(
"Escape character is ^]
\n
"
));
if
(
vshRunConsole
((
const
char
*
)
obj
->
stringval
)
==
0
)
ret
=
TRUE
;
}
else
{
...
...
@@ -543,14 +555,16 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
xmlXPathFreeContext
(
ctxt
);
if
(
xml
)
xmlFreeDoc
(
xml
);
virDomainFree
(
dom
);
free
(
thisHost
);
free
(
thatHost
);
return
ret
;
}
#else
/* __MINGW32__ */
static
int
cmd
Console
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
ATTRIBUTE_UNUSED
)
cmd
RunConsole
(
vshControl
*
ctl
,
virDomainPtr
dom
ATTRIBUTE_UNUSED
)
{
vshError
(
ctl
,
FALSE
,
"%s"
,
_
(
"console not implemented on this platform"
));
return
FALSE
;
...
...
@@ -558,6 +572,24 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
#endif
/* __MINGW32__ */
static
int
cmdConsole
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
ret
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
FALSE
;
ret
=
cmdRunConsole
(
ctl
,
dom
);
virDomainFree
(
dom
);
return
ret
;
}
/*
* "list" command
*/
...
...
@@ -882,6 +914,7 @@ static const vshCmdInfo info_create[] = {
static
const
vshCmdOptDef
opts_create
[]
=
{
{
"file"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"file containing an XML domain description"
)},
{
"console"
,
VSH_OT_BOOL
,
0
,
gettext_noop
(
"attach to console after creation"
)},
{
NULL
,
0
,
0
,
NULL
}
};
...
...
@@ -893,6 +926,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
int
found
;
int
ret
=
TRUE
;
char
*
buffer
;
int
console
=
vshCommandOptBool
(
cmd
,
"console"
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
...
...
@@ -910,6 +944,8 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
if
(
dom
!=
NULL
)
{
vshPrint
(
ctl
,
_
(
"Domain %s created from %s
\n
"
),
virDomainGetName
(
dom
),
from
);
if
(
console
)
cmdRunConsole
(
ctl
,
dom
);
virDomainFree
(
dom
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to create domain from %s"
),
from
);
...
...
@@ -1030,6 +1066,7 @@ static const vshCmdInfo info_start[] = {
static
const
vshCmdOptDef
opts_start
[]
=
{
{
"domain"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"name of the inactive domain"
)},
{
"console"
,
VSH_OT_BOOL
,
0
,
gettext_noop
(
"attach to console after creation"
)},
{
NULL
,
0
,
0
,
NULL
}
};
...
...
@@ -1038,6 +1075,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr
dom
;
int
ret
=
TRUE
;
int
console
=
vshCommandOptBool
(
cmd
,
"console"
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
...
...
@@ -1054,6 +1092,8 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
if
(
virDomainCreate
(
dom
)
==
0
)
{
vshPrint
(
ctl
,
_
(
"Domain %s started
\n
"
),
virDomainGetName
(
dom
));
if
(
console
)
cmdRunConsole
(
ctl
,
dom
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to start domain %s"
),
virDomainGetName
(
dom
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录