출처 :  http://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=105&oid=092&aid=0002122634 



홍콩 과기대 김성훈 교수(http://www.sciencetimes.co.kr/?news=%EC%A7%80%EB%B0%A9%EC%8B%A4%EC%97%85%EA%B3%A0-%EC%B6%9C%EC%8B%A0%EC%9D%B4-%ED%99%8D%EC%BD%A9%EA%B3%BC%EA%B8%B0%EB%8C%80-%EC%A1%B0%EA%B5%90%EC%88%98%EB%A1%9C)가 네이버 연구팀으로 합류한다고 한다. 



참고 : 김성훈 교수의 머신러닝 공부 내용 정리

https://hunkim.github.io/ml/ 



Posted by '김용환'
,


go언어에서 에러 발생에 대한 예제이다.


숫자 1만 받고 나머지는 에러로 표현하는 예제이다. 함수 뒤에 (..., error)로 표현한다. 

fmt.Errorf를 사용한다 하더라도 실제로 Error를 출력하지 않는다. log.Fatal과 함께 표현해야 에러 로그를 출력한다. 


package main

import (
"fmt"
"log"
)

func main() {
checkOnly1(1)
checkOnly1(-1)
}

func checkOnly1(n int) {
result, err := only1(n)
fmt.Println("result of only1 call :", result)
if (err != nil) {
log.Fatal(err)
}
}

func only1(number int) (bool, error) {
if number == 1 {
return true, nil
}
return false, fmt.Errorf("%d != 1", number)
}



결과는 다음과 같다.


result of only1 call : true

result of only1 call : false

2017/09/07 14:18:06 -1 != 1

exit status 1




go 언어 예제를 보면 아래처럼 많이 사용한다. 

req, err := http.NewRequest("GET", "url", *tag), nil)





error 소스를 보면 다음과 같다. 어디든지 사용할 수 있는 interface이다. 


type error interface {
Error() string
}





패닉(panic)을 써보자.


package main

import (
"fmt"
"log"
)

func main() {
checkOnly1(1)
checkOnly1(-1)
}

func checkOnly1(n int) {
//
//defer func() {
// r := recover()
// fmt.Println(r)
//}()

result, err := only1(n)
fmt.Println("result of only1 call :", result)
if (err != nil) {
fmt.Println("before panic")
log.Panic(err)
}

fmt.Println("after panic")
}

func only1(number int) (bool, error) {
if number == 1 {
return true, nil
}
return false, fmt.Errorf("%d != 1", number)
}


결과는 다음과 같다.


에러(패닉)이 발생하면서 exit status가 2(serious problem)를 리턴했다. 

바로 종료되지 않고 main 함수 모든 내용이 실행되었다. 



2017/09/07 23:56:42 -1 != 1

result of only1 call : true

after panic

result of only1 call : false

before panic

panic: -1 != 1


goroutine 1 [running]:

log.Panic(0xc42003df00, 0x1, 0x1)

/usr/local/go/src/log/log.go:322 +0xc0

main.checkOnly1(0xffffffffffffffff)

/Users/samuel.kim/go/src/google/Test.go:24 +0x29f

main.main()

/Users/samuel.kim/go/src/google/Test.go:10 +0x37

exit status 2




defer를 사용해 패닉이 발생하더라도 얌전히(?) 종료시킬 수 있다. 


package main

import (
"fmt"
"log"
)

func main() {
checkOnly1(1)
checkOnly1(-1)
}

func checkOnly1(n int) {

defer func() {
r := recover()
fmt.Println(r)
}()

result, err := only1(n)
fmt.Println("result of only1 call :", result)
if (err != nil) {
fmt.Println("before panic")
log.Panic(err)
}

fmt.Println("after panic")
}

func only1(number int) (bool, error) {
if number == 1 {
return true, nil
}
return false, fmt.Errorf("%d != 1", number)
}


순서가 어그러졌지만 패닉을 잘 막았다. 


result of only1 call : true

