-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.go_bak
69 lines (61 loc) · 1.91 KB
/
test.go_bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
// See https://docs.qingcloud.com/api/lb/index.html
// qingcloud loadBalancer and instance have a default strict Security Group(firewall),
// its only allow SSH and PING. So, first of all, you shoud manually add correct rules
// for all nodes and loadBalancers. You can simply add a rule by pass all tcp port traffic.
// The loadBalancers also need at least one EIP before create it, please allocate some EIPs,
// and set them in service annotation ServiceAnnotationLoadBalancerEipIds.
import (
// "github.com/golang/glog"
"fmt"
"io/ioutil"
"log"
"os"
"syscall"
//qcservice "github.com/yunify/qingcloud-sdk-go/service"
)
func main() {
// glog.V(3).Infof("test client %s", qcclient.InstanceStatusCeased)
//fmt.Println("test client", qcclient.InstanceStatusCeased)
/* status := []*string{qcservice.String("pending"), qcservice.String("active"), qcservice.String("stopped")}
var name = "lb-lmld6diw"
output, err := qcservice.LoadBalancerService.DescribeLoadBalancers(&qcservice.DescribeLoadBalancersInput{
Status: status,
SearchWord: &name,
})
if err != nil {
fmt.Print(err)
}
if len(output.LoadBalancerSet) == 0 {
fmt.Print("no data")
}
for _, lb := range output.LoadBalancerSet {
if lb.LoadBalancerName != nil && *lb.LoadBalancerName == "lb-lmld6diw" {
fmt.Print(lb)
}
} */
files, err := ioutil.ReadDir("/usr/bin")
if err != nil {
log.Fatal(err)
}
for _, f := range files {
//fstat, err := os.Lstat("/usr/bin/" + f.Name())
//if err != nil {
// log.Fatal(err)
//}
//fmt.Println(fstat.Name())
dev, err := os.Stat("/usr/bin/" + f.Name())
if err != nil {
os.Exit(1)
}
sys, ok := dev.Sys().(*syscall.Stat_t)
if !ok {
os.Exit(1)
}
//major := sys.Rdev / 256
//minor := sys.Rdev % 256
//sys.Nlink
//devNumStr := fmt.Sprintf("%d:%d", major, minor)
fmt.Println("get dev mapper %s", sys.Nlink)
}
}