Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
4d3b8dce
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,发现更多精彩内容 >>
提交
4d3b8dce
编写于
12月 08, 2005
作者:
D
Daniel Veillard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* src/virsh.c: added support for suspend/resume/destroy, validating
the previous code. Daniel
上级
6be439c9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
167 addition
and
6 deletion
+167
-6
ChangeLog
ChangeLog
+5
-0
src/virsh.c
src/virsh.c
+162
-6
未找到文件。
ChangeLog
浏览文件 @
4d3b8dce
Fri Dec 9 00:02:06 CET 2005 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: added support for suspend/resume/destroy, validating
the previous code.
Thu Dec 8 18:16:20 CET 2005 Daniel Veillard <veillard@redhat.com>
* src/libvir.c src/xen_internal.c src/xen_internal.h: implement
...
...
src/virsh.c
浏览文件 @
4d3b8dce
...
...
@@ -303,7 +303,7 @@ cmdList(vshControl *ctl, vshCmd *cmd ATTRIBUTE_UNUSED) {
virDomainGetID
(
dom
),
virDomainGetName
(
dom
),
ret
<
0
?
"no state"
:
vshDomainStateToString
(
info
.
state
));
/*TODO: virDomainFree(dom); */
virDomainFree
(
dom
);
}
free
(
ids
);
return
TRUE
;
...
...
@@ -352,7 +352,160 @@ cmdDstate(vshControl *ctl, vshCmd *cmd) {
else
ret
=
FALSE
;
/*TODO: virDomainFree(dom); */
virDomainFree
(
dom
);
return
ret
;
}
/*
* "suspend" command
*/
static
vshCmdInfo
info_suspend
[]
=
{
{
"syntax"
,
"suspend [--id <number> | --name <string> ]"
},
{
"help"
,
"domain state"
},
{
"desc"
,
"Suspend a running domain."
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_suspend
[]
=
{
{
"name"
,
VSH_OT_STRING
,
0
,
"domain name"
},
{
"id"
,
VSH_OT_INT
,
0
,
"domain id"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdSuspend
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
found
,
ret
=
TRUE
;
char
*
name
=
vshCommandOptString
(
cmd
,
"name"
,
NULL
);
int
id
=
vshCommandOptInt
(
cmd
,
"id"
,
&
found
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
found
)
{
if
(
!
(
dom
=
virDomainLookupByID
(
ctl
->
conn
,
id
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%d'"
,
id
);
}
else
{
if
(
!
(
dom
=
virDomainLookupByName
(
ctl
->
conn
,
name
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%s'"
,
name
);
}
if
(
!
dom
)
return
FALSE
;
if
(
virDomainSuspend
(
dom
)
==
0
)
{
if
(
found
)
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %d suspended
\n
"
,
found
);
else
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %s suspended
\n
"
,
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
"Failed to suspend domain
\n
"
);
ret
=
FALSE
;
}
virDomainFree
(
dom
);
return
ret
;
}
/*
* "resume" command
*/
static
vshCmdInfo
info_resume
[]
=
{
{
"syntax"
,
"resume [--id <number> | --name <string> ]"
},
{
"help"
,
"domain state"
},
{
"desc"
,
"Resume a previously suspended domain."
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_resume
[]
=
{
{
"name"
,
VSH_OT_STRING
,
0
,
"domain name"
},
{
"id"
,
VSH_OT_INT
,
0
,
"domain id"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdResume
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
found
,
ret
=
TRUE
;
char
*
name
=
vshCommandOptString
(
cmd
,
"name"
,
NULL
);
int
id
=
vshCommandOptInt
(
cmd
,
"id"
,
&
found
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
found
)
{
if
(
!
(
dom
=
virDomainLookupByID
(
ctl
->
conn
,
id
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%d'"
,
id
);
}
else
{
if
(
!
(
dom
=
virDomainLookupByName
(
ctl
->
conn
,
name
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%s'"
,
name
);
}
if
(
!
dom
)
return
FALSE
;
if
(
virDomainResume
(
dom
)
==
0
)
{
if
(
found
)
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %d resumed
\n
"
,
found
);
else
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %s resumed
\n
"
,
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
"Failed to resume domain
\n
"
);
ret
=
FALSE
;
}
virDomainFree
(
dom
);
return
ret
;
}
/*
* "destroy" command
*/
static
vshCmdInfo
info_destroy
[]
=
{
{
"syntax"
,
"destroy [--id <number> | --name <string> ]"
},
{
"help"
,
"domain state"
},
{
"desc"
,
"Destroy a given domain."
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_destroy
[]
=
{
{
"name"
,
VSH_OT_STRING
,
0
,
"domain name"
},
{
"id"
,
VSH_OT_INT
,
0
,
"domain id"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdDestroy
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
found
,
ret
=
TRUE
;
char
*
name
=
vshCommandOptString
(
cmd
,
"name"
,
NULL
);
int
id
=
vshCommandOptInt
(
cmd
,
"id"
,
&
found
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
found
)
{
if
(
!
(
dom
=
virDomainLookupByID
(
ctl
->
conn
,
id
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%d'"
,
id
);
}
else
{
if
(
!
(
dom
=
virDomainLookupByName
(
ctl
->
conn
,
name
)))
vshError
(
ctl
,
FALSE
,
"failed to get domain '%s'"
,
name
);
}
if
(
!
dom
)
return
FALSE
;
if
(
virDomainDestroy
(
dom
)
==
0
)
{
if
(
found
)
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %d destroyed
\n
"
,
found
);
else
vshPrint
(
ctl
,
VSH_MESG
,
"Domain %s destroyed
\n
"
,
name
);
}
else
{
vshError
(
ctl
,
FALSE
,
"Failed to destroy domain
\n
"
);
ret
=
FALSE
;
virDomainFree
(
dom
);
}
return
ret
;
}
...
...
@@ -369,7 +522,7 @@ static vshCmdInfo info_dinfo[] = {
static
vshCmdOptDef
opts_dinfo
[]
=
{
{
"name"
,
VSH_OT_STRING
,
0
,
"domain name"
},
{
"id"
,
VSH_OT_INT
,
0
,
"domain id"
},
{
NULL
,
0
,
0
,
NULL
}
{
NULL
,
0
,
0
,
NULL
}
};
static
int
...
...
@@ -421,7 +574,7 @@ cmdDinfo(vshControl *ctl, vshCmd *cmd) {
ret
=
FALSE
;
}
/*TODO: virDomainFree(dom); */
virDomainFree
(
dom
);
return
ret
;
}
...
...
@@ -453,7 +606,7 @@ cmdNameof(vshControl *ctl, vshCmd *cmd) {
dom
=
virDomainLookupByID
(
ctl
->
conn
,
id
);
if
(
dom
)
{
vshPrint
(
ctl
,
VSH_MESG
,
"%s
\n
"
,
virDomainGetName
(
dom
));
/*TODO: virDomainFree(dom); */
virDomainFree
(
dom
);
}
else
{
vshError
(
ctl
,
FALSE
,
"failed to get domain '%d'"
,
id
);
return
FALSE
;
...
...
@@ -488,7 +641,7 @@ cmdIdof(vshControl *ctl, vshCmd *cmd) {
dom
=
virDomainLookupByName
(
ctl
->
conn
,
name
);
if
(
dom
)
{
vshPrint
(
ctl
,
VSH_MESG
,
"%s
\n
"
,
virDomainGetID
(
dom
));
/*TODO: virDomainFree(dom); */
virDomainFree
(
dom
);
}
else
{
vshError
(
ctl
,
FALSE
,
"failed to get domain '%s'"
,
name
);
return
FALSE
;
...
...
@@ -598,6 +751,9 @@ static vshCmdDef commands[] = {
{
"connect"
,
cmdConnect
,
opts_connect
,
info_connect
},
{
"dinfo"
,
cmdDinfo
,
opts_dinfo
,
info_dinfo
},
{
"dstate"
,
cmdDstate
,
opts_dstate
,
info_dstate
},
{
"suspend"
,
cmdSuspend
,
opts_suspend
,
info_suspend
},
{
"resume"
,
cmdResume
,
opts_resume
,
info_resume
},
{
"destroy"
,
cmdDestroy
,
opts_destroy
,
info_destroy
},
{
"help"
,
cmdHelp
,
opts_help
,
info_help
},
{
"idof"
,
cmdIdof
,
opts_idof
,
info_idof
},
{
"list"
,
cmdList
,
NULL
,
info_list
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录