2017/09/07 23:58:29 -1 != 1

after panic

<nil>

result of only1 call : false

before panic

-1 != 1





'golang' 카테고리의 다른 글

[golang] 고루틴(go routine) 예제  (0) 2017.09.08
[golang] 매개 변수 받기  (0) 2017.09.08
[golang] defer 예제  (0) 2017.09.07
[golang] interface(인터페이스) 예제  (0) 2017.09.06
[golang] 함수.클로져 예제  (0) 2017.09.06
Posted by '김용환'
,

[golang] defer 예제

golang 2017. 9. 7. 11:58


defer는 함수를 사용하면 해당 함수를 호출한 함수가 종료할 때 호출된다.


package main

import "fmt"

func main() {
s := [5]int{10, 20, 30, 40, 50}
for i, number := range s {
fmt.Println(i, number)
}

println("\nßdefer--")
for i, number := range s {
defer fmt.Println(i, number)
}
}



결과는 다음과 같다.


0 10

1 20

2 30

3 40

4 50

defer--

4 50

3 40

2 30

1 20

0 10



스택에 쌓인 것을 하나씩 종료 하는 것처럼 보인다.


보통 소켓을 정리할 때 많이 사용된다. 


defer resp.Body.Close()





'golang' 카테고리의 다른 글

[golang] 매개 변수 받기  (0) 2017.09.08
[golang] 에러(error) 예제  (0) 2017.09.07
[golang] interface(인터페이스) 예제  (0) 2017.09.06
[golang] 함수.클로져 예제  (0) 2017.09.06
[golang] 구조체 초기화/메소드 예제  (0) 2017.08.30
Posted by '김용환'
,



페이스북의 react js관련해 글이 있다.



https://code.facebook.com/posts/112130496157735/explaining-react-s-license/

사용자가 페이스북에 대해서 어떠한 특허 소송이라도 제기하는 경우 자동으로 React에 대한 특허 사용권한을 잃게 됩니다.


관련 github issue


https://github.com/facebook/react/issues/10191



페이스북 대응 - 우리는 그대로 간다!


https://code.facebook.com/posts/112130496157735/explaining-react-s-license/


We have considered possible changes carefully, but we won't be changing our default license or React's license at this time. We recognize that we may lose some React community members because of this decision. We are sorry for that, but we need to balance our desire to participate in open source with our desire to protect ourselves from costly litigation.





그러나.. 9월 22일 React16부터는 MIT 라이선스로 간다고 한다. 


https://code.facebook.com/posts/300798627056246


Next week, we are going to relicense our open source projects React, Jest, Flow, and Immutable.js under the MIT license. 



Posted by '김용환'
,

go의 interface는 OO개념이 아니다. struct에서 적당히 호출할 수 있는 형태로 만들어줄 수 있다. 


package main

import "fmt"

type Rectangle struct {
X1 int
Y1 int
X2 int
Y2 int
}

type Get interface {
getX1() int
}

func main() {
r := Rectangle{1,1,2,2,}
showGet(r)
}

func (r Rectangle) getX1() int{
return r.X1
}

func showGet(get Get) {
x := get.getX1()
fmt.Println(x)
}


결과값은 1이다.






이 뿐 아니라 아무거나 넣을 수 있는 void * 이기도 하다.


package main

import "fmt"

func main() {
var a interface{}
printInterface(a)

a = 1
printInterface(a)

a = "a"
printInterface(a)

r := Rectangle{1,2,3,4}
printInterface(r)
}

func printInterface(i interface{}) {
fmt.Println(i)
}

type Rectangle struct {
X1 int
Y1 int
X2 int
Y2 int
}



결과는 다음과 같다.


<nil>

1

a

{1 2 3 4}


'golang' 카테고리의 다른 글

[golang] 매개 변수 받기  (0) 2017.09.08
[golang] 에러(error) 예제  (0) 2017.09.07
[golang] defer 예제  (0) 2017.09.07
[golang] 함수.클로져 예제  (0) 2017.09.06
[golang] 구조체 초기화/메소드 예제  (0) 2017.08.30
Posted by '김용환'
,


