2018年1月19日 星期五

Avenged Sevenfold - The Exist lyric 中文歌詞



"Exist"

Our truth is painted across the sky
In our reflection, we learn to fly
No hand to hold us
No one to save us from tomorrow

Sailing away, beyond the reach of anyone
Far beyond the dreams of everyone
No light to follow
A shot in the dark
Does anybody know?
Sailing away, beyond the reach of anyone
Far beyond the dreams of everyone
High from the heavens
I can't see the pain
Does anybody care?

Think for a moment of all the lives
Stripped of their essence before their time
We stand to conquer
But is there nothing left tomorrow?

I'm sailing away, beyond the reach of anyone
Far beyond the dreams of everyone
There's no light to follow
A shot in the dark
Does anybody know?
Sailing away, beyond the reach of anyone
Far beyond the dreams of everyone
High from the heavens
I can't see the pain
Does anybody care?

[Neil deGrasse Tyson:]
We have one collective hope: The Earth.
我們有一個共同的希望--地球
And yet uncounted people remain hopeless.
然而,仍有無數的人活在絕望之中
Famine and calamity abound.
飽受飢荒災害,
Sufferers hurl themselves into the arms of war.
只能投身於戰爭之中。
People kill and get killed in the name of someone else's concept of God.
人們不斷互相殘殺,只憑藉著他人心中所謂的神
Dare we admit that our thoughts and behaviors spring from a belief that the world revolves around us?
我們能否勇於承認我們一切所作所為都是自以為中心的結果?

Each fabricated conflict, self murdering bomb, vanished airplane,
每個人為的衝突、自殺炸彈客、消失的航班
Every fictionalized dictator, biased partisan and wayward son
每個虛偽的獨裁者、偏頗的政客、離家之子
Part the curtains of society's racial, ethnic, religious, national and cultural conflicts,
And you find the human ego turning the knobs and pulling the levers.
從每個種族、民族、宗教甚至國與國、和每個文化之間衝突的帷幕之中
你都會發現人性的自我在從中作梗

When I track the orbits of asteroids, comets, and planets,
Each one a pirouetting dancer in a cosmic ballet, choreographed by the forces of gravity,
當我觀察星體、彗星星球的軌道時,每個都像是萬有引力指揮之下飛旋跳躍的芭蕾舞者
I see beyond the plight of humans.
我不再聚焦於人類的困境,

I see a universe ever expanding,
所見即是不斷擴張的宇宙,和在這不斷延伸的四維空間中的各個銀河
With its galaxies embedded within the ever-stretching, four-dimensional fabric of space and time.

However big our world is — in our hearts, our minds, in our out-sized atlases?
無論在我們心中或是腦海裡自以為是的世界有多麼的大
The universe is even bigger.
仍舊不及這浩瀚的宇宙,

There are more stars in the universe than grains of sand on the world's beaches.
和地上的沙相比,宇宙中有更多的星辰
More stars in the universe than seconds of time that have passed since Earth formed.
比從地球形成到現在所經過的秒數還多
More stars than words and sounds ever uttered by all humans who have ever lived.
比曾在這地球上活過的人類發出的聲音還多

The day we cease exploration of the cosmos is the day we threaten the continuance of our species.
若我們停止探索宇宙,便會威脅到我們總族的延續

In that bleak world, arms-bearing, resource-hungry people and nations
Would be prone to act on their low contracted prejudices,
And would have seen the last gasp of human enlightenment —
但在這殘酷的世界裡,濫用武力與資源的國家和人們,總是不願犧牲自己的利益
也許人性的光輝已經奄奄一息

Until the rise of a visionary new culture once again embraces the cosmic perspective;
A perspective in which we are one, fitting neither above, nor below, but within.
直到一個嶄新的,有遠見的文化再起,並接受這樣的宇宙觀 -- 作為全人類的共識,非高高在上,非微不足道,乃是深植在每個人心中。


2017年1月17日 星期二

縮小qcow2/vmdk

本篇會介紹如何縮小KVM Images (qcow vmdk)的檔案大小以節省host端的硬碟空間

通常在使用KVM虛擬機的時候不外乎就那幾種檔案格式 (.img  .raw .qcow2)

不過qcow2比較特別的是 他只支援容量擴充 一旦擴充後 想要再縮小就比較麻煩

沒辦法用qem-img resize的方式縮小

如果想要縮小qcow2檔案的大小  來節省空間的話

首先在客戶端(linux)執行

dd if=/dev/zero of=/mytempfile

這裡會將硬碟剩餘的空間 用一個全部為0的mytempfile塞滿

rm -f /mytempfile

接著再把mytempfile刪除,來製造空間已使用完的假象,但其實都是沒必要的零

接著將VM 客戶端關機,回到HOST端執行以下指令
mv original_image.qcow2 original_image.qcow2_backup
qemu-img convert -O qcow2 original_image.qcow2_backup original_image.qcow2

上面的指令會透過qemu-img convert 轉檔,轉檔的同時會壓縮空間,

由於我們剛剛填入的都是0 所以可以把剩下的空間省下來

最後再檢查輸出的.qcow2檔案能不能正確的運行VM   可以的話就可以把backup刪除了

2015年12月7日 星期一

使用Mininet 作為VM之間的網路拓樸- Using Mininet as a network topology between VMs

這篇會簡介如和使用Mininet作為VM之間的網路拓樸
類似圖中這樣的概念,每個方格都是一個VM

首先為了確定server VM 跟 Client VM 的網路在沒有中間mininet的情況下沒辦法互通
我分別將server 和client的網路介面設為 host only


將VMnet2設為server VM的網路介面,而VMnet3則是client VM的網路介面






而在MininetVM則要同時把 VMnet2,3都加進來


由於VMnet都是host only並沒有橋接的關係,到目前為止 Server vm 和Client vm沒辦法相通
但可以各自與mininet相通

接下來我們透過mininet來架設一個簡易的網路拓樸


from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.cli import CLI
from mininet.link import Intf
from mininet.log import setLogLevel, info

def myNetwork():

    net = Mininet( topo=None,
                   build=False)

    info( '*** Adding controller\n' )
    c0= net.addController(name='c0',
                          controller=RemoteController,
                          ip='192.168.2.130')  //設定controller資訊,我的controller是在另一台VM上

    info( '*** Add switches\n')
    s1 = net.addSwitch('s1', failMode ='secure')  //設定switch為secure模式
    s2 = net.addSwitch('s2', failMOde ='secure')

    Intf( 'eth1', node=s1 )  // eth1為先前設定的VMnet2
    Intf( 'eth2', node=s2 ) // eth2 為VMnet3

    info( '*** Add links\n')
    net.addLink(s1,s2)

    info( '*** Starting network\n')
    net.start()
    CLI(net)
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    myNetwork()



上面程式碼存成.py 執行之後 mininet就會產生一個網路拓樸--具有兩個switch
switch1接到實體的eth2,switch2則是接到eth3

在Opendaylight的網頁介面上可以看到剛剛架好的網路拓樸
原本以為這樣server (192.168.20.128) 就ping的到client (192.168.30.128)
但後來發現還要去設定路由表,加一個新的網段到自己的subnet
於是就在server端新增client端192.168.30.xxx的網段
ip route add 192.168.30.0/24 dev eth0
同樣也在client端新增server網段的subnet
ip route add 192.168.20.0/24 dev eth0

之後server跟client端就能透過mininet 架設的拓樸來連接了
透過Controller也可以看到有封包經過我們的switch






2015年2月11日 星期三

Set Ryu controller with Web-GUI and custom Mininet topology

下圖是利用ryu加上mininet建立的一個自訂網路拓樸,在利用ryu的gui patch顯示在web介面上

首先要將安裝好的ryu加上GUI的patch (安裝ryu可以參考先前的文章)

由於目前Ryu的gui功能還沒包含在官方的版本裡面
因此需要下載patch來完成這個功能

由此 gui-patch-v3-rebase 下載 ZIP 解壓縮後在路徑 /gui-patch-v3-rebase/ryu/gui 將 gui 整個資料夾複製到原官方 Ryu 專案相同位置的地方(/ryu/ryu/)。
或是直接解壓縮覆蓋ryu資料夾也可以
接著要到 /ryu/ryu/topology 修改 switches.py 45行-53行的地方註解掉。
(這邊還不太確定為什麼要註解)

下載並安裝RYU with GUI的所需套件。
sudo apt-get install python-dev
sudo pip install ryu flask gevent-websocket

開啟Ryu GUI所需的應用程式

ryu-manager --verbose --observe-links ryu.topology.switches ryu.app.rest_topology ryu.app.ofctl_rest ryu.app.simple_switch (2015/02/12註:加上這個simple_switch的話拓樸的連線沒辦法正常顯示,去掉就正常了)

開啟Ryu GUI server
./ryu/gui/controller.py

