Brian implemented the code, but I'll look through it and see if I can answer your questions.
On Sun, Mar 10, 2013 at 9:26 AM, Alex Huang <alex.hu...@citrix.com> wrote: > Marcus, > > > > I just saw this FS. Sorry if I’m a little late. I have a few questions. > > > > - On updateDefaultNicForVirtualMachine: Does it work even if the VM > is running? If it does, how do you change the default route on the actual > VM? It looks like we left it at being able to be set while running. We all went back and forth on this, and ultimately it seemed reasonable that an admin might want to add a nic and make it default without downtime in certain situations. Unfortunately, there is no way to reset the default route so the admins would have to set the gateway themselves, then it would be there on reboot. I'm surprised this isn't documented in the FS, it should be. I just added it. > > - On addNicToVirtualMachine: The API is a async-create not just > async right? Meaning that the db entry was created first and used to drive > the state machine. Acutally adding/removing the nics is done by calling the same code we use for provisioning nics on systemvm routers, however that works. We simply do a bunch of checks for things like making sure there isn't already a hostname in that network, network is in zone, etc, and then call the pre-existing functions addVmToNetwork() and removeNicFromVm(). > > - Can you elaborate on the exact exceptions and error codes thrown > in each so we can document them? addNicToVirtualMachine - throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); throw new InvalidParameterValueException("unable to find a network with id " + networkId); throw new CloudRuntimeException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't add a new NIC to a VM on a Basic Network"); throw new PermissionDeniedException("Unable to modify a vm using network with id " + network.getId() + ", permission denied"); throw new CloudRuntimeException(vmInstance + " is in zone:" + vmInstance.getDataCenterId() + " but " + network + " is in zone:" + network.getDataCenterId()); throw new CloudRuntimeException(network + " already has a vm with host name: '" + vmInstance.getHostName()); and the error returns from addVmToNetwork: throw new CloudRuntimeException("Unable to add NIC to " + vmInstance + ": " + e); throw new CloudRuntimeException("Insufficient capacity when adding NIC to " + vmInstance + ": " + e); throw new CloudRuntimeException("Concurrent operations on adding NIC to " + vmInstance + ": " +e); removeNicFromVirtualMachine: throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); throw new InvalidParameterValueException("unable to find a nic with id " + nicId); throw new InvalidParameterValueException("unable to find a network with id " + nic.getNetworkId()); throw new CloudRuntimeException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't remove a NIC from a VM on a Basic Network"); throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance); throw new PermissionDeniedException("Unable to modify a vm using network with id " + network.getId() + ", permission denied"); and return errors from removeNicFromVM call: throw new CloudRuntimeException("Unable to remove " + network + " from " + vmInstance +": " + e); throw new CloudRuntimeException("Concurrent operations on removing " + network + " from " + vmInstance + ": " + e); throw new CloudRuntimeException("Unable to remove " + network + " from " + vmInstance ); updateDefaultNicForVirtualMachine: throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); throw new InvalidParameterValueException("unable to find a nic with id " + nicId); throw new InvalidParameterValueException("unable to find a network with id " + nic.getNetworkId()); throw new CloudRuntimeException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't change default NIC on a Basic Network"); throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance); throw new CloudRuntimeException("refusing to set default nic because chosen nic is already the default"); throw new CloudRuntimeException("refusing to set default " + vmInstance + " is not Running or Stopped"); throw new CloudRuntimeException("Failed to find a nic profile for the existing default network. This is bad and probably means some sort of configuration corruption" throw new CloudRuntimeException("Setting a default nic failed, and we had no default nic, but we were able to set it back to the original"); throw new CloudRuntimeException("Failed to change default nic to " + nic + " and now we have no default"); throw new CloudRuntimeException("something strange happened, new default network(" + newdefault.getId() + ") is not null, and is not equal to the network(" + nic.getNetworkId() + ") of the chosen nic"); > > - Were there any schema changes? I assume not. nope. > > > > Thanks! > > > > --Alex > >