go의 함수는 호출하는 함수 위, 아래에 존재할 수 있다.  { 위치에 따라 에러가 날 수 있다...

package main

import "fmt"


func main() {
helloWorld()
helloWorldGivenString("Samuel")
}

func helloWorld() {
fmt.Println("HelloWorld")
}

func helloWorldGivenString(str string) {
fmt.Println("HelloWorld " + str)
}








리턴 값이 여러 개가 될 수 있고, 매개 변수에 가변 변수를 사용할 수 있다. 


package main

import "fmt"


func main() {
fmt.Println(getTwoInteger())

_, _, last := getThree()
fmt.Println(last)


total1 := sum(1,2,3)
fmt.Println(total1)


total2 := add(3)
fmt.Println(total2)
}

func getTwoInteger() (int, int){
return 1, 1
}

func getThree() (int, string, string){
return 1, "a", "b"
}

func sum(n...int) int {
var total = 0
for _, value := range n {
total += value
}

return total
}

func add(n int) int {
if n > 4 {
return 0
}
return n+add(n+1)
}


결과는 다음과 같다.


1 1

b

6

7



파서가 좋아서 그런지 대충 써도 가변 변수는 잘 동작한다.

n ...int

n...int

n ... int



다음은 함수를 변수에 할당할 수 있음을 보여주는 예제이다. 

package main

import "fmt"


func getTwoInteger() (int, int){
return 1, 1
}

func main() {
var function1 func() (int, int) = getTwoInteger
function2 := getTwoInteger

fmt.Println(function1())
fmt.Println(function2())
}

결과는 다음과 같다.


1 1

1 1




익명 함수를 사용하는 예제이다. 


package main

import "fmt"

func main() {
func() {
fmt.Println("Hello, World")
}()

f := func() {
fmt.Println("Hello, World")
}
f()
}

결과는 다음과 같다.


Hello, World

Hello, World




함수를 클로저(closure)로 사용할 수 있다. 클로저는 함수 바깥의 값을 참조하는 함수 값을 의미한다.


package main

import "fmt"


func minusValue(n int) func() int {
i := n
return func() int {
i--
return i
}
}

func main() {
next := minusValue(10)
fmt.Println(next())
fmt.Println(next())
fmt.Println(next())
fmt.Println(next())
}

결과는 다음과 같다.


9

8

7

6

'golang' 카테고리의 다른 글

[golang] 매개 변수 받기  (0) 2017.09.08
[golang] 에러(error) 예제  (0) 2017.09.07
[golang] defer 예제  (0) 2017.09.07
[golang] interface(인터페이스) 예제  (0) 2017.09.06
[golang] 구조체 초기화/메소드 예제  (0) 2017.08.30
Posted by '김용환'
,



map을 생성할 때는 make를 사용한다. 


그리고 map의 값에 여러 매개 변수가 있을 때 구분자를 , 를 사용하는데, 끝에도 사용해야 에러가 발생하지 않는다. 


package main

import "fmt"

type Member struct {
name, dept string
a int
}

var m map[string]string
var members map[int]Member

func main() {
m = make(map[string]string)
m["key1"] = "value1"
m["key2"] = "value2"

fmt.Println(m["key1"])
fmt.Println(m["key2"])

members = make(map[int]Member)
members[1] = Member{
"samuel", "personal", 1,
}
members[2] = Member{
"jacks", "development", 2,
}

fmt.Println(members[1])
fmt.Println(members[2])
}

결과


value1

value2

{samuel personal 1}

{jacks development 2}





map 생성할 때 make를 사용하지 않고 일반 언어처럼 바로 생성할 수도 있다. 



var member2 = map[int]Member {
1 : {"hardy", "development", 1},
2 : {"jenny", "personal", 2},
}

fmt.Println(member2)


결과


map[1:{hardy development 1} 2:{jenny personal 2}]





2개를 리턴받을 수 있는데, 앞 매개변수는 값, 뒷 매개변수는 결과를 나타난다.


a, result := m["key2"]
fmt.Println(a, result)

b, result := members[2]
fmt.Println(b, result)

결과는 다음과 같다.


value2 true

{jacks development 2} true






map의 키,값, 키만, 값만 얻는 예제이다. 


fmt.Println("==1 (key value)")
for key, value := range members {
fmt.Println("Key:", key, "Value:", value)
}

fmt.Println("==2 (only key)")
for value := range members {
fmt.Println("value:", value)
}

fmt.Println("==3 (only value)")
for _, value := range members {
fmt.Println("value:", value)
}



결과는 다음과 같다. 


==1 (key value)

Key: 1 Value: {samuel personal 1}

Key: 2 Value: {jacks development 2}

==2 (only key)

value: 1

value: 2

==3 (only value)

value: {samuel personal 1}

value: {jacks development 2}





변경과 삭제는 다음과 같다.



m["key1"] = "newValue1"
fmt.Println(m["key1"])

delete(m, "key1")
fmt.Println(m["key1"])







Posted by '김용환'
,



https://golang.org/doc/faq#unused_variables_and_imports


Can I stop these complaints about my unused variable/import?

The presence of an unused variable may indicate a bug, while unused imports just slow down compilation, an effect that can become substantial as a program accumulates code and programmers over time. For these reasons, Go refuses to compile programs with unused variables or imports, trading short-term convenience for long-term build speed and program clarity.

Still, when developing code, it's common to create these situations temporarily and it can be annoying to have to edit them out before the program will compile.

Some have asked for a compiler option to turn those checks off or at least reduce them to warnings. Such an option has not been added, though, because compiler options should not affect the semantics of the language and because the Go compiler does not report warnings, only errors that prevent compilation.

There are two reasons for having no warnings. First, if it's worth complaining about, it's worth fixing in the code. (And if it's not worth fixing, it's not worth mentioning.) Second, having the compiler generate warnings encourages the implementation to warn about weak cases that can make compilation noisy, masking real errors that should be fixed.

It's easy to address the situation, though. Use the blank identifier to let unused things persist while you're developing.

import "unused"

// This declaration marks the import as used by referencing an
// item from the package.
var _ = unused.Item  // TODO: Delete before committing!

func main() {
    debugData := debug.Profile()
    _ = debugData // Used only during debugging.
    ....
} 
Nowadays, most Go programmers use a tool, goimports, which automatically rewrites a Go source file to have the correct imports, eliminating the unused imports issue in practice. This program is easily connected to most editors to run automatically when a Go source file is written.


 
import (
"fmt"
)


import "fmt"


./Test.go:3: imported and not used: "fmt"




아래와 같이 해야 에러가 발생하지 않는다. 



import (
_ "fmt"
)

func main() {

}






func main() {
i := 0
_ = i
}


Posted by '김용환'
,



By applying policy-based reinforcement learning with a query

execution environment to WikiSQL, our model Seq2SQL outperforms attentional

sequence to sequence models, improving execution accuracy from 35.9% to 60.3%

and logical form accuracy from 23.4% to 49.2%.



http://m.zdnet.co.kr/news_view.asp?article_id=20170831082744#imadnews

https://www.salesforce.com/blog/2017/08/salesforce-research-ai-talk-to-data

https://github.com/salesforce/WikiSQL

https://einstein.ai/static/images/layouts/research/seq2sql/seq2sql.pdf




Posted by '김용환'
,





맥에서 virtualbox(5.1.6)를 설치해서 오픈 스택을 구성하기 위해 ubuntu OS(16.04-64)를 설치하던 중에 


virtualbox에서 guest OS 설치할 때 호스트 전용 어댑터를 못찾을 수 있다.






VirtuBox-일반설정-네트워크-호스트 전용 네트워크 를 보면, 비어 있다.


창 오른쪽에 +네트워크카드를 선택하면 vboxnet0을 생성할 수 있다. 


-네트워크카드를 선택하면 선택한 네트워크 카드를 삭제할 수 있다.


곤봉 아이콘을 선택하면 어댑터/DHCP 정보가 나타난다. 

어댑터의 IP는 192.168.56.1/255.255.255.0으로 나타나고, DHCP 서버는 192.168.56.100이고 서버마스크는 255.255.255.0이며 주소의 한계는 192.168.56.101~192.168.56.254로 나타난다. (잘 기억하자!)




VirtuBox-일반설정-네트워크-NAT 네트워크 를 보면, 비어 있다.

호스트 전용 네트워크처럼 하나의 네트워크 카드를 추가한다. NatNetwork를 설정한다. 나중에 도움이 될 수 있다. 







vboxnet0을 생성한 후, guestOS를 셋팅한다.



guest OS- 설정-네트워크-어댑터1에서 

호스트 전용 어댑터로 설정하고 이름은 이전에 설정한 vobxnet0로 연결할 수 있다. 무작위 모드는 모두 허용으로 한다.

추후 enp0s3이고 내부용 네트워크이다.  



guest OS- 설정-네트워크-어댑터2에서

브리지 어댑터로 설정하고 en0:WI-FI(AirPort)로 설정하고 무작위 모드는 모두 허용으로 한다.

추후 enp0s8이고 외부용 네트워크이다.

(환경에 따라 사실 잘 동작되지 않을 수 있고, 언젠가는 되겠지 하며 접근해보았다. 안되도 openstack에는 영향이 없다.)




어댑터2가 동작되지 않을 수 있는 환경을 대비해 

guest OS- 설정-네트워크-어댑터3에서 NAT 어댑터를 설정한다. 






이제, guest OS(ubuntu)를 실행시켜 설치한다.







네트워크를 작업한다. enp0s8은 사설 네트워크에서는 잘 동작할 수 있지만, 특정 상황에서는 잘 동작되지 않을 수 있다. 이 때는 enp0s9 (이전에 설정한 NAT 네트워크의 도움을 받으면서 진행할 수 있다)


$ sudo vi /etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo  

iface lo inet loopback


auto enp0s3  

iface enp0s3 inet dhcp


auto enp0s8  

iface enp0s8 inet static  

address 192.168.56.101

netmask 255.255.255.0  

network 192.168.56.0  



네트워킹 데몬을 초기화한다.


$ sudo systemctl restart networking



역시 enp0s8은 잘 동작하지 않는다. 하지만 어차피 내부는 동작하니까. 그대로 진행해 본다. 





enps0s3과 enps0s8은 각각 다음과 같이 정해졌다.

$ ifconfig

..

enp0s3  inet addr:192.168.56.102

..




호스트 OS(맥)에서 게스트 OS(우분투)가 정상적인지 ping 을 실행해 본다.


$ ping 192.168.56.1

$ ping 192.168.56.102




우분투에서 ssh server를 설치 / 실행한다.

(The following packages have unmet dependencies: 에러가 나오면 update를 실행하면 된다)


$ sudo apt-get update


$ sudo apt-get install openssh-server 


$ sudo systemctl enable ssh


$ sudo systemctl start ssh






호스트 OS(맥)에서 게스트 OS(우분투) 22번 포트로 접근한다.


$ ssh -l samuel 192.168.56.102

The authenticity of host '192.168.56.102 (192.168.56.102)' can't be established.

ECDSA key fingerprint is SHA256:QZzP8QStApL95hXVI1C8+KLDCeJqfYyynJcMDQf0tzw.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.56.102' (ECDSA) to the list of known hosts.

samuel@192.168.56.102's password:

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.10.0-28-generic x86_64)


 * Documentation:  https://help.ubuntu.com

 * Management:     https://landscape.canonical.com

 * Support:        https://ubuntu.com/advantage


