Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
d48a24f6
Commit
d48a24f6
authored
Nov 19, 2013
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add API for ceph pools
parent
ccc4eb52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
Ceph.pm
PVE/API2/Ceph.pm
+114
-0
pveceph
bin/pveceph
+10
-0
No files found.
PVE/API2/Ceph.pm
View file @
d48a24f6
...
...
@@ -381,6 +381,7 @@ __PACKAGE__->register_method ({
{
name
=>
'
init
'
},
{
name
=>
'
mon
'
},
{
name
=>
'
osd
'
},
{
name
=>
'
pools
'
},
{
name
=>
'
stop
'
},
{
name
=>
'
start
'
},
{
name
=>
'
status
'
},
...
...
@@ -860,6 +861,119 @@ __PACKAGE__->register_method ({
return
&
$run_ceph_cmd_json
(['
status
'],
quiet
=>
1
);
}});
__PACKAGE__
->
register_method
({
name
=>
'
lspools
',
path
=>
'
pools
',
method
=>
'
GET
',
description
=>
"
List all pools.
",
proxyto
=>
'
node
',
protected
=>
1
,
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
},
},
returns
=>
{
type
=>
'
array
',
items
=>
{
type
=>
"
object
",
properties
=>
{
pool
=>
{
type
=>
'
integer
'
},
pool_name
=>
{
type
=>
'
string
'
},
size
=>
{
type
=>
'
integer
'
},
},
},
links
=>
[
{
rel
=>
'
child
',
href
=>
"
{pool_name}
"
}
],
},
code
=>
sub
{
my
(
$param
)
=
@_
;
&
$check_ceph_inited
();
my
$res
=
&
$run_ceph_cmd_json
(['
osd
',
'
dump
'],
quiet
=>
1
);
my
$data
=
[]
;
foreach
my
$e
(
@
{
$res
->
{
pools
}})
{
my
$d
=
{};
foreach
my
$attr
(
qw(pool pool_name size min_size pg_num crush_ruleset)
)
{
$d
->
{
$attr
}
=
$e
->
{
$attr
}
if
defined
(
$e
->
{
$attr
});
}
push
@$data
,
$d
;
}
return
$data
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
createpool
',
path
=>
'
pools
',
method
=>
'
POST
',
description
=>
"
Create POOL
",
proxyto
=>
'
node
',
protected
=>
1
,
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
name
=>
{
description
=>
"
The name of the pool. It must be unique.
",
type
=>
'
string
',
},
pg_num
=>
{
description
=>
"
Number of placement groups.
",
type
=>
'
integer
',
default
=>
512
,
optional
=>
1
,
minimum
=>
8
,
maximum
=>
32768
,
},
},
},
returns
=>
{
type
=>
'
null
'
},
code
=>
sub
{
my
(
$param
)
=
@_
;
&
$check_ceph_inited
();
die
"
not fully configured - missing '
$pve_ckeyring_path
'
\n
"
if
!
-
f
$pve_ckeyring_path
;
my
$pg_num
=
$param
->
{
pg_num
}
||
512
;
&
$run_ceph_cmd
(['
osd
',
'
pool
',
'
create
',
$param
->
{
name
},
$pg_num
]);
return
undef
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
destroypool
',
path
=>
'
pools/{name}
',
method
=>
'
DELETE
',
description
=>
"
Destroy pool
",
proxyto
=>
'
node
',
protected
=>
1
,
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
name
=>
{
description
=>
"
The name of the pool. It must be unique.
",
type
=>
'
string
',
},
},
},
returns
=>
{
type
=>
'
null
'
},
code
=>
sub
{
my
(
$param
)
=
@_
;
&
$check_ceph_inited
();
&
$run_ceph_cmd
(['
osd
',
'
pool
',
'
delete
',
$param
->
{
name
},
$param
->
{
name
},
'
--yes-i-really-really-mean-it
']);
return
undef
;
}});
__PACKAGE__
->
register_method
({
name
=>
'
listosd
',
path
=>
'
osd
',
...
...
bin/pveceph
View file @
d48a24f6
...
...
@@ -114,6 +114,16 @@ __PACKAGE__->register_method ({
my
$cmddef
=
{
init
=>
[
'
PVE::API2::Ceph
',
'
init
',
[]
,
{
node
=>
$nodename
}
],
lspools
=>
[
'
PVE::API2::Ceph
',
'
lspools
',
[]
,
{
node
=>
$nodename
},
sub
{
my
$res
=
shift
;
printf
("
%-20s %10s %10s
\n
",
"
Name
",
"
size
",
"
pg_num
");
foreach
my
$p
(
sort
{
$a
->
{
pool_name
}
cmp
$b
->
{
pool_name
}}
@$res
)
{
printf
("
%-20s %10d %10d
\n
",
$p
->
{
pool_name
},
$p
->
{
size
},
$p
->
{
pg_num
});
}
}],
createpool
=>
[
'
PVE::API2::Ceph
',
'
createpool
',
['
name
'],
{
node
=>
$nodename
}],
destroypool
=>
[
'
PVE::API2::Ceph
',
'
destroypool
',
['
name
'],
{
node
=>
$nodename
}
],
createosd
=>
[
'
PVE::API2::Ceph
',
'
createosd
',
['
dev
'],
{
node
=>
$nodename
}
],
destroyosd
=>
[
'
PVE::API2::Ceph
',
'
destroyosd
',
['
osdid
'],
{
node
=>
$nodename
}
],
createmon
=>
[
'
PVE::API2::Ceph
',
'
createmon
',
[]
,
{
node
=>
$nodename
}
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment