りおてくでタグ「iSCSI」が付けられているもの

I wrote the entry about the difficulty that globalSAN doesn't have any command line interfaces. In short, we can't connect / disconnect to / from an iSCSI target by a script. And I found that globalSAN uses Mach API for messaging. But it's very difficult to imply a method to control the globalSAN daemon.

I gave up on connecting and disconnecting by my script and switched to mounting and unmounting when I want. When a Mac is restarted, Mac OS's autofs mounts an iSCSI volume automatically. But as I wrote yesterday, it can destroy the filesystem on the volume where multi-Mac are used. I found the way to prevent autofs from mounting the volume automatically.

$ sudo vifs
UUID=01234567-89AB-CDEF-0123-456789ABCDEF none hfs rw,noauto

Now, I can mount and unmount the volume safely with locking system by my script when I desire to do so.

前回の続き。ちょっと広く情報を集めたいので、へたくそ英語で。

I've used globalSAN as an iSCSI initiator. But I happened on a difficulty that globalSAN doesn't have any command line interfaces, CUI. In case of using an iSCSI volume for rsync with multiple-Mac, you need to obey a procedure as follows.

  1. Check that other Mac aren't mounting an iSCSI volume
    To check if the volume isn't mounted, there should be some 'locking system' on web server or something.
  2. Mount the volume
  3. Issue rsync command targeting the volume
  4. Unmount the volume

To avoid destroying a file system on the volume, globalSAN Preference Pane needs to be configured without 'persistent'. If not, when one of your Mac is restarted, globalSAN connects to the volume and HFS+ can be broken.

The problem I face with is absence of command line to connect to an iSCSI target.

Firstly, I tried Apple Script. But my attempt resulted in failure. Because globalSAN Preference Pane doesn't support AS. And Automator.app is similar.

Then I found that Console.app reported some messages when I checked 'connect' checkbox in globalSAN Preference Pane.

09/03/03 23:15:26 System Preferences[187] ConnectTarget, connectionDict: {
    "Selected Addresses" =     (
    );
    "Target Address Settings" =     {
        1 =         (
                        {
                "Target IP Address String" = "rio.tc";
                "Target IP Port Number" = 3260;
                "Target Portal Group Number" = 1;
            }
        );
    };
    "Target Login Settings" =     {
        "Data Digest Enable" = 0;
        "Header Digest Enable" = 0;
        "Target Login Credentials" =         {
            "Authentication Type" = CHAP;
            "CHAP Initiator Name" = hogehoge;
            "CHAP Initiator Password" = hogehoge;
            "CHAP Target Name" = "";
            "CHAP Target Password" = hogehoge;
        };
    };
    "Target URL" = "iqn.2009-01.tc.rio:storage.iscsi";
} 

To be precise, globalSAN consists of three components, a kernel extension, a preference pane and a globalSAN daemon. I guess that the preference pane send a message to the daemon configuring the kernel extension. The structured data reported by Console.app is considered as a message sent by the preference pane to the daemon.

UNIX domain socket is the well-known mechanism for IPC. However, I couldn't find the socket bound by globalSAN daemon with netstat command.

When I was about to give up, I found that Activity Monitor.app had a feature to gather system calls.

