@@ -55,16 +55,26 @@ main :: IO ()
5555main = do
5656 args <- getArgs
5757 case args of
58− "onvm":args' -> onVmMain __remoteTable args'
58+ "onvm":args' ->
59+ -- Pass execution to 'onVmMain' if we are running on the VM
60+ onVmMain __remoteTable args'
61+
5962 "list":sid:x509:pkey:_ -> do
63+ -- List all available cloud services
64+ -- (useful, but not strictly necessary for the example)
6065 params <- defaultAzureParameters sid x509 pkey
6166 css <- cloudServices (azureSetup params)
6267 mapM_ print css
68+
6369 cmd:sid:x509:pkey:user:cloudService:virtualMachine:port:_ -> do
70+ -- Initialize the backend and find the right VM
6471 params <- defaultAzureParameters sid x509 pkey
6572 let params' = params { azureSshUserName = user }
6673 backend <- initializeBackend params' cloudService
6774 Just vm <- findNamedVM backend virtualMachine
75+
76+ -- The same binary can behave as the client or the server,
77+ -- depending on the command line arguments
6878 case cmd of
6979 "server" -> spawnOnVM backend vm port ($(mkClosure 'pingServer) ())
7080 "client" -> callOnVM backend vm port $