接著利用Mininet建立自己的網路拓樸
下面的mininet腳本描述了上面圖片所示的網路架構
可以寫在一個python 腳本裡面 (mytopo.py)

from mininet.topo import Topo

class MyTopo( Topo ):
    "Simple topology example."

    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        server = self.addHost( 'server' )
        client = self.addHost( 'client' )
        switch1 = self.addSwitch( 's1' )
        switch2 = self.addSwitch( 's2' )
  switch3 = self.addSwitch( 's3' )
        switch4 = self.addSwitch( 's4' )
  switch5 = self.addSwitch( 's5' )
        switch6 = self.addSwitch( 's6' )
switch7 = self.addSwitch( 's7' )

        # Add links
        self.addLink( server , switch1 )
self.addLink( switch1, switch2 )
self.addLink( switch1, switch3 )
self.addLink( switch2, switch4 )
self.addLink( switch3, switch4 )
self.addLink( switch3, switch5 )
self.addLink( switch4, switch7 )
self.addLink( switch5, switch6 )
self.addLink( switch6, switch7 )
self.addLink( switch7, client  )


topos = { 'mytopo': ( lambda: MyTopo() ) }

之後利用mininet建立我們創建的網路拓樸
mn --custom mytopo.py --topo mytopo --controller=remote
controller=remote預設是在本機的ip 若是controller在其他機器的話則在後面加上,ip=xxx.xxx.xx.xx
例如 --controller=remote,ip=192.168.10.11

之後開啟瀏覽器 網址輸入http://localhost:8000
應該就會看到我們建立的網路拓樸

如果controller在其他機器的話則ip也要跟著改


參考資料
How to set up Ryu controller with GUI component?
[RYU] Try the RYU Web GUI with Mininet
Ryu 3.18 documentation TOPOLOGY VIEWER
Ryu gui wiki

Ubuntu 14.04 安裝 Ryu

Ryu官方在介紹Ryu時並沒有把所有的相依套件清楚地列出來
看了滿多blog的教學,但有些安裝完之後還是會出現錯誤

主要會出錯的原因可能是blogger在寫教學時所用的ubuntu可能之前就有安裝過一些必要的套件
導致要在一個全新的ubuntu上安裝ryu時就會出現一些沒遇過的問題
於是特地用docker去新增了一個百分百乾淨的ubuntu來做測試
雖然因為docker架構的關係 有些lib會和host的共用,而不會安裝在container裡
所以導致需要安裝的東西變多
但至少可以確定按照這樣的流程是可以成功安裝Ryu的
(如果有遇到任何問題歡迎回覆)

----
2015/02/13
due to the need of new environment, I use the new ubuntu 14.04 to install ryu by following this tutorial. (only run apt-get upgrade before)
and this tutorial still works.
----

下載並安裝相依性軟體

$sudo apt-get install python-pip python-dev build-essential
$sudo apt-get install python-eventlet python-routes python-webob python-paramiko
$sudo apt-get install libxml2-dev libxslt1-dev python2.7-dev

$pip install msgpack-python
$pip install oslo.config
$pip install netaddr
$pip install lxml
(如果安裝lxml時出現錯誤 apt-get install libz-dev )
$pip install ecdsa
$apt-get install git

從github下載最新的ryu
$git clone https://github.com/osrg/ryu.git
$cd ryu
$python ./setup.py install

如果install過程出現six版本錯誤的話
$pip install -U six

之後可以用ryu-manager測試有沒有正確安裝



2015年2月10日 星期二

Ubuntu 14.04 安裝 Docker

這篇基本上是參考Docker裡的教學

安裝Ubuntu官方維護的Docker版本(可能不是最新發布的

$ sudo apt-get update
$ sudo apt-get install docker.io
會叫做docker.io是因為先前已經有個軟體叫做docker了

接著啟動Docker內的tab自動補完功能  (個人覺得好像沒甚麼用???)
$ source /etc/bash_completion.d/docker.io

下面的方法是安裝最新發布的Docker版本

讓apt-get能夠處理https協定的來源

[ -e /usr/lib/apt/methods/https ] || {
  apt-get update
  apt-get install apt-transport-https
}


新增Docker的來源金鑰
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

新增Docker的來源並安裝 lxc-docker
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker

Note:
There is also a simple curl script available to help with this process.
$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh

新增一個ubuntu的container來驗證功能
$ sudo docker run -i -t ubuntu /bin/bash
Which should download the ubuntu image, and then start bash in a container.