It is currently Thu Sep 21, 2017 11:07 pm


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Making Sense of the Snapshot Function
PostPosted: Sun Sep 12, 2010 10:32 am 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
Synopsis

You can make the snapshot function work. Here's the workaround:

Save your configs, (wr mem and File>Save)
Create the snapshot (click on the Snapshot Toolbar button - you know, the one that looks like a clock)
Load the snapshot back again immediately (you don't even have to open the dialogue again)
Start your routers
Save your configs, (File>Save)

To go back to your "mainline" config, now also do
File>Open and open the project you were working with before you took the snapshot.

That's really the end of the "How to", the rest of this is really a bug report, or more correctly my ramblings as I tried to work out how the Snapshot function worked. Anyway, to see how I reached this conclusion, read on...


Rambling notes made while arriving at the method above

I don't know what the Snapshot function does. There is no menu item for it, but since about v0.6.0 GNS3 has had a toolbar button labelled Snapshot.

Let's see if we can work out what it does:
Attachment:
NewSnapshotExperiment.png
NewSnapshotExperiment.png [ 39.59 KiB | Viewed 10122 times ]

I've created a new project called SnapshotExperiment, and elected to Save nvrams … and to Export router configuration files. I named my .net file topology.net, and the resulting file structure on my disk is:
Code:
/opt/GNS3/Project/SnapshotExperiment (Directory which contains...)
     SnapshotExperiment_configs (Directory)
     SnapshotExperiment_working (Directory)
     topology.net

The contents of the topology.net file shows that my working files and configs are where we expected – in the directories mentioned above, according to the rules of relative paths
Viz: (From the Dynagen console)
Code:
Dynagen management console for Dynamips (adapted for GNS3)
Copyright (c) 2008 GNS3 Project

=> show run
autostart = False
[GNS3-DATA]
    configs = SnapshotExperiment_configs
    workdir = SnapshotExperiment_working


Next, I add 2 routers, connect them together, start 'em up and configure each with a hostname – R1 and R2

Save my configs (write mem) and save my topology (File>Save)

So far so good. Let's take a look at the topology file: (extracts)
Code:
=> show run
[localhost:7200]
    workingdir = SnapshotExperiment_working

    [[ROUTER R1]]
        cnfg = SnapshotExperiment_configs/R1.cfg
    [[ROUTER R2]]
        cnfg = SnapshotExperiment_configs/R2.cfg
[GNS3-DATA]
    configs = SnapshotExperiment_configs
    workdir = SnapshotExperiment_working


So far looking good. Time for a snapshot:
Attachment:
SnapshotTaken1.png
SnapshotTaken1.png [ 21.96 KiB | Viewed 11037 times ]

OK Snapshot taken, let's see what that did:

Firstly we see a couple of errors on the Dynagen Console:
Code:
=> R1: Dynamips error: 206-unable to extract config of VM 'R1'
R2: Dynamips error: 206-unable to extract config of VM 'R2'

And our dynagen config now looks like:
Code:
=> show run
autostart = False
[localhost:7200]
    workingdir = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_working
    [[ROUTER R1]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R1.cfg
    [[ROUTER R2]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R2.cfg
=>

A quick check of our directory structure shows we now have:
Code:
/opt/GNS3/Project/SnapshotExperiment (Directory which contains)
     SnapshotExperiment_configs (Directory)
        R1.cfg
        R2.cfg
     SnapshotExperiment_working (Directory)
        Lots of working files
     topology_snapshot_120910_105659 (directory)
        several working files
        topology.net
     topology.net

A quick look at the topology.net file in the snapshot directory shows that this is the current topology file we are working with as shown above. The thing to notice is that the workingdir and cnfg directories STILL POINT TO THE ORIGINAL WORKING DIRECTORIES AND CONFIGS

When I do a File > Save, sure enough my configs are still saved to the pre-snapshot directory. I think this is a bug, but anyway, that's the way it works at the moment.

Now here's an interesting thing:

Click on Snapshot, and load the snapshot you just took. Look at the config
Code:
=> show run
autostart = False
[localhost:7200]
    workingdir = /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/.
    [[ROUTER R1]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R1.cfg
    [[ROUTER R2]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R2.cfg
=>

Note that the workingdir has changed – it has now changed to the Snapshot directory – there was a subtle change between the time we last looked at the config (after taking the snapshot and doing a save) and now (after loading the snapshot)

Now I am going to start the routers and give them new names, then save (wr mem and file>save)

Whoa: Look at the message on the Dynagen Console:
Code:
=> Exporting R1 configuration to /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/R1.cfg
Exporting R2 configuration to /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/R2.cfg

Wow! It has saved the configs to a different location to that specified in the config just a few moments ago!

Lets view the config again
Code:
=> show run
autostart = False
[localhost:7200]
    workingdir = /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/.
    [[ROUTER R1]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/R1.cfg
    [[ROUTER R2]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_105659/R2.cfg
=>

So GNS3 has updated the dynagen config to point to the snapshot AND the new configs are stored in the snapshot directory. A quick look of the topology.net file in the snapshot directory shows that the stored version has taken advantage of relative paths, and stored the above config as:
Code:
autostart = False
[localhost:7200]
    workingdir = .
    [[ROUTER R1]]
        cnfg = R1.cfg
    [[ROUTER R2]]
        cnfg = R2.cfg
[GNS3-DATA]
    configs = .
    workdir = .

Which is somewhat more readable.

OK, let's just run through this snapshot process again. This time I'm quitting GNS3, opening it up again and loading our original SnapshotExperiment

I find our configs exactly as they were before I took the snapshot. Great. Let's make a change, save our configs and take another snapshot.

I've added some IP addresses to f0/0 and the routers can ping each other. As expected the save put the configs in the right places
Code:
Dynagen management console for Dynamips (adapted for GNS3)
Copyright (c) 2008 GNS3 Project

=> Exporting R1 configuration to /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R1.cfg
Exporting R2 configuration to /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R2.cfg

Now for another snapshot

As per last time:
Code:
R1: Dynamips error: 206-unable to extract config of VM 'R1'
R2: Dynamips error: 206-unable to extract config of VM 'R2'


BUT now, I'm going to make some changes – I'm going to shutdown the fa0/0 interfaces, add a description and save my configs – one would expect that this will only affect my mainstream configs, NOT the snapshot I just took.

OK –changes made, wr mem done file>save done
Code:
=>
Exporting R1 configuration to /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R1.cfg
Exporting R2 configuration to /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R2.cfg
=>

Now let's load the snapshot.
And look at the loaded config
Code:
=> show run
autostart = False
[localhost:7200]
    workingdir = /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_113934/.
    [[ROUTER R1]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R1.cfg
    [[ROUTER R2]]
        cnfg = /opt/GNS3/Project/SnapshotExperiment/SnapshotExperiment_configs/R2.cfg
=>

This looks bad – the snapshot configs are pointing to the mainstream configs

Let's look at the router configs – and sure enough the f0/0 interfaces are shutdown and my interface description is there. Remember, these were changes I made AFTER I took the snapshot.
Code:
R1#sh run int f0/0
Building configuration...

Current configuration : 142 bytes
!
interface FastEthernet0/0
description I just shut this interface
ip address 1.1.1.1 255.255.255.0
shutdown
duplex auto
speed auto
end

So now what? Last time when we saved AFTER loading the snapshot, the pointers got changed and the snapshot configs really DID point to another set of configs.

So here goes: File>Save
Code:
Exporting R1 configuration to /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_113934/R1.cfg
Exporting R2 configuration to /opt/GNS3/Project/SnapshotExperiment/topology_snapshot_120910_113934/R2.cfg
=>


Now that looks better – BUT TOO LATE – the changes that were saved to the snapshot were changes I did AFTER I TOOK THE SNAPSHOT – so the snapshot was lost.

Conclusion:

You can make the snapshot function work. Here's the workaround:

Save your configs, (wr mem and File>Save)
Create the snapshot
Load the snapshot back again immediately (you don't even have to open the dialogue again)
Start your routers
Save your configs, (File>Save)

And realise that you are now working WITHIN this snapshot – if you want to go back and continue working with the mainline part of the project, you should now immediately do a File>Open and open up your original .net file

AS a side issue,

It worries me that when I have a project opened, and I clear it, and I do New Project, I find:
a) a show run (in the dynamips console) shows me the config of the recently cleared topology, and
b) if I look in the newly created directory for my new project, I see a .net file that is a copy of the cleared project.

However, once I've done a save of my new project, things straighten out. But it worries me.



_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Top
 Profile  
 
 Post subject: Re: Making Sense of the Snapshot Function
PostPosted: Sun Oct 03, 2010 5:00 pm 
Offline
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 2668
Location: Canada
Hi,

I've been working on the snapshot function, now it should work as kaage proposed. Let me know if you find any glitches or consistency issue.

Thanks,



_________________
Jeremy, GNS3 Programmer & Benevolent Dictator for Life.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO