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
c04392c7
Commit
c04392c7
authored
Dec 21, 2013
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: allow to specify network
parent
67c2ce0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
Ceph.pm
PVE/API2/Ceph.pm
+40
-3
No files found.
PVE/API2/Ceph.pm
View file @
c04392c7
...
...
@@ -8,6 +8,7 @@ use POSIX qw (LONG_MAX);
use
Cwd
qw(abs_path)
;
use
IO::
Dir
;
use
UUID
;
use
Net::
IP
;
use
PVE::
SafeSyslog
;
use
PVE::
Tools
qw(extract_param run_command file_get_contents file_read_firstline dir_glob_regex dir_glob_foreach)
;
...
...
@@ -503,6 +504,12 @@ __PACKAGE__->register_method ({
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
network
=>
{
description
=>
"
Use specific network for all ceph related traffic
",
type
=>
'
string
',
format
=>
'
CIDR
',
optional
=>
1
,
maxLength
=>
128
,
},
size
=>
{
description
=>
'
Number of replicas per object
',
type
=>
'
integer
',
...
...
@@ -563,7 +570,12 @@ __PACKAGE__->register_method ({
$cfg
->
{
global
}
->
{'
osd pg bits
'}
=
$param
->
{
pg_bits
};
$cfg
->
{
global
}
->
{'
osd pgp bits
'}
=
$param
->
{
pg_bits
};
}
if
(
$param
->
{
network
})
{
$cfg
->
{
global
}
->
{'
public network
'}
=
$param
->
{
network
};
$cfg
->
{
global
}
->
{'
cluster network
'}
=
$param
->
{
network
};
}
&
$write_ceph_config
(
$cfg
);
&
$setup_pve_symlinks
();
...
...
@@ -571,6 +583,24 @@ __PACKAGE__->register_method ({
return
undef
;
}});
my
$find_node_ip
=
sub
{
my
(
$cidr
)
=
@_
;
my
$config
=
PVE::INotify::
read_file
('
interfaces
');
my
$net
=
Net::
IP
->
new
(
$cidr
)
||
die
Net::IP::
Error
()
.
"
\n
";
foreach
my
$iface
(
keys
%
$config
)
{
my
$d
=
$config
->
{
$iface
};
next
if
!
$d
->
{
address
};
my
$a
=
Net::
IP
->
new
(
$d
->
{
address
});
next
if
!
$a
;
return
$d
->
{
address
}
if
$net
->
overlaps
(
$a
);
}
die
"
unable to find local address within network '
$cidr
'
\n
";
};
__PACKAGE__
->
register_method
({
name
=>
'
createmon
',
path
=>
'
mon
',
...
...
@@ -622,8 +652,15 @@ __PACKAGE__->register_method ({
}
die
"
unable to find usable monitor id
\n
"
if
!
defined
(
$monid
);
my
$monsection
=
"
mon.
$monid
";
my
$monaddr
=
PVE::Cluster::
remote_node_ip
(
$param
->
{
node
})
.
"
:6789
";
my
$monsection
=
"
mon.
$monid
";
my
$ip
;
if
(
my
$pubnet
=
$cfg
->
{
global
}
->
{'
public network
'})
{
$ip
=
&
$find_node_ip
(
$pubnet
);
}
else
{
$ip
=
PVE::Cluster::
remote_node_ip
(
$param
->
{
node
});
}
my
$monaddr
=
"
$ip
:6789
";
my
$monname
=
$param
->
{
node
};
die
"
monitor '
$monsection
' already exists
\n
"
if
$cfg
->
{
$monsection
};
...
...
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