複数のMacの同期はどうするの?(さらに続き)

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

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 🙂

タイトルとURLをコピーしました