Sampling process 3348 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling globalSAN (pid 3348) every 1 millisecond
Call graph:
    2363 Thread_2507
      2363 start
        2363 _start
          2363 main
            2363 RunService()
              2363 CFRunLoopRun
                2363 CFRunLoopRunSpecific
                  2269 mach_msg
                    2269 mach_msg_trap
                      2269 mach_msg_trap
                  93 __CFMachPortPerform
                    93 __NSFireMachPort
                      91 -[NSConcretePortCoder dispatch]
                        91 -[NSConnection handlePortCoder:]
                          91 -[NSConnection handleRequest:sequence:]
                            90 -[NSConnection dispatchInvocation:]
                              90 -[NSInvocation invoke]
                                90 __invoking___
                                  90 _CF_forwarding_prep_0
                                    90 ___forwarding___
                                      90 -[NSInvocation invokeWithTarget:]
                                        90 -[NSInvocation invoke]
                                          90 __invoking___
                                            90 -[SNSISCSIServer targetConnect:results:]
                                              90 -[SNSISCSIServer openSingleConnectionToTarget:withSettings:withAddress:results:]
                                                89 IOConnectMethodStructureIStructureO
                                                  89 IOConnectCallMethod
                                                    89 io_connect_method
                                                      89 mach_msg
                                                        89 mach_msg_trap
                                                          89 mach_msg_trap
                                                1 +[NSPropertyListSerialization dataFromPropertyList:format:errorDescription:]
                                                  1 CFPropertyListWriteToStream
                                                    1 CFPropertyListCreateXMLData
                                                      1 _CFGenerateXMLPropertyListToData
                                                        1 _CFAppendXML0
                                                          1 _plistAppendCharacters
                                                            1 CFDataAppendBytes
                                                              1 CFDataReplaceBytes
                                                                1 CFDataReplaceBytes
                            1 -[NSConnection returnResult:exception:sequence:imports:]
                              1 -[NSConcretePortCoder sendBeforeTime:sendReplyPort:]
                                1 -[NSMachPort sendBeforeTime:streamData:components:from:msgid:]
                                  1 +[NSMachPort sendBeforeTime:streamData:components:to:from:msgid:reserved:]
                                    1 mach_msg
                                      1 mach_msg_trap
                                        1 mach_msg_trap
                      2 +[NSMachPort parseMachMessage:localPort:remotePort:msgid:components:]
                        2 NSAllocateObject
                          2 _internal_class_createInstanceFromZone
                            2 malloc_zone_calloc
                              2 szone_calloc
                                2 tiny_malloc_from_free_list
                                  2 tiny_malloc_from_free_list
                  1 CFRunLoopRunSpecific

Total number in stack (recursive counted multiple, when >=5):

Sort by top of stack, same collapsed (when >= 5):
        mach_msg_trap        2359
Sample analysis of process 3348 written to file /dev/stdout

O.K. I know that globalSAN uses Mach API to send message :)

RHEL5.2のscsi-target-utilsだと、Mac OS Xのイニシエータと相性が悪いのでビルドした。

サーバのカーネルを更新したので、iSCSI Enterprise Targetをリビルドしたら動かなくなった。原因が分かったので、誰かがはまらないようにメモっておこう。

バグ一掃のOS X 10.5.2が出ましたね。Time Machineがメニューバーに表示されるようになったのが一番良い点かな。

RHEL5.1にはTechnology Preview(本番環境ではサポートが提供されない)ながらも、NTTサイバーソリューション研究所の藤田さんという方がかなり貢献されているソフトウェアiSCSIターゲットが同梱されています。これを使うと仮想化環境でも色々出来るなぁということと、RHEL5.1だけでiSCSI + GFS(ClusterStorage)の環境が構築出来るので、やってみました。ただし、あくまでiSCSI+GFSの「感じ」をつかむための構築手順ですので、本番環境ではサポートされない構成である点にご注意ください。

サーバをアップデートしたらiscsi targetが動かなくなった(/_;)

アップル、Mac OS X 10.5.1公開--Time MachineやFinderを修正。Time MachineのディスクをiSCSIにしているんだけど、ネットワークが切断した時にTime Machineが動いているとタイムアウトしてくれない上、Finderも応答しなくなる、という不具合も直ってると良いなと期待しつつ、アップデート。

アップル新OSの「Time Machine」機能のインタフェースに感動。そう、見せ方がうまいのよ。技術的には別に真新しくは無いので。

外付けHDDでは、出張だけではなく職場にも持って歩かないとTimeMachineが利用できないという、非常に困ったソリューションになってしまう。そこで、自宅サーバにiSCSIターゲットを立て、Mac側にイニシエータを用意してTimeMachineのテストをしてみた。

タグ