Fix virsh

This commit is contained in:
eblazquez 2021-01-31 19:49:31 +01:00
parent 4de8e04e4b
commit e1b99dd03e

View File

@ -1,6 +1,6 @@
--- ---
description: | description: |
This requires the user to be privileged enough to connect to the libvirt daemon, i.e. being in the `libvirt` group. This requires the user to be privileged enough to connect to the libvirt daemon, i.e. being in the `libvirt` group or be able to run `virsh` as sudo.
functions: functions:
command: command:
@ -22,23 +22,23 @@ functions:
</devices> </devices>
</domain> </domain>
EOF EOF
virsh create $TF virsh -c qemu:///system create $TF
virsh destroy foo virsh -c qemu:///system destroy foo
file-write: file-write:
- description: Write a file by creating a storage pool on the target directory and uploading the file as a volume. If the target directory doesn't exist `pool-create-as` must be run with the `--build` option. Directories are created with permissions 711, and files with permissions 600. These can be modified using `pool-create|vol-create` with an XML definition file instead of using `pool-create-as|vol-create-as`. Sample XML files can be obtained with `pool-dumpxml|vol-dumpxml`. - description: Write a file by creating a storage pool on the target directory and uploading the file as a volume. If the target directory doesn't exist `pool-create-as` must be run with the `--build` option. Directories are created with permissions 711, and files with permissions 600. These can be modified using `pool-create|vol-create` with an XML definition file instead of using `pool-create-as|vol-create-as`. Sample XML files can be obtained with `pool-dumpxml|vol-dumpxml`.
code: | code: |
LPATH=file_to_read LPATH=file_to_read
RPATH=file_to_save RPATH=file_to_save
virsh pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) virsh -c qemu:///system pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH)
virsh vol-create-as $(dirname $RPATH|tr / _) $(basename $RPATH) 0 virsh -c qemu:///system vol-create-as $(dirname $RPATH|tr / _) $(basename $RPATH) 0
virsh vol-upload $RPATH $LPATH virsh -c qemu:///system vol-upload $RPATH $LPATH
virsh pool-destroy $(dirname $RPATH|tr / _) virsh -c qemu:///system pool-destroy $(dirname $RPATH|tr / _)
file-read: file-read:
- description: Read a file by creating a storage pool on the target directory and downloading the file as a volume. - description: Read a file by creating a storage pool on the target directory and downloading the file as a volume.
code: | code: |
RPATH=file_to_get RPATH=file_to_get
LPATH=file_to_save LPATH=file_to_save
virsh pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH) virsh -c qemu:///system pool-create-as $(dirname $RPATH|tr / _) dir --target $(dirname $RPATH)
virsh vol-download $RPATH $LPATH virsh -c qemu:///system vol-download $RPATH $LPATH
virsh pool-destroy $(dirname $RPATH|tr / _) virsh -c qemu:///system pool-destroy $(dirname $RPATH|tr / _)
--- ---