On 03/24/2010 09:36 AM, Daniel P. Berrange wrote:
>> The virsh commands will be:
>> virsh snapshot-create [--compress] <dom> <xmlfile>
>> virsh snapshot-list <dom>
>> virsh snapshot-dumpxml <dom> <name>
>> virsh create-with-snapshot <dom> <snapshotname>
>
> It should be called start-with-snapshot.
>
> I'm not sure if this start-with-snapshot is a good idea, because I
> think this concept is not intuitive to the user. A typical lifecycle
> of a domain in the ESX or VirtualBox context may look like this:
>
> - define a new domain
> - start it
> - install the OS
> - create a snapshot A to have a backup of the state with a clean OS installation
> - do some work in the domain
> - shutdown the domain
> - start the domain again (in ESX or VirtualBox UIs this is done by the
> normal start button)
>
> The user expects to start the domain with the exact same state as at
> last shutdown. But with virsh if you use the normal start command as
> you normally do you'll get something different. In the context of ESX
> or VirtualBox I'm not even sure what the "base image" would be, is it
> the empty disk before OS installation?
Essentially the normal 'start' operation should always start with the
most recently used snapshot, if any. 'start-with-snapshot' is to be used
where you want to switch a snapshot which isn't the most recently used.
This is really the weakness in this API, actually. If you have the ability
to have snapshots, and virDomainCreate() always starts with the "latest"
snapshot,
it's somewhat difficult for the user to discover which snapshot they are currently
running from. I guess that's the use of the <state> field in the snapshot XML.
The problem is that given a virDomainPtr, the only way to find the active snapshot
is to iterate through all of the available ones looking for the "running" one,
which isn't very nice.
Maybe we should also add a field to the domain XML that points to the currently
in-use snapshot, if any; that would nicely solve this problem, and also make it easier
for the libvirt code to make sure that it is starting with the "latest"
snapshot
when it does virDomainCreate.
--
Chris Lalancette