diff options
| author | Your Name <you@example.com> | 2024-12-21 16:45:32 +0800 |
|---|---|---|
| committer | Your Name <you@example.com> | 2024-12-21 16:45:32 +0800 |
| commit | e94b275f5630e032a6971831f8be520ae81a5d02 (patch) | |
| tree | c6819daab6bceff1477647f40d52fa23f2c88628 /others/vm3/compute | |
| parent | be3dde6ce14698c5818f21f65037a4beef1199cf (diff) | |
v1vm3-done
Diffstat (limited to 'others/vm3/compute')
| -rwxr-xr-x | others/vm3/compute/create.sh | 11 | ||||
| -rw-r--r-- | others/vm3/compute/start.sh | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/others/vm3/compute/create.sh b/others/vm3/compute/create.sh index 6d83a03..649cd86 100755 --- a/others/vm3/compute/create.sh +++ b/others/vm3/compute/create.sh @@ -14,6 +14,9 @@ disk_gb=$5 if [ $# -ne 5 ]; then echo "Usage: $0 <vm-name> <os> <vcpu> <ram(gb)> <disk(gb)>" echo "seed.iso and image file have to be present!" + echo "" + echo "Available images" + sudo ls /var/lib/libvirt/images/.image_store exit 1 fi @@ -41,20 +44,20 @@ fi sudo virt-install --name $vmname \ --vcpus $vcpu \ --memory "$((ram_gb * 1024))"\ - --disk path=$new_vm_path,size=$disk_gb,format=qcow2 \ + --disk path=$new_vm,format=qcow2 \ --disk path=$seed_iso,device=cdrom \ --os-type linux \ --os-variant $os \ --virt-type kvm \ --graphics none \ --network bridge=virbr0,model=virtio \ - --print-xml > $xml || { echo "Failed to print XML."; exit 1; } + --print-xml > $xml #|| { echo "Failed to print XML."; exit 1; } -sudo virsh define $xml &> /dev/null || { echo "Failed to define the new VM."; exit 1; } +sudo virsh define $xml #&> /dev/null || { echo "Failed to define the new VM."; exit 1; } sudo qemu-img resize $new_vm +$disk_gb"G" #&> /dev/null sudo virsh start $vmname -sudo rm "${workingdir}"/* +#sudo rm "${workingdir}"/* diff --git a/others/vm3/compute/start.sh b/others/vm3/compute/start.sh new file mode 100644 index 0000000..5a2b3aa --- /dev/null +++ b/others/vm3/compute/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# starts vm +# need to remove seed.iso first if vm have the seed iso |
