2013年5月26日 星期日

Nova: Xenserver Block Migration support on OpenStack



 Block migration  --- Xenserver必須支援Storage XenMotion的feature才可以使用此功能

Prerequisites 
  • Compatible XenServer hypervisors. The hypervisors must support the Storage XenMotion feature. Please refer to the manual of your XenServer to make sure your edition has this feature.
[Note]Note
Please note, that you need to use an extra option --block-migrate for the live migration command, in order to use block migration.
[Note]Note
Please note, that block migration works only with EXT local storage SRs, and the server should not have any volumes attached.

Python: @property 把定義的函釋"當作"Attribute來查詢



http://joy2everyone.iteye.com/blog/910950

python的函式修飾器: decorator

Function Decorator




decorator用來主要是用來修飾函式而不必修改函式的本身。

只要利用@來接"修飾函式"就可以達到修飾效果了,這算是python的syntax sugar。

@ decorator_function

http://caterpillar.onlyfun.net/Gossip/Python/FunctionDecorator.html

SQL: reset AUTO_INCREMENT


ALTER TABLE `table_name` AUTO_INCREMENT=1;

2013年5月24日 星期五

程序執行的優先權: priority 與 nice



Cinder NFS Driver on OpenStack


在grizzly版本當中,cinder.volume.drivers.nfs.NfsDriver所製作出來的volumes就如同其他driver所製作出的一樣可以執行attach/detach的operation,但目前無法執行snapshot的運作。

OpenStack Security Group設定


為了讓Security Group的相關設定都交給Quantum Service來代理(proxy)處理,所以必須在/etc/nova/nova.conf中做以下的設定,以避免與原來Nova Networking所處理的Security Group相衝突。



## security groups ##
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = quantum

Kronos


主要是把XCP toolstack安裝到已經現有的OS環境裏頭


http://wiki.xen.org/wiki/Project_Kronos

2013年5月23日 星期四

QEMU和KVM的差異


QEMU和KVM大致上都是相同的,但QEMU不支援原生虛擬化(Native Virtualization)
he main difference is that QEMU does not support native virtualization. Consequently, QEMU has worse performance than KVM and is a poor choice for a production deployment.


http://docs.openstack.org/grizzly/openstack-compute/admin/content/qemu.html

2013年5月20日 星期一

OpenStack: nova.conf section




 Sections

Configuration options are grouped by section. The Compute config file supports the following sections.

[DEFAULT]

Almost all of the configuration options are organized into this section. If the documentation for a configuration option does not specify its section, assume that it should be placed in this one.

[cells]

The cells section is used for options for configuring cells functionality. See the Cells section of the OpenStack Compute Admin Manual for more details.

[baremetal]

This section is used for options that relate to the baremetal hypervisor driver.

[conductor]

The conductor section is used for options for configuring the nova-conductor service.

[trusted_computing]

The trusted_computing section is used for options that relate to the trusted computing pools functionality. Options in this section describe how to connect to a remote attestation service.

Nova Conductor Service: no-db-compute for compute node

Q: 為何要做nova conductor service?這個從folsom版本開始討論構思,一直到了grizzly版本才合併。nova conductor究竟是啥樣子的服務呢!!?

[Dev List]
     Nova Conductor Dev List, http://lists.openstack.org/pipermail/openstack-dev/2012-November/002573.html

A:
主要是不透過Nova DB的存取來降低效能的瓶頸以及compromised compute node會帶來淺在的危險。

 The nova-conductor service is key to completing no-db-compute. Conceptually, it implements a new layer on top of nova-compute.



[Objective]
1. Compute nodes are the least trusted part of a nova deployment, so removing direct database access is a step toward reducing the potential impact of a compromised compute node.

2. The other benefit of no-db-compute is for upgrades. Direct database access complicates the ability to do live rolling upgrades





Reference:

1. http://cloudystuffhappens.blogspot.tw/2013/04/understanding-nova-conductor-in.html
2. http://russellbryantnet.wordpress.com/2013/02/19/deployment-considerations-for-nova-conductor-service-in-openstack-grizzly/

