Skip to content
Snippets Groups Projects
Commit 9a74c436 authored by Florent Gluck's avatar Florent Gluck
Browse files

- usb redirection should work (to test)

- fixed a bug in VM getlistable/attachable/etc. which was returning all VMs owned by the owner instead of applying the right filter
parent af912ecc
No related branches found
No related tags found
No related merge requests found
...@@ -78,16 +78,6 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string, ...@@ -78,16 +78,6 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
} }
} }
// Remarks:
// 1) This device is to allow copy/paste between guest & client
// -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0
// 2) For sound support: "-soundhw hda"
// 3) For shared folder with the host:
// - QEMU: virtfs local,path=/tmp/pipo,mount_tag=sharedfs,security_model=none
// - In the guest: mkdir shared && sudo mount -t 9p sharedfs shared
// 4) For QEMU Guest Agent support:
// -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -chardev socket,path=path_to_sock_file,server=on,wait=off,id=qga0
// Enable KVM // Enable KVM
args := []string{"-enable-kvm"} args := []string{"-enable-kvm"}
// CPU // CPU
...@@ -100,8 +90,10 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string, ...@@ -100,8 +90,10 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
args = append(args, "-vga", "virtio") args = append(args, "-vga", "virtio")
// Virtio serial // Virtio serial
args = append(args, "-device", "virtio-serial-pci") args = append(args, "-device", "virtio-serial-pci")
// Spice // SPICE
args = append(args, "-object", "secret,id=sec,file="+secretPwdFile+",format=base64", "-spice", "tls-port="+strconv.Itoa(spicePort)+",password-secret=sec,x509-dir="+certDir, "-device", "virtserialport,chardev=spicechannel0,name=com.redhat.spice.0", "-chardev", "spicevmc,id=spicechannel0,name=vdagent") args = append(args, "-object", "secret,id=sec,file="+secretPwdFile+",format=base64", "-spice", "tls-port="+strconv.Itoa(spicePort)+",password-secret=sec,x509-dir="+certDir, "-chardev", "spicevmc,id=spicechannel0,name=vdagent")
// SPICE: allows copy/paste between guest & client
args = append(args, "-device", "virtserialport,chardev=spicechannel0,name=com.redhat.spice.0")
// Network // Network
args = append(args, "-nic", nicArgs) args = append(args, "-nic", nicArgs)
// QEMU Guest Agent // QEMU Guest Agent
...@@ -110,8 +102,12 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string, ...@@ -110,8 +102,12 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
for _, u := range usb { for _, u := range usb {
args = append(args, u) args = append(args, u)
} }
// Sound support
// args = append(args, "-soundhw", "hda")
//cmd := exec.Command(qemusystemBinary, "-enable-kvm", "-cpu", "host", "-smp", "cpus="+strconv.Itoa(cpus), "-m", strconv.Itoa(ram), "-drive", "file="+diskFile+",index=0,media=disk,format=qcow2,discard=unmap,detect-zeroes=unmap,if=virtio", "-vga", "virtio", "-device", "virtio-serial-pci", "-object", "secret,id=sec,file="+secretPwdFile+",format=base64", "-spice", "tls-port="+strconv.Itoa(spicePort)+",password-secret=sec,x509-dir="+certDir, "-device", "virtserialport,chardev=spicechannel0,name=com.redhat.spice.0", "-chardev", "spicevmc,id=spicechannel0,name=vdagent", "-nic", nicArgs, "-device", "virtio-serial", "-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0", "-chardev", "socket,path="+qgaSock+",server=on,wait=off,id=qga0", usb) // To share a folder with the host:
// - Add QEMU args: virtfs local,path=/tmp/pipo,mount_tag=sharedfs,security_model=none
// - In the guest: mkdir shared && sudo mount -t 9p sharedfs shared
cmd := exec.Command(qemusystemBinary, args...) cmd := exec.Command(qemusystemBinary, args...)
return cmd, nil return cmd, nil
......
...@@ -511,7 +511,7 @@ func (r *RouterVMs)performVMsList(c echo.Context, userCapabilityAny, vmAccessCap ...@@ -511,7 +511,7 @@ func (r *RouterVMs)performVMsList(c echo.Context, userCapabilityAny, vmAccessCap
return c.JSONPretty(http.StatusOK, r.vms.GetNetworkSerializedVMs( return c.JSONPretty(http.StatusOK, r.vms.GetNetworkSerializedVMs(
func(vm vms.VM) bool { func(vm vms.VM) bool {
if vm.IsOwner(user.Email) { if vm.IsOwner(user.Email) {
return true return cond(vm)
} else { } else {
capabilities, exists := vm.Access[user.Email] capabilities, exists := vm.Access[user.Email]
if exists { if exists {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment