Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Chen Yisong
lxc
Commits
c476a797
Unverified
Commit
c476a797
authored
Aug 15, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "rbd: rbd non-functional changes"
This reverts commit
162a857a
. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a1ca5dd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
lxcrbd.c
src/lxc/bdev/lxcrbd.c
+14
-17
No files found.
src/lxc/bdev/lxcrbd.c
View file @
c476a797
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#define _GNU_SOURCE
#define _GNU_SOURCE
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#include <inttypes.h>
/* Required for PRIu64 to work. */
#include <inttypes.h>
/* Required for PRIu64 to work. */
#include <stdint.h>
#include <stdint.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -37,15 +37,15 @@
...
@@ -37,15 +37,15 @@
lxc_log_define
(
lxcrbd
,
lxc
);
lxc_log_define
(
lxcrbd
,
lxc
);
int
rbd_clonepaths
(
struct
bdev
*
orig
,
struct
bdev
*
new
,
const
char
*
oldname
,
int
rbd_clonepaths
(
struct
bdev
*
orig
,
struct
bdev
*
new
,
const
char
*
oldname
,
const
char
*
cname
,
const
char
*
oldpath
,
const
char
*
lxcpath
,
const
char
*
cname
,
const
char
*
oldpath
,
const
char
*
lxcpath
,
int
snap
,
uint64_t
newsize
,
struct
lxc_conf
*
conf
)
int
snap
,
uint64_t
newsize
,
struct
lxc_conf
*
conf
)
{
{
ERROR
(
"rbd clonepaths not implemented"
);
ERROR
(
"rbd clonepaths not implemented"
);
return
-
1
;
return
-
1
;
}
}
int
rbd_create
(
struct
bdev
*
bdev
,
const
char
*
dest
,
const
char
*
n
,
int
rbd_create
(
struct
bdev
*
bdev
,
const
char
*
dest
,
const
char
*
n
,
struct
bdev_specs
*
specs
)
struct
bdev_specs
*
specs
)
{
{
const
char
*
rbdpool
,
*
rbdname
=
n
,
*
fstype
;
const
char
*
rbdpool
,
*
rbdname
=
n
,
*
fstype
;
uint64_t
size
;
uint64_t
size
;
...
@@ -75,21 +75,20 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
...
@@ -75,21 +75,20 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
if
(
ret
<
0
||
ret
>=
len
)
if
(
ret
<
0
||
ret
>=
len
)
return
-
1
;
return
-
1
;
/
* fssize is in bytes */
/
/ fssize is in bytes.
size
=
specs
->
fssize
;
size
=
specs
->
fssize
;
if
(
!
size
)
if
(
!
size
)
size
=
DEFAULT_FS_SIZE
;
size
=
DEFAULT_FS_SIZE
;
/
* in megabytes for rbd tool */
/
/ in megabytes for rbd tool
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
,
size
/
1024
/
1024
);
ret
=
snprintf
(
sz
,
24
,
"%"
PRIu64
,
size
/
1024
/
1024
);
if
(
ret
<
0
||
ret
>=
24
)
if
(
ret
<
0
||
ret
>=
24
)
exit
(
1
);
exit
(
1
);
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"create"
,
"--pool"
,
rbdpool
,
rbdname
,
execlp
(
"rbd"
,
"rbd"
,
"create"
,
"--pool"
,
rbdpool
,
rbdname
,
"--size"
,
sz
,
(
char
*
)
NULL
);
"--size"
,
sz
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -98,8 +97,7 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
...
@@ -98,8 +97,7 @@ int rbd_create(struct bdev *bdev, const char *dest, const char *n,
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"map"
,
"--pool"
,
rbdpool
,
rbdname
,
execlp
(
"rbd"
,
"rbd"
,
"map"
,
"--pool"
,
rbdpool
,
rbdname
,
(
char
*
)
NULL
);
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -138,7 +136,7 @@ int rbd_destroy(struct bdev *orig)
...
@@ -138,7 +136,7 @@ int rbd_destroy(struct bdev *orig)
if
((
pid
=
fork
())
<
0
)
if
((
pid
=
fork
())
<
0
)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
execlp
(
"rbd"
,
"rbd"
,
"unmap"
,
src
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"unmap"
,
src
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
if
(
wait_for_pid
(
pid
)
<
0
)
if
(
wait_for_pid
(
pid
)
<
0
)
...
@@ -149,11 +147,12 @@ int rbd_destroy(struct bdev *orig)
...
@@ -149,11 +147,12 @@ int rbd_destroy(struct bdev *orig)
return
-
1
;
return
-
1
;
if
(
!
pid
)
{
if
(
!
pid
)
{
rbdfullname
=
alloca
(
strlen
(
src
)
-
8
);
rbdfullname
=
alloca
(
strlen
(
src
)
-
8
);
strcpy
(
rbdfullname
,
&
src
[
9
]
);
strcpy
(
rbdfullname
,
&
src
[
9
]
);
execlp
(
"rbd"
,
"rbd"
,
"rm"
,
rbdfullname
,
(
char
*
)
NULL
);
execlp
(
"rbd"
,
"rbd"
,
"rm"
,
rbdfullname
,
(
char
*
)
NULL
);
exit
(
1
);
exit
(
1
);
}
}
return
wait_for_pid
(
pid
);
return
wait_for_pid
(
pid
);
}
}
int
rbd_detect
(
const
char
*
path
)
int
rbd_detect
(
const
char
*
path
)
...
@@ -174,9 +173,7 @@ int rbd_mount(struct bdev *bdev)
...
@@ -174,9 +173,7 @@ int rbd_mount(struct bdev *bdev)
src
=
lxc_storage_get_path
(
bdev
->
src
,
bdev
->
type
);
src
=
lxc_storage_get_path
(
bdev
->
src
,
bdev
->
type
);
if
(
!
file_exists
(
src
))
{
if
(
!
file_exists
(
src
))
{
/* If blkdev does not exist it should be mapped, because it is
// if blkdev does not exist it should be mapped, because it is not persistent on reboot
* not persistent on reboot.
*/
ERROR
(
"Block device %s is not mapped."
,
bdev
->
src
);
ERROR
(
"Block device %s is not mapped."
,
bdev
->
src
);
return
-
1
;
return
-
1
;
}
}
...
...
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