本文整理匯總了Golang中github.com/heketi/heketi/executors.Executor.VolumeCreate方法的典型用法代碼示例。如果您正苦於以下問題:Golang Executor.VolumeCreate方法的具體用法?Golang Executor.VolumeCreate怎麽用?Golang Executor.VolumeCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/heketi/heketi/executors.Executor
的用法示例。
在下文中一共展示了Executor.VolumeCreate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createVolume
func (v *VolumeEntry) createVolume(db *bolt.DB,
executor executors.Executor,
brick_entries []*BrickEntry) error {
godbc.Require(db != nil)
godbc.Require(brick_entries != nil)
// Create a volume request for executor with
// the bricks allocated
vr, host, err := v.createVolumeRequest(db, brick_entries)
if err != nil {
return err
}
// Create the volume
_, err = executor.VolumeCreate(host, vr)
if err != nil {
return err
}
// Get all brick hosts
stringset := utils.NewStringSet()
for _, brick := range vr.Bricks {
stringset.Add(brick.Host)
}
hosts := stringset.Strings()
v.Info.Mount.GlusterFS.Hosts = hosts
// Save volume information
v.Info.Mount.GlusterFS.MountPoint = fmt.Sprintf("%v:%v",
hosts[0], vr.Name)
// Set glusterfs mount volfile-servers options
v.Info.Mount.GlusterFS.Options = make(map[string]string)
v.Info.Mount.GlusterFS.Options["backup-volfile-servers"] =
strings.Join(hosts[1:], ",")
godbc.Ensure(v.Info.Mount.GlusterFS.MountPoint != "")
return nil
}