93 packages can be updated.

58 updates are security updates.



The programs included with the Ubuntu system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.


Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by

applicable law.


samuel@samuel-VirtualBox:~$




git을 설치한다.



$ sudo su


$ sudo apt-get install git




stack이라는 사용자 계정을 만든다. useradd 써도 된다. 


$ git clone https://git.openstack.org/openstack-dev/devstack


$ devstack/tools/create-stack-user.sh


$ echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers




stack 계정으로 접근해서 devstack를 체크아웃받고 local.conf 파일을 수정하고 stack.sh를 실행한다. 



$ su stack 


$ cd /home/stack


$ apt-get update


$ git clone https://git.openstack.org/openstack-dev/devstack


$ cd devstack/


$ cp samples/local.conf local.conf


$ vi local.conf

HOST_IP=127.0.0.1

ADMIN_PASSWORD=openstack

MYSQL_PASSWORD=openstack

RABBIT_PASSWORD=openstack

SERVICE_PASSWORD=openstack


$ ./stack.sh



2017.9.5 일자 master 버전으로는 문제가 없이 동작한다. 




=========================

DevStack Component Timing

=========================

Total runtime    1292


run_process       33

test_with_retry    3

apt-get-update     8

pip_install      247

osc              191

wait_for_service  30

git_timed        233

