cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus <shadow...@gmail.com>
Subject Re: CloudStack call to KVM
Date Mon, 07 Apr 2014 16:41:21 GMT
If you trace startVirtualMachine you'll end up in
VirtualMachineManagerImpl.java, most likely in the advanceStart
method, where we see the StartCommand being crafted and sent to the
agent:

                    StartCommand strtcmd = new StartCommand(vmTO,
dest.getHost(), _mgmtServer.getExecuteInSequence());

                    cmds.addCommand(strtcmd);

                    vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);


                    work = _workDao.findById(work.getId());
                    if (work == null || work.getStep() != Step.Prepare) {
                        throw new ConcurrentOperationException("Work
steps have been changed: " + work);
                    }

                    _workDao.updateStep(work, Step.Starting);

                    _agentMgr.send(destHostId, cmds);

In general when I'm looking for commands that go to the hypervisor
it's easy to find by just searching the code for e.g. StartCommand in
this case.

On Mon, Apr 7, 2014 at 10:27 AM, Marcus <shadowsor@gmail.com> wrote:
> The DeployVMCmd.java file has a 'create' and an 'execute' method. The
> create method is responsible for registering the VM and persisting it
> in the database, the logical creation. The 'execute' starts the vm, if
> the API call requires it. It calls the
> userVmService.startVirtualMachine, which I think is also called when
> existing VMs are stopped/started.
>
>     public void execute(){
>         UserVm result;
>
>         if (getStartVm()) {
>             try {
>                 UserContext.current().setEventDetails("Vm Id: "+getEntityId());
>                 result = _userVmService.startVirtualMachine(this);
>
>
> In general with the async calls I believe that the create() method is
> completed before the job is returned (sync), and the execute() method
> is the async part.
>
> On Mon, Apr 7, 2014 at 10:21 AM, Matt Spurlin <matt.spurlin@appcore.com> wrote:
>> I have been looking at the code trying to figure out where the API
>> call "deployVirtualMachine"
>> would send the command to a KVM hypervisor to create a new virtual machine.
>> I've found where the API call happens, but so far I have not seen where the
>> logic is that sends the command to the hypervisor to create the VM. Would
>> anyone be kind enough to point me in the right direction for what files I
>> need to look at?
>> Thank you for your time,
>> Matt

Mime
View raw message