2013年5月19日 星期日

Cinder: volume-type



What's Volume Type?
In the context of Cinder, Volume Type is an abstraction of various properties of a volume. It is _NOT_ type of back-end storage although one can create one volume type that only certain back-end is able to serve.

In current Cinder's implementation, volume type is just a string/name: 0

mysql> desc volume_types;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+-------------
| created_at | datetime     | YES  |     | NULL    |                |
| updated_at | datetime     | YES  |     | NULL    |                |
| deleted_at | datetime     | YES  |     | NULL    |                |
| deleted    | tinyint(1)   | YES  |     | NULL    |                |
| id         | int(11)      | NO   | PRI | NULL    | auto_increment |
| name       | varchar(255) | YES  |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+













https://etherpad.openstack.org/grizzly-cinder-volumetypes

Python: List



http://blog.eddie.com.tw/2011/10/13/python-list/

What's co-routine

Coroutines are computer program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks,iteratorsinfinite lists and pipes.


Reference:

1. coroutine wiki, http://en.wikipedia.org/wiki/Coroutine

git: 改變commit(送交)的歷史



如果要改變最近一次的commit紀錄的話,則可以下達:

   git commit --amend



Reference:
1. http://git-scm.com/book/zh-tw/Git-%E5%B7%A5%E5%85%B7-%E9%87%8D%E5%AF%AB%E6%AD%B7%E5%8F%B2

Python: import modules from remote server

http://code.activestate.com/recipes/305277-import-modules-from-a-remote-server/

Python: coroutine



http://blog.ez2learn.com/2010/07/17/talk-about-coroutine-and-gevent/

2013年5月17日 星期五

MVC=Model-View-Control


M=Model, 負責資料儲存
V=View, 負責資料的呈現,例如網頁。
C=Control, 負責程式的邏輯控制

定義好framework的話則可將一些程式實作上的細節給隱藏起來(encapsulate)加以抽象化,再降低程式之間的隅合程度。

再以資料庫查詢應用為例,使用 MVC 而未使用 framework 之前,我們會用 sample1.php 的寫法。
sample1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
require_once 'config.php'; // get database address, user and password
$dbh = new PDO(DB_CONNECT_STRING, DB_USER, DB_PASSWORD);
function getFoo() {
    global $dbh;
    $fooSet = array();
    $i = 0;
    foreach ($dbh->query('SELECT * from FOO') as $row) {
        $fooSet[$i++] = $row;
    }
    return $fooSet;
}
?>
接著,假設我們使用了某個名為 "MyCommonApp" 的 framework 之後,按該 framework 的預先建置內容,我們改成 sample2.php 的寫法。
sample2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
require_once 'MyCommonApp.php';
class FooApp extends MyCommonApp {
    function getFoo() {
        $fooSet = array();
        $i = 0;
        foreach ($this->dbh->query('SELECT * from FOO') as $row) {
            $fooSet[$i++] = $row;
        }
        return $fooSet;
    }
}
?>
sample1.php 和 sample2.php 兩種寫法的差異,一眼可見資料庫連線的動作被隱蔽了,而且也不需要用全域變數 (global) $dbh , $dbh 變成了個體成員 $this->dbh 。更進一步,被隱蔽的部份可以加以抽象化,如 MyCommonApp 可能會支援多種資料庫系統,或是支援不同的資料庫連接層 (DBA, MDB2 等) 。但這些細節皆被 framework 隱蔽起來, programmer 只需要專注 class FooApp 的內容即可。還有一件事要提,上述內容沒有 View 和 Control 的程式碼,因為根本不需要知道。 View 只管呈現陣列 ($fooSet) 的內容,不管是 sample1.php 或是 sample2.php ,只要 Model 丟出來的是個陣列, View 就不用作任何修改。這也是 MVC 架構所帶來的好處:低耦合度,各項工作間彼此獨立,其中一個項目的修改動作不會連帶要修改其他項目。在 team-work 中也意味著三種設計工作可以交由三個人同時進行。