dbsync            19

apt-get           91

=========================




This is your host IP address: 127.0.0.1

This is your host IPv6 address: ::1

Horizon is now available at http://127.0.0.1/dashboard

Keystone is serving at http://127.0.0.1/identity/

The default users are: admin and demo

The password: openstack


WARNING:

Using lib/neutron-legacy is deprecated, and it will be removed in the future



Services are running under systemd unit files.

For more information see:

https://docs.openstack.org/devstack/latest/systemd.html


DevStack Version: pike

Change: 037d70a75c55035445a9533191e52a759e697348 Merge "Replace http with https for doc links in devstack's document" 2017-09-04 04:49:19 +0000

OS Version: Ubuntu 16.04 xenial






대시보드를 실행해본다. 


http://192.168.56.102/dashboard





로그에 나와 있듯이 admin/openstack으로 접근한다.




로그인 하면 다음 화면이 나온다.






내부에 무엇이 바뀌었나 봤더니.. 네트워크 디바이스가 추가되었다. 


$ip addr



5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000

6: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000

7: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

8: br-int: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

9: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000

10: br-tun: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

    


open swtich 가상 네트워크를 살펴본다. 


$ sudo ovs-vsctl show

46131da2-9a7a-4daf-8930-be13fa42b951

    Manager "ptcp:6640:127.0.0.1"

        is_connected: true

    Bridge br-int

        Controller "tcp:127.0.0.1:6633"

            is_connected: true

        fail_mode: secure

        Port "qg-a29d6f1e-73"

            tag: 2

            Interface "qg-a29d6f1e-73"

                type: internal

        Port "tap65add5ed-61"

            tag: 1

            Interface "tap65add5ed-61"

                type: internal

        Port "qr-5732dad9-2d"

            tag: 1

            Interface "qr-5732dad9-2d"

                type: internal

        Port int-br-ex

            Interface int-br-ex

                type: patch

                options: {peer=phy-br-ex}

        Port patch-tun

            Interface patch-tun

                type: patch

                options: {peer=patch-int}

        Port "qr-000ed957-83"

            tag: 1

            Interface "qr-000ed957-83"

                type: internal

        Port br-int

            Interface br-int

                type: internal

    Bridge br-tun

        Controller "tcp:127.0.0.1:6633"

            is_connected: true

        fail_mode: secure

        Port br-tun

            Interface br-tun

                type: internal

        Port patch-int

            Interface patch-int

                type: patch

                options: {peer=patch-tun}

    Bridge br-ex

        Controller "tcp:127.0.0.1:6633"

            is_connected: true

        fail_mode: secure

        Port phy-br-ex

            Interface phy-br-ex

                type: patch

                options: {peer=int-br-ex}

        Port br-ex

            Interface br-ex

                type: internal

    ovs_version: "2.6.1"



