Command line or API support?

Discussion in 'Parallels Desktop for Mac' started by plightbo, Apr 27, 2006.

  1. plightbo

    plightbo Bit poster

    Messages:
    3
    Is there or are there any plans for a command line or API for Parallels? Currently I'm writing software that interacts with VMware Server through their basic-but-useful "vmware-cmd" command line tool (a simple wrapper around the perl APIs). I would love to be able to evaluate Parallels for a similar integration, or at least use it during development since I have a Mac and VMware Server doesn't support Macs.

    And of course, you guys are doing an amazing job. Truly a great example of a software company listening to users and providing an awesome product in short time.
     
  2. Andrew @ Parallels

    Andrew @ Parallels Parallels Team

    Messages:
    1,507
    We are thinking about API. But it is not likely we'll be ready to include it in the upcoming release. But it is definitely will be included into next version.
     
  3. plightbo

    plightbo Bit poster

    Messages:
    3
    Andy,
    Thanks for the quick reply. An API would be nice, but even a simple command line program like vmware-cmd would be enough. Or even simpler: just a way to start/stop a VM would be nice.

    Of course, when you start to get down the API road, then the next question is invariably: what about non-persistent disks?Snapshots? Feature X? ;)
     
  4. tacit_one

    tacit_one Pro

    Messages:
    434
    There is a way to start / stop virtual machines from your scripts (not beautiful, but useful)
    1) Chech "Edit->VM Flags->Autostart configuration" option for your VM (let's say "autostart.pvs")
    2) Now you can run "./parallels autostart.pvs"
    3) Even if it is not the best way to stop it, you can use "kill" to poweroff your VM

    :)
     
  5. drtimhill

    drtimhill Member

    Messages:
    85
    If you do this I would vote for "the Mac way", that is by integrating scripting support (e.g. AppleScript), rather than command line type interfaces.

    --Tim
     
  6. CPFarhood

    CPFarhood Junior Member

    Messages:
    17
    I agree, "When in Rome..."
     
  7. jmdevaney

    jmdevaney Member

    Messages:
    33
    Applescript would be nice but does me no good when I need to secure shell into a box and start or stop a machine...
     
  8. duga

    duga Bit poster

    Messages:
    7
    There is no problem running AppleScript from the command line:

    'man osascript'
     
  9. jmdevaney

    jmdevaney Member

    Messages:
    33
    Im well aware of the osascript command... just not my idea of fun escaping applescript commands from a unix shell... and I may not always have a pre compiled apple script available to run to eliminate the escaping hassle.
     
  10. CPFarhood

    CPFarhood Junior Member

    Messages:
    17
    But in the world of OS X Applescript is going to get used significantly more than command line parameters, 'tis the nature of the beast.
     
  11. bbraun

    bbraun Member

    Messages:
    47
    One problem with this discussion of applescript and ssh'ing is that if applescript is going to be ensuring you can talk to a running graphical version of parallels from an ssh session. If you're going to be doing any communication that (indirectly) needs access to the graphical context, you're going to have a hard time doing it from an ssh session due to not being in the right mach boostrap context. Doing the communication with a running version of parallels via an IP socket, Unix domain socket, or something similar would be fine. For all I know, that's what the socket Parallels currently listens on is for...
     
  12. jmdevaney

    jmdevaney Member

    Messages:
    33
    edit: bbraun (typed this before you posted, this is not a response to your post)

    I don't think that is the case. Applescript is great... there are things you can do with Applescript that you can't do from a Unix shell.

    If you are only talking about starting and stopping VM's then Applescript makes no sense at all. If the OS running inside of Parallels could somehow take advantage of Applescript it would be a different story all together.

    How do you think Applescript will be used with Parallels? I could see if it was possible to create a doc with Applescript in OS X then have the script launch Parallels and ope the same doc with a Windows app but I don't see how they would acomplish that, or pass it back to OS X.

    A shell solution can be used in Applescript with less Applescript code than an Applescript only solution would require.

    do shell script "parallels-command -start /path/to/vm.pvs"

    Don't take this the wrong way, I use Applescript all of the time, about as much as shell scripting. I just don't see how Applescript support will make Parallels better.
     
  13. jmdevaney

    jmdevaney Member

    Messages:
    33
    This makes some sense, I guess that once the machine is started Im not worried about controlling it from OS X... I can use VNC or Remote Desktop tunneled through SSH to control it directly.

    Also if Parallels where going to setup some kind of shell controll they could use a session number like VNC does. That way if I wanted to kill a VM i could do parallels-command -restart :1 or something similar to act on a specific VM.
     
  14. Sam Deane

    Sam Deane Bit poster

    Messages:
    5
    Applescript

    I'd like to add another vote for an applescript interface. Of course, having one doesn't preclude also having some other command line interface - both would be nice and I'm sure you could wrap one within the other in some way to minimise duplication of code.

    What I'm really interested in is not launching/shutting down the virtual machines, but actually executing programs inside the virtual machine and getting results back.

    For example, I am working with a tool chain that allows me to do most of my work on the mac, but requires me to enter the windows environment to execute one or two commands at the end. Being able to create scripts on the mac side which masqueraded as these Windows commands, mashalling the argument passing and result returning across the Mac/Windows boundary, would be really really handy.
     

Share This Page