Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
bd24695a
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,体验更适合开发者的 AI 搜索 >>
提交
bd24695a
编写于
12月 22, 2008
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge xml building for virsh pool-*-as
上级
b4962134
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
85 deletion
+49
-85
ChangeLog
ChangeLog
+4
-0
src/virsh.c
src/virsh.c
+45
-85
未找到文件。
ChangeLog
浏览文件 @
bd24695a
Mon Dec 22 11:27:52 EST 2008 Cole Robinson <crobinso@redhat.com>
* src/virsh.c: Merge xml building for virsh pool-*-as
Mon Dec 22 17:13:42 CET 2008 Daniel Veillard <veillard@redhat.com>
* qemud/qemud.c qemud/test_libvirtd_qemu.aug tests/Makefile.am
...
...
src/virsh.c
浏览文件 @
bd24695a
...
...
@@ -2860,38 +2860,27 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
return
ret
;
}
/*
*
"pool-create-as" command
*
XML Building helper for pool-define-as and pool-create-as
*/
static
const
vshCmdInfo
info_pool_create_as
[]
=
{
{
"help"
,
gettext_noop
(
"create a pool from a set of args"
)},
{
"desc"
,
gettext_noop
(
"Create a pool."
)},
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_pool_create_as
[]
=
{
static
const
vshCmdOptDef
opts_pool_X_as
[]
=
{
{
"name"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"name of the pool"
)},
{
"type"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"type of the pool"
)},
{
"source-host"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source-host for underlying storage"
)},
{
"source-path"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source path for underlying storage"
)},
{
"source-dev"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source device for underlying storage"
)},
{
"source-name"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source name for underlying storage"
)},
{
"target"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"target for underlying storage"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
buildPoolXML
(
const
vshCmd
*
cmd
,
char
**
retname
,
char
**
xml
)
{
static
int
cmdPoolCreateAs
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virStoragePoolPtr
pool
;
int
found
;
char
*
xml
;
char
*
name
,
*
type
,
*
srcHost
,
*
srcPath
,
*
srcDev
,
*
target
;
char
*
name
,
*
type
,
*
srcHost
,
*
srcPath
,
*
srcDev
,
*
srcName
,
*
target
;
virBuffer
buf
=
VIR_BUFFER_INITIALIZER
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
name
=
vshCommandOptString
(
cmd
,
"name"
,
&
found
);
if
(
!
found
)
goto
cleanup
;
...
...
@@ -2902,20 +2891,22 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
srcHost
=
vshCommandOptString
(
cmd
,
"source-host"
,
&
found
);
srcPath
=
vshCommandOptString
(
cmd
,
"source-path"
,
&
found
);
srcDev
=
vshCommandOptString
(
cmd
,
"source-dev"
,
&
found
);
srcName
=
vshCommandOptString
(
cmd
,
"source-name"
,
&
found
);
target
=
vshCommandOptString
(
cmd
,
"target"
,
&
found
);
virBufferVSprintf
(
&
buf
,
"<pool type='%s'>
\n
"
,
type
);
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
name
);
if
(
srcHost
||
srcPath
||
srcDev
)
{
virBufferAddLit
(
&
buf
,
" <source>
\n
"
);
if
(
srcHost
)
virBufferVSprintf
(
&
buf
,
" <host name='%s'>
\n
"
,
srcHost
);
if
(
srcHost
)
virBufferVSprintf
(
&
buf
,
" <host name='%s'/>
\n
"
,
srcHost
);
if
(
srcPath
)
virBufferVSprintf
(
&
buf
,
" <dir path='%s'/>
\n
"
,
srcPath
);
if
(
srcDev
)
virBufferVSprintf
(
&
buf
,
" <device path='%s'/>
\n
"
,
srcDev
);
if
(
srcName
)
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
srcName
);
virBufferAddLit
(
&
buf
,
" </source>
\n
"
);
}
...
...
@@ -2930,7 +2921,36 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
vshPrint
(
ctl
,
"%s"
,
_
(
"Failed to allocate XML buffer"
));
return
FALSE
;
}
xml
=
virBufferContentAndReset
(
&
buf
);
*
xml
=
virBufferContentAndReset
(
&
buf
);
*
retname
=
name
;
return
TRUE
;
cleanup:
free
(
virBufferContentAndReset
(
&
buf
));
return
FALSE
;
}
/*
* "pool-create-as" command
*/
static
const
vshCmdInfo
info_pool_create_as
[]
=
{
{
"help"
,
gettext_noop
(
"create a pool from a set of args"
)},
{
"desc"
,
gettext_noop
(
"Create a pool."
)},
{
NULL
,
NULL
}
};
static
int
cmdPoolCreateAs
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virStoragePoolPtr
pool
;
char
*
xml
,
*
name
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
if
(
!
buildPoolXML
(
cmd
,
&
name
,
&
xml
))
return
FALSE
;
pool
=
virStoragePoolCreateXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
...
...
@@ -2941,11 +2961,8 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
return
TRUE
;
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to create pool %s"
),
name
);
return
FALSE
;
}
cleanup:
free
(
virBufferContentAndReset
(
&
buf
));
return
FALSE
;
}
...
...
@@ -3006,71 +3023,17 @@ static const vshCmdInfo info_pool_define_as[] = {
{
NULL
,
NULL
}
};
static
const
vshCmdOptDef
opts_pool_define_as
[]
=
{
{
"name"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"name of the pool"
)},
{
"type"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"type of the pool"
)},
{
"source-host"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source-host for underlying storage"
)},
{
"source-path"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source path for underlying storage"
)},
{
"source-dev"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source device for underlying storage"
)},
{
"source-name"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source name for underlying storage"
)},
{
"target"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"target for underlying storage"
)},
{
NULL
,
0
,
0
,
NULL
}
};
static
int
cmdPoolDefineAs
(
vshControl
*
ctl
,
const
vshCmd
*
cmd
)
{
virStoragePoolPtr
pool
;
int
found
;
char
*
xml
;
char
*
name
,
*
type
,
*
srcHost
,
*
srcPath
,
*
srcDev
,
*
srcName
,
*
target
;
virBuffer
buf
=
VIR_BUFFER_INITIALIZER
;
char
*
xml
,
*
name
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
name
=
vshCommandOptString
(
cmd
,
"name"
,
&
found
);
if
(
!
found
)
goto
cleanup
;
type
=
vshCommandOptString
(
cmd
,
"type"
,
&
found
);
if
(
!
found
)
goto
cleanup
;
srcHost
=
vshCommandOptString
(
cmd
,
"source-host"
,
&
found
);
srcPath
=
vshCommandOptString
(
cmd
,
"source-path"
,
&
found
);
srcDev
=
vshCommandOptString
(
cmd
,
"source-dev"
,
&
found
);
srcName
=
vshCommandOptString
(
cmd
,
"source-name"
,
&
found
);
target
=
vshCommandOptString
(
cmd
,
"target"
,
&
found
);
virBufferVSprintf
(
&
buf
,
"<pool type='%s'>
\n
"
,
type
);
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
name
);
if
(
srcHost
||
srcPath
||
srcDev
||
srcName
)
{
virBufferAddLit
(
&
buf
,
" <source>
\n
"
);
if
(
srcHost
)
virBufferVSprintf
(
&
buf
,
" <host>%s</host>
\n
"
,
srcHost
);
if
(
srcPath
)
virBufferVSprintf
(
&
buf
,
" <path>%s</path>
\n
"
,
srcPath
);
if
(
srcDev
)
virBufferVSprintf
(
&
buf
,
" <device>%s</device>
\n
"
,
srcDev
);
if
(
srcName
)
virBufferVSprintf
(
&
buf
,
" <name>%s</name>
\n
"
,
srcName
);
virBufferAddLit
(
&
buf
,
" </source>
\n
"
);
}
if
(
target
)
{
virBufferAddLit
(
&
buf
,
" <target>
\n
"
);
virBufferVSprintf
(
&
buf
,
" <path>%s</path>
\n
"
,
target
);
virBufferAddLit
(
&
buf
,
" </target>
\n
"
);
}
virBufferAddLit
(
&
buf
,
"</pool>
\n
"
);
if
(
virBufferError
(
&
buf
))
{
vshPrint
(
ctl
,
"%s"
,
_
(
"Failed to allocate XML buffer"
));
if
(
!
buildPoolXML
(
cmd
,
&
name
,
&
xml
))
return
FALSE
;
}
xml
=
virBufferContentAndReset
(
&
buf
);
pool
=
virStoragePoolDefineXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
...
...
@@ -3081,11 +3044,8 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
return
TRUE
;
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to define pool %s"
),
name
);
return
FALSE
;
}
cleanup:
free
(
virBufferContentAndReset
(
&
buf
));
return
FALSE
;
}
...
...
@@ -5587,9 +5547,9 @@ static const vshCmdDef commands[] = {
{
"pool-autostart"
,
cmdPoolAutostart
,
opts_pool_autostart
,
info_pool_autostart
},
{
"pool-build"
,
cmdPoolBuild
,
opts_pool_build
,
info_pool_build
},
{
"pool-create"
,
cmdPoolCreate
,
opts_pool_create
,
info_pool_create
},
{
"pool-create-as"
,
cmdPoolCreateAs
,
opts_pool_
create
_as
,
info_pool_create_as
},
{
"pool-create-as"
,
cmdPoolCreateAs
,
opts_pool_
X
_as
,
info_pool_create_as
},
{
"pool-define"
,
cmdPoolDefine
,
opts_pool_define
,
info_pool_define
},
{
"pool-define-as"
,
cmdPoolDefineAs
,
opts_pool_
define
_as
,
info_pool_define_as
},
{
"pool-define-as"
,
cmdPoolDefineAs
,
opts_pool_
X
_as
,
info_pool_define_as
},
{
"pool-destroy"
,
cmdPoolDestroy
,
opts_pool_destroy
,
info_pool_destroy
},
{
"pool-delete"
,
cmdPoolDelete
,
opts_pool_delete
,
info_pool_delete
},
{
"pool-dumpxml"
,
cmdPoolDumpXML
,
opts_pool_dumpxml
,
info_pool_dumpxml
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录