가상 라우터와 가상 dhcp를 확인한다. 


$ sudo ip netns show

qrouter-fbbc5c05-4373-4dfa-8ac8-e2d34442496c

qdhcp-59013e3c-0a59-4e18-8e5a-2a463dbeae1a



가상 라우터와 가상 hdcp id로 환경을 살펴본다.


가상 라우터에 할당된 네트워크와 ip를 확인할 수 있다.


$ sudo ip netns exec qrouter-fbbc5c05-4373-4dfa-8ac8-e2d34442496c ifconfig

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


qg-a29d6f1e-73 Link encap:Ethernet  HWaddr fa:16:3e:54:5f:05

          inet addr:172.24.4.5  Bcast:172.24.4.255  Mask:255.255.255.0

          inet6 addr: 2001:db8::1/64 Scope:Global

          inet6 addr: fe80::f816:3eff:fe54:5f05/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:51 errors:0 dropped:0 overruns:0 frame:0

          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:8457 (8.4 KB)  TX bytes:2418 (2.4 KB)


qr-000ed957-83 Link encap:Ethernet  HWaddr fa:16:3e:d6:08:52

          inet addr:10.0.0.1  Bcast:10.0.0.63  Mask:255.255.255.192

          inet6 addr: fe80::f816:3eff:fed6:852/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1

          RX packets:26 errors:0 dropped:0 overruns:0 frame:0

          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:2736 (2.7 KB)  TX bytes:998 (998.0 B)


