Skip to content

Instantly share code, notes, and snippets.

@gcgists
Last active December 31, 2015 02:19
Show Gist options
  • Save gcgists/7920244 to your computer and use it in GitHub Desktop.
Save gcgists/7920244 to your computer and use it in GitHub Desktop.
$ sudo vmsctl -m connection_url=qemu:///system bless vms-test vms-live-image
<11761> [INFO] vmsrun.py:601 vmsrun [exec False]: vmsd save hypervisor=kvm memsrv=file:///var/gridcentric/vms-live-image.gc memtap=null:// id=11731 pages=262144 vcpus=1 generation=0e210d2c-534b4e32-4e32-b43e-c828abb6bf7d fd=4 dir.cache=/dev/shm/vms control.filepattern=/dev/shm/vms/control/ dir.store=/var/gridcentric log.prefix=<save.11731> module.path=/usr/lib64/vms:/usr/lib/vms debugfd=2 kvm.mem_path=/proc/11731/fd/7 kvm.qmp_path=/tmp/qmp_vms_mon-rkk5P8.sock file.sparse=1 kvm.hmp_path=/tmp/hmp_vms_mon-3zPG4G.sock replace.spec=
<11761> [INFO] image.py:63 Running command /usr/bin/qemu-img-vms convert -O qcow2 /var/lib/libvirt/images/vms-test.img /var/gridcentric/vms-live-image.0.disk
<11761> [WARNING] management.py:212 Unable to change the ownership of the vms file /dev/shm/vms/prefetch.0e210d2c-534b4e32-4e32-b43e-c828abb6bf7d.
<11761> [WARNING] management.py:212 Unable to change the ownership of the vms file /dev/shm/vms/share.0e210d2c-534b4e32-4e32-b43e-c828abb6bf7d.
newname = vms-live-image
network = None
artifacts = {'files': [{'path': '/var/gridcentric/vms-live-image.xml'}, {'path': '/var/gridcentric/vms-live-image.gc'}, {'path': '/var/gridcentric/vms-live-image.0.disk'}], 'logical_volumes': []}
vmsctl -m connection_url=qemu:///system bless <master VM> <snapshot>
$ sudo vmsctl -m connection_url=qemu:///system discard vms-live-image
vmsctl -m connection_url=qemu:///system discard <snapshot>
$ virsh dumpxml vms-test > vms-clone.xml
# Install Gridcentric signing key
wget -O - http://downloads.gridcentric.com/packages/gridcentric.key | sudo apt-key add -
# Add Gridcentric repository
echo deb http://downloads.gridcentric.com/packages/agent/linux/ubuntu/ gridcentric multiverse | sudo tee -a /etc/apt/sources.list.d/gridcentric.list
# Update apt
sudo apt-get update
# Install the VMS agent
sudo apt-get -y install linux-headers-`uname -r`
sudo apt-get -y install vms-agent
$ sudo vmsctl -m connection_url=qemu:///system launch vms-live-image vms-clone.xml
<11931> [INFO] image.py:63 Running command /usr/bin/qemu-img-vms create -f qcow2 -b /var/gridcentric/vms-live-image.0.disk -F qcow2 /var/lib/libvirt/images/vms-clone.img
<11931> [INFO] management.py:421 creating domain
[......]
<qemu:commandline><qemu:arg value="-gc"/><qemu:arg value="/var/gridcentric/vms-live-image.gc,rebase={},load_iff=/home/ubuntu/load_iff.ArTPok,vmsargs={&quot;replacements&quot;: [],, &quot;valgrind&quot;: null,, &quot;gdb&quot;: false,, &quot;params&quot;: {},, &quot;noreplace&quot;: false,, &quot;options&quot;: {}},replace={}"/></qemu:commandline></domain>
<11931> [INFO] management.py:423 done creating domain
<11931> [INFO] management.py:38 Waiting for VMS domain for 'vms-clone'
vms-clone.xml
vmsctl -m connection_url=qemu:///system launch <snapshot> <clone XML file>
$ virsh list
Id Name State
----------------------------------
3 vms-test running
4 vms-clone running
<domain type='kvm' id='3'>
<name>vms-clone</name>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/vms-clone.img'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<interface type='network'>
<source network='default'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor' relabel='yes'>
<label>libvirt-658ba53a-5c70-97ad-936d-c71f70d147a4</label>
<imagelabel>libvirt-658ba53a-5c70-97ad-936d-c71f70d147a4</imagelabel>
</seclabel>
</domain>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment