State of VM after 'virsh save'

303

Solution 1

First, I totally agree with @dyasny, it is hard to find a reasonable use case for 'full VM state (aka. with memory)'.

But, if you really want 'virsh save vm_name memdump' without destroy the vm, you can try

virsh snapshot-create-as  ${domain} ${fake_snap} 'save vm while keep running' \
 --no-metadata --atomic --live \
 --memspec  ${path_to_mem_dump_file},snapshot=external

Good luck :)

======== Updating: (too long to post as reply ) ===============

Oh, maybe this is my verboseness, 'full VM state' == mem_state + disk_state, while 'mem_state' == 'vm physical memory' + 'vm cpu registers' + 'vm device state in hypervisor'.

So it is safe to 'virsh save' and 'virsh store', since thers is no thing to lose , 'save/restore' just like 'laptop sleeping', usually you will get your app continue running after you 'restore' a vm.

It is disaster if 'mem_state' and 'disk_state' out of sync, that is why 'virsh save' enfocing a 'destroy' after 'save mem'.

My 'virsh save without destroy' is actually a 'full VM backup', the disk_snapshot is hinden inside the original qcow2. So you just see a 'mem_state'.:)

Solution 2

If the VM has lots of memory, saving it will in any case mean a large amount of time spent saving the memstate.

If there is no hard requirement to backup a full VM state (because usually it is redundant, you'll get errors when you restore because of time differences, and it might even lead to a crash).

Normally, VMs are backup up as following:

  1. Quiesce Vm's filesystems
  2. Take live snapshot of VM's disk(s)
  3. Backup the disks and the VM's configuration (virsh dumpxml VM)
  4. Live merge the disks so the snapshot is gone

Now, the only part that might be tricky with kvm is the last part. It is kind of supported using blockpull in most current distros, but that will not merge the snapshot into the base image, it will do the opposite - pull the data from the base into the snapshot, so you can remove the base. The better command is blockcommit, it will push the changed bits from the snapshot into the base image, however, it is only available in the very bleeding edge distributions. I hope it will make it into RHEL 7.1, we'll see

Share:
303

Related videos on Youtube

Luffydev
Author by

Luffydev

Updated on September 18, 2022

Comments

  • Luffydev
    Luffydev almost 2 years

    I would like to center my autocomplete component positioned as absolute, but it doesn't work as i want :(

    can you help me to solve my problem if possible ?

    This is the screenshot of my result at the moment

    And this is my component code :

    import React, { Component } from 'react';
    import { View, Text, StyleSheet, ScrollView, Platform } from 'react-native';
    import { Button } from 'material-bread';
    
    const styles = {
        container: {
            backgroundColor:"#fff",
            width:300,
            position:'absolute',
            elevation:150,
            zIndex:150,
            borderRadius:30,
            flex:10,
            left:0,
            right:0,
            top:0
        },
    
        content: {
            flexDirection: "row",
            flex: 1,
            paddingLeft: 10, //if you need separation.
            color:"#152c5b",
            textAlign:'left'
        },
    
        subcontent: {
            height:30,
            width:'100%',
            textAlign:'left'
        },
    
        text: {
            color:'#152c5b',
        },
    
        bold: {
            fontWeight:'bold',
        },
    
        ios_fix: {
            marginTop:138,
            left:40
        }
    }
    
    export default class Autocomplete_component extends Component
    {
        constructor(props){
            super(props);
    
            this.state = {
                data : []
            }
    
            this.componentDidUpdate = (pPrevProps, pPrevState) => {
    
                
                if(this.props.data.length == 0 && this.state.data.length > 0)
                    this.setState({data : []});
                else
                {
                    if(this.props.data.length > 0 && (this.state.data.length == 0 || this.props.data != this.state.data))
                        this.setState({data: this.props.data})
                }
    
                
            }
            
        }
    
    
        render() {
                {
                  if(this.state.data.length > 0){
                    return (<View style={[styles.container, Platform.OS === 'ios' && styles.ios_fix]}>
                        {this.state.data.map((lData, lI) => {
                            
                            return(<View style={styles.content} key={lI.toString()}>
                                       <View style={styles.subcontent}>
    
                                       <Button key={lI} type="text" textColor={'#152c5b'} style={{textAlign:'left', width:'100%', justifyContent: "flex-start"}}
                                               onPress={() => {this.props.onItemSelect(lData)}}>
    
                                            <Text style={{color:'#152c5b', textAlign:'left'}}>
                                                <Text key='test' style={{fontWeight:'bold'}}>
                                                    {lData.word.substring(0, lData.word.indexOf(this.props.query))}{this.props.query}
                                                </Text>
                                                {lData.word.slice(this.props.query.length)}
                                                </Text>
                                        </Button>
    
                                       </View>
                                   </View>
                            )
    
                        })
                        }
                    </View>)
                  }else
                    return null;
                }        
        }
    }
    

    i think the problem is in the container style, but i can't find solution.

    Thank for your help

  • LetMeSOThat4U
    LetMeSOThat4U over 9 years
    I have a problem with pt. 1 - after all, that's saving live OS, with all the apps open. This may often (sometimes?) not be a problem with Linux SW, but Windows apps typically have their data files open and in messy state. Essentially starting an OS and asking apps to open their "snapshotted" data (as opposed to data files that are normally closed on app close) is asking for trouble of much bigger magnitude than mere time difference for OS. I have snapshotted and restored to working state live image of Windows 7 this way with open apps. I'm not sure if pt. 1 is a good idea with Win7.
  • David Corsalini
    David Corsalini over 9 years
    In Windows you have VSS taking care of quiescing per app, in Linux, everything is separate, so you need to use qemu-ga with hooks into whatever software you have. fsfreeze is one thing, mysqldump is another example. In short, you need to take care of the apps you have in place via an in-guest agent, like qemu-ga.
  • LetMeSOThat4U
    LetMeSOThat4U about 9 years
    There is one: Windows VMs with apps open that users leave without closing their apps (they typically quit by simply closing remote desktop client window and expect to be able to reconnect at any time to resume work). I have to back those up, and forcing Win VM to shutdown can damage apps' data files.
  • grizzlybears
    grizzlybears about 9 years
    Please check my updating, comments seems to be limited in 256 chars...