link: http://www.l4l.be/index.php/linuxdocs/46-storage/112-iscsi-enterprise-target-installatie
Installatie
Zorg er voor dat de compiler en bijbehorende tools geinstalleerd staan, ook is openssl-dev nodig. Onder Ubuntu doe je dit met:
apt-get install build-essential libssl-dev
Download IETd, also-known-as iscsitarget:
wget http://downloads.sourceforge.net/project/iscsitarget/iscsitarget/0.4.17/iscsitarget-0.4.17.tar.gz
Pak het uit:
tar xzvf iscsitarget-0.4.17.tar.gz
cd iscsitarget-0.4.17
Als je nu zou willen compileren, dan loop je tegen het volgende probleem op:
iscsitarget-0.4.17/kernel/block-io.c: In function ‘blockio_open_path’:
iscsitarget-0.4.17/kernel/block-io.c:164: error: implicit declaration of function ‘open_bdev_excl’
iscsitarget-0.4.17/kernel/block-io.c:164: warning: assignment makes pointer from integer without a cast
iscsitarget-0.4.17/kernel/block-io.c: In function ‘blockio_detach’:
iscsitarget-0.4.17/kernel/block-io.c:328: error: implicit declaration of function ‘close_bdev_excl’
iscsitarget-0.4.17/kernel/block-io.o] Error 1
iscsitarget-0.4.17/kernel] Error 2
Met andere woorden er is een probleem... Open het bestand block-io.c in je favoriete editor, en ga naar regel 164. Daar staat:
bdev = open_bdev_excl(path, flags, THIS_MODULE);
Verander dit in:
bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
Ook is er een verandering nodig in regel 328, voor het gemak geef ik hier de volledige verandering weer:
static void
blockio_detach(struct iet_volume *volume)
{
struct blockio_data *bio_data = volume->private;
int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
if (bio_data->bdev)
close_bdev_exclusive(bio_data->bdev, flags);
kfree(bio_data->path);
kfree(volume->private);
}
Nu kun je compileren/installeren:
make
sudo make install
2010年1月19日 星期二
iscsitarget make error block-io.c
2010年1月1日 星期五
lo: Disabled Privacy Extensions 錯誤on ubuntu 9.04
dmesg
lo: Disabled Privacy Extensions
lo: Disabled Privacy Extensions
lo: Disabled Privacy Extensions
lo: Disabled Privacy Extensions
........ more
修改 vim /etc/default/grub
於GRUB_CMDLINE_LINUX="" 加入 ipv6.disable=1
GRUB_CMDLINE_LINUX="ipv6.disable=1"
存檔後
執行 update-grub
reboot
2009年12月21日 星期一
Google App Engine文件 備份下載
Link from: http://www.manatlan.com/blog/zipme___download_sources_of_your_gae_website__as_a_zip_file
注意事項:
www.google.coma/a/mydomain 的用戶沒有辦法登入GAE
所以請另外開一個app帳戶, 請mydomain的管理者邀請
Administration
Developers <== Invite a Developer to Collaborate on this Application:
Enter a complete email address
修改app.yaml加入下列二行 :
- url: /zipme
script: zipme.py
以下存檔為zipme.py放置於根目錄下 例:http://gae-id.appspot.com/zipme
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
##########################################################################
ZipMe : GAE Content Downloader
##########################################################################
Just add this lines in your app.yaml :
- url: /zipme
script: zipme.py
##########################################################################
""" # manatlan
from google.appengine.ext import webapp
from google.appengine.api import users
import wsgiref.handlers
import zipfile
import os,re,sys,stat
from cStringIO import StringIO
def createZip(path):
def walktree (top = ".", depthfirst = True):
names = os.listdir(top)
if not depthfirst:
yield top, names
for name in names:
try:
st = os.lstat(os.path.join(top, name))
except os.error:
continue
if stat.S_ISDIR(st.st_mode):
for (newtop, children) in walktree (os.path.join(top, name),
depthfirst):
yield newtop, children
if depthfirst:
yield top, names
list=[]
for (basepath, children) in walktree(path,False):
for child in children:
f=os.path.join(basepath,child)
if os.path.isfile(f):
f = f.encode(sys.getfilesystemencoding())
list.append( f )
f=StringIO()
file = zipfile.ZipFile(f, "w")
for fname in list:
nfname=os.path.join(os.path.basename(path),fname[len(path)+1:])
file.write(fname, nfname , zipfile.ZIP_DEFLATED)
file.close()
f.seek(0)
return f
class ZipMaker(webapp.RequestHandler):
def get(self):
if users.is_current_user_admin():
folder = os.path.dirname(__file__)
self.response.headers['Content-Type'] = 'application/zip'
self.response.headers['Content-Disposition'] = \
'attachment; filename="%s.zip"' % os.path.basename(folder)
fid=createZip(folder)
while True:
buf=fid.read(2048)
if buf=="": break
self.response.out.write(buf)
fid.close()
else:
self.response.headers['Content-Type'] = 'text/html'
self.response.out.write("<a href=\"%s\">You must be admin</a>." %
users.create_login_url("/zipme"))
def main():
application = webapp.WSGIApplication(
[('/zipme', ZipMaker)],
debug=False)
wsgiref.handlers.CGIHandler().run(application)
if __name__ == "__main__":
main()
注意事項:
www.google.coma/a/mydomain 的用戶沒有辦法登入GAE
所以請另外開一個app帳戶, 請mydomain的管理者邀請
Administration
Developers <== Invite a Developer to Collaborate on this Application:
Enter a complete email address
2009年11月30日 星期一
2009年8月29日 星期六
Python Compiler (cx_freeze) for Linux
SourceForge下載: http://sourceforge.net/projects/cx-freeze/files/
Projects http://cx-freeze.sourceforge.net/
Projects http://cx-freeze.sourceforge.net/
# wget cx_Freeze-4.1.tar.gz
# tar xzvf cx_Freeze-4.1.tar.gz
# cd cx_Freeze-4.1
記得看一下說明檔!!
# cat README.txt
------------
Please see cx_Freeze.html for documentation on how to use cx_Freeze.
To build:
python setup.py build
python setup.py install
On Windows I have used the MinGW compiler (http://www.mingw.org)
python setup.py build --compiler=mingw32
python setup.py build --compiler=mingw32 install
------------
安裝
# python setup.py build
# python setup.py install
參考一下範例 samples/
[advanced] [matplotlib] [relimport] [simple] [wx]
測試-先來個簡單的
# cd samples/simple
# ls 看一下有什麼東西
hello.py setup.py 只有二個檔案,內容都很容易懂的
setup.py 內容
------------
# A very simple setup script to create a single executable
#
# hello.py is a very simple "Hello, world" type script which also displays the
# environment in which the script runs
#
# Run the build process by running the command 'python setup.py build'
#
# If everything works well you should find a subdirectory in the build
# subdirectory that contains the files needed to run the script without Python
from cx_Freeze import setup, Executable
setup(
name = "hello",
version = "0.1",
description = "Sample cx_Freeze script",
executables = [Executable("hello.py")])
------------
測試編譯
# python setup.py build
# ls 看一下多出什麼東西
[build] hello.py setup.py 多出一個 build的目錄
# cd build/
# ls
[exe.linux-x86_64-2.5] 這個目錄的名稱會依使用的核心作命名
# cd exe.linux-x86_64-2.5
# ls -l
-rw-r--r-- 1 root root 41416 2009-08-29 12:34 array.so
-rwxr-xr-x 1 root root 11888 2009-08-29 12:34 hello 編譯好的檔案
-rw-r--r-- 1 root root 42112 2009-08-29 12:34 itertools.so
-rw-r--r-- 1 root root 1473760 2009-08-29 12:34 libpython2.5.so.1.0
-rw-r--r-- 1 root root 74373 2009-08-29 12:34 library.zip
-rw-r--r-- 1 root root 23352 2009-08-29 12:34 zlib.so
ps. 除了hello是剛才測試後的執行檔,其它的都是必須的不能刪除
ps. 記得如果要拷貝到其它地方執行,其它的檔案都要拷貝才能正確執行
# ./hello 測試編譯好的檔案是否有正常執行
ps. 範例中的項目最好都去看一下setup.py
例. [relimport] setup.py 一看就明白,自制模組要如何放置
訂閱:
文章 (Atom)