qr-5732dad9-2d Link encap:Ethernet  HWaddr fa:16:3e:c1:d3:1b

          inet6 addr: fe80::f816:3eff:fec1:d31b/64 Scope:Link

          inet6 addr: fd6c:40e8:796f::1/64 Scope:Global

          UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1

          RX packets:5 errors:0 dropped:0 overruns:0 frame:0

          TX packets:34 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:477 (477.0 B)  TX bytes:3972 (3.9 KB)




가상 dhcp는 10.0.0.2로 매핑되어 있다.



$ sudo ip netns exec qdhcp-59013e3c-0a59-4e18-8e5a-2a463dbeae1a ifconfig

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


tap65add5ed-61 Link encap:Ethernet  HWaddr fa:16:3e:d6:06:c5

          inet addr:10.0.0.2  Bcast:10.0.0.63  Mask:255.255.255.192

          inet6 addr: fe80::f816:3eff:fed6:6c5/64 Scope:Link

          inet6 addr: fd6c:40e8:796f:0:f816:3eff:fed6:6c5/64 Scope:Global

          UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1

          RX packets:37 errors:0 dropped:0 overruns:0 frame:0

          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:3504 (3.5 KB)  TX bytes:802 (802.0 B)




http://192.168.56.102/dashboard/admin/networks/에서 private, public 영역을 보면서 서브넷 환경을 알 수 있다.








http://192.168.56.102/dashboard/admin/routers/에 접근하면. 라우터 정보도 볼 수 있다.



http://192.168.56.102/dashboard/project/instances/에서 인스턴스를 생성한다.




그리고 실제 네트워크 토폴리지(http://192.168.56.102/dashboard/project/network_topology/)를 살펴본다.








인스턴스를 생성한 다음


floating IP를 설정하고 새로 생성한 






생성한 인스턴스에 floating ip가 만들어진지 확인했다.








참조


http://docs.openstack.org/developer/devstack/

'Cloud' 카테고리의 다른 글

[openstack] ceph DR (disaster recovery)  (0) 2017.10.12
Apache NIFI  (0) 2017.09.12
[openstack] Rally + Tempest  (0) 2017.09.02
[etcd] etcd 설치와 간단 예제  (0) 2017.08.23
fluent-plugin-extract_query_params  (0) 2017.08.23
Posted by '김용환'
,