mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
Remove dead code
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
parent
eaadeec2dc
commit
9f76f6bd59
@ -68,10 +68,6 @@ func init() {
|
|||||||
cephSecretTempl = template.Must(template.New("secret").Parse(cephSecret))
|
cephSecretTempl = template.Must(template.New("secret").Parse(cephSecret))
|
||||||
}
|
}
|
||||||
|
|
||||||
type cephConfigWriter interface {
|
|
||||||
writeToFile() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type cephConfigData struct {
|
type cephConfigData struct {
|
||||||
Monitors string
|
Monitors string
|
||||||
VolumeID volumeID
|
VolumeID volumeID
|
||||||
|
@ -47,8 +47,7 @@ type rbd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
rbdDriver *rbd
|
version = "1.0.0"
|
||||||
version = "1.0.0"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRBDDriver() *rbd {
|
func GetRBDDriver() *rbd {
|
||||||
|
@ -46,18 +46,6 @@ func init() {
|
|||||||
hasNBD = checkRbdNbdTools()
|
hasNBD = checkRbdNbdTools()
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDevFromImageAndPool(pool, image string) (string, bool) {
|
|
||||||
device, found := getRbdDevFromImageAndPool(pool, image)
|
|
||||||
if found {
|
|
||||||
return device, true
|
|
||||||
}
|
|
||||||
device, found = getNbdDevFromImageAndPool(pool, image)
|
|
||||||
if found {
|
|
||||||
return device, true
|
|
||||||
}
|
|
||||||
return "", false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search /sys/bus for rbd device that matches given pool and image.
|
// Search /sys/bus for rbd device that matches given pool and image.
|
||||||
func getRbdDevFromImageAndPool(pool string, image string) (string, bool) {
|
func getRbdDevFromImageAndPool(pool string, image string) (string, bool) {
|
||||||
// /sys/bus/rbd/devices/X/name and /sys/bus/rbd/devices/X/pool
|
// /sys/bus/rbd/devices/X/name and /sys/bus/rbd/devices/X/pool
|
||||||
|
@ -30,11 +30,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
imageWatcherStr = "watcher="
|
imageWatcherStr = "watcher="
|
||||||
rbdImageFormat1 = "1"
|
|
||||||
rbdImageFormat2 = "2"
|
rbdImageFormat2 = "2"
|
||||||
imageSizeStr = "size "
|
|
||||||
sizeDivStr = " MB in"
|
|
||||||
kubeLockMagic = "kubelet_lock_magic_"
|
|
||||||
// The following three values are used for 30 seconds timeout
|
// The following three values are used for 30 seconds timeout
|
||||||
// while waiting for RBD Watcher to expire.
|
// while waiting for RBD Watcher to expire.
|
||||||
rbdImageWatcherInitDelay = 1 * time.Second
|
rbdImageWatcherInitDelay = 1 * time.Second
|
||||||
|
@ -35,7 +35,7 @@ type CachePersister interface {
|
|||||||
Delete(identifier string) error
|
Delete(identifier string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCachePersister(metadataStore string, driverName string) (CachePersister, error) {
|
func NewCachePersister(metadataStore, driverName string) (CachePersister, error) {
|
||||||
if metadataStore == "k8s_configmap" {
|
if metadataStore == "k8s_configmap" {
|
||||||
glog.Infof("cache-perister: using kubernetes configmap as metadata cache persister")
|
glog.Infof("cache-perister: using kubernetes configmap as metadata cache persister")
|
||||||
k8scm := &K8sCMCache{}
|
k8scm := &K8sCMCache{}
|
||||||
|
@ -119,33 +119,32 @@ func (k8scm *K8sCMCache) Create(identifier string, data interface{}) error {
|
|||||||
if cm != nil && err == nil {
|
if cm != nil && err == nil {
|
||||||
glog.V(4).Infof("k8s-cm-cache: configmap already exists, skipping configmap creation")
|
glog.V(4).Infof("k8s-cm-cache: configmap already exists, skipping configmap creation")
|
||||||
return nil
|
return nil
|
||||||
} else {
|
|
||||||
dataJson, err := json.Marshal(data)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "k8s-cm-cache: marshal error")
|
|
||||||
}
|
|
||||||
cm := &v1.ConfigMap{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: identifier,
|
|
||||||
Namespace: k8scm.Namespace,
|
|
||||||
Labels: map[string]string{
|
|
||||||
csiMetadataLabelAttr: cmLabel,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Data: map[string]string{},
|
|
||||||
}
|
|
||||||
cm.Data[cmDataKey] = string(dataJson)
|
|
||||||
|
|
||||||
_, err = k8scm.Client.CoreV1().ConfigMaps(k8scm.Namespace).Create(cm)
|
|
||||||
if err != nil {
|
|
||||||
if apierrs.IsAlreadyExists(err) {
|
|
||||||
glog.V(4).Infof("k8s-cm-cache: configmap already exists")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return errors.Wrapf(err, "k8s-cm-cache: couldn't persist %s metadata as configmap", identifier)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
dataJSON, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "k8s-cm-cache: marshal error")
|
||||||
|
}
|
||||||
|
cm = &v1.ConfigMap{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: identifier,
|
||||||
|
Namespace: k8scm.Namespace,
|
||||||
|
Labels: map[string]string{
|
||||||
|
csiMetadataLabelAttr: cmLabel,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Data: map[string]string{},
|
||||||
|
}
|
||||||
|
cm.Data[cmDataKey] = string(dataJSON)
|
||||||
|
|
||||||
|
_, err = k8scm.Client.CoreV1().ConfigMaps(k8scm.Namespace).Create(cm)
|
||||||
|
if err != nil {
|
||||||
|
if apierrs.IsAlreadyExists(err) {
|
||||||
|
glog.V(4).Infof("k8s-cm-cache: configmap already exists")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.Wrapf(err, "k8s-cm-cache: couldn't persist %s metadata as configmap", identifier)
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(4).Infof("k8s-cm-cache: configmap %s successfully created\n", identifier)
|
glog.V(4).Infof("k8s-cm-cache: configmap %s successfully created\n", identifier)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user