Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
9425a3e6
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,发现更多精彩内容 >>
提交
9425a3e6
编写于
8月 16, 2006
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added setvcpus, setmem, setmaxme commands to virsh
上级
5c2831b3
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
142 addition
and
2 deletion
+142
-2
ChangeLog
ChangeLog
+6
-0
src/virsh.c
src/virsh.c
+136
-2
未找到文件。
ChangeLog
浏览文件 @
9425a3e6
Wed Aug 16 12:33:02 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/virsh.c: Added 'setvcpus', 'setmem', 'setmaxmem'
commands to virsh shell. Allow full read-write connection
to non-Xen test hypervisor.
Wed Aug 16 11:38:02 EDT 2006 Daniel Berrange <berrange@redhat.com>
Wed Aug 16 11:38:02 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/test.c, src/test.h: Allow a hypervisor config to be
* src/test.c, src/test.h: Allow a hypervisor config to be
...
...
src/virsh.c
浏览文件 @
9425a3e6
...
@@ -963,6 +963,135 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
...
@@ -963,6 +963,135 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
return
ret
;
return
ret
;
}
}
/*
* "setvcpus" command
*/
static
vshCmdInfo
info_setvcpus
[]
=
{
{
"syntax"
,
"setvcpus <domain> <count>"
},
{
"help"
,
"change number of virtual CPUs"
},
{
"desc"
,
"Change the number of virtual CPUs active in the guest domain"
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_setvcpus
[]
=
{
{
"domain"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"domain name, id or uuid"
},
{
"count"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"number of virtual CPUs"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdSetvcpus
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
count
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
"domain"
,
NULL
)))
return
FALSE
;
count
=
vshCommandOptInt
(
cmd
,
"count"
,
&
count
);
if
(
!
count
)
{
virDomainFree
(
dom
);
return
FALSE
;
}
if
(
virDomainSetVcpus
(
dom
,
count
)
!=
0
)
{
ret
=
FALSE
;
}
virDomainFree
(
dom
);
return
ret
;
}
/*
* "setmemory" command
*/
static
vshCmdInfo
info_setmem
[]
=
{
{
"syntax"
,
"setmem <domain> <bytes>"
},
{
"help"
,
"change memory allocation"
},
{
"desc"
,
"Change the current memory allocation in the guest domain"
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_setmem
[]
=
{
{
"domain"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"domain name, id or uuid"
},
{
"bytes"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"number of bytes of memory"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdSetmem
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
bytes
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
"domain"
,
NULL
)))
return
FALSE
;
bytes
=
vshCommandOptInt
(
cmd
,
"bytes"
,
&
bytes
);
if
(
!
bytes
)
{
virDomainFree
(
dom
);
return
FALSE
;
}
if
(
virDomainSetMemory
(
dom
,
bytes
)
!=
0
)
{
ret
=
FALSE
;
}
virDomainFree
(
dom
);
return
ret
;
}
/*
* "setmaxmem" command
*/
static
vshCmdInfo
info_setmaxmem
[]
=
{
{
"syntax"
,
"setmaxmem <domain> <bytes>"
},
{
"help"
,
"change maximum memory limit"
},
{
"desc"
,
"Change the maximum memory allocation limit in the guest domain"
},
{
NULL
,
NULL
}
};
static
vshCmdOptDef
opts_setmaxmem
[]
=
{
{
"domain"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"domain name, id or uuid"
},
{
"bytes"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
"maxmimum memory limit in bytes"
},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdSetmaxmem
(
vshControl
*
ctl
,
vshCmd
*
cmd
)
{
virDomainPtr
dom
;
int
bytes
;
int
ret
=
TRUE
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
"domain"
,
NULL
)))
return
FALSE
;
bytes
=
vshCommandOptInt
(
cmd
,
"bytes"
,
&
bytes
);
if
(
!
bytes
)
{
virDomainFree
(
dom
);
return
FALSE
;
}
if
(
virDomainSetMaxMemory
(
dom
,
bytes
)
!=
0
)
{
ret
=
FALSE
;
}
virDomainFree
(
dom
);
return
ret
;
}
/*
/*
* "nodeinfo" command
* "nodeinfo" command
*/
*/
...
@@ -1250,6 +1379,9 @@ static vshCmdDef commands[] = {
...
@@ -1250,6 +1379,9 @@ static vshCmdDef commands[] = {
{
"resume"
,
cmdResume
,
opts_resume
,
info_resume
},
{
"resume"
,
cmdResume
,
opts_resume
,
info_resume
},
{
"save"
,
cmdSave
,
opts_save
,
info_save
},
{
"save"
,
cmdSave
,
opts_save
,
info_save
},
{
"shutdown"
,
cmdShutdown
,
opts_shutdown
,
info_shutdown
},
{
"shutdown"
,
cmdShutdown
,
opts_shutdown
,
info_shutdown
},
{
"setmem"
,
cmdSetmem
,
opts_setmem
,
info_setmem
},
{
"setmaxmem"
,
cmdSetmaxmem
,
opts_setmaxmem
,
info_setmaxmem
},
{
"setvcpus"
,
cmdSetvcpus
,
opts_setvcpus
,
info_setvcpus
},
{
"suspend"
,
cmdSuspend
,
opts_suspend
,
info_suspend
},
{
"suspend"
,
cmdSuspend
,
opts_suspend
,
info_suspend
},
{
"vcpuinfo"
,
cmdVcpuinfo
,
opts_vcpuinfo
,
info_vcpuinfo
},
{
"vcpuinfo"
,
cmdVcpuinfo
,
opts_vcpuinfo
,
info_vcpuinfo
},
{
"vcpupin"
,
cmdVcpupin
,
opts_vcpupin
,
info_vcpupin
},
{
"vcpupin"
,
cmdVcpupin
,
opts_vcpupin
,
info_vcpupin
},
...
@@ -1945,8 +2077,10 @@ vshInit(vshControl * ctl)
...
@@ -1945,8 +2077,10 @@ vshInit(vshControl * ctl)
/* set up the library error handler */
/* set up the library error handler */
virSetErrorFunc
(
NULL
,
virshErrorHandler
);
virSetErrorFunc
(
NULL
,
virshErrorHandler
);
/* basic connection to hypervisor */
/* basic connection to hypervisor, for Xen connections unless
if
(
ctl
->
uid
==
0
)
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
)))
ctl
->
conn
=
virConnectOpen
(
ctl
->
name
);
ctl
->
conn
=
virConnectOpen
(
ctl
->
name
);
else
else
ctl
->
conn
=
virConnectOpenReadOnly
(
ctl
->
name
);
ctl
->
conn
=
virConnectOpenReadOnly
(
ctl
->
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录