diff --git a/qemu/examples_test.go b/qemu/examples_test.go index 35373cc1f4..c3930a1e18 100644 --- a/qemu/examples_test.go +++ b/qemu/examples_test.go @@ -21,7 +21,7 @@ import ( "context" - "github.com/ciao-project/ciao/qemu" + "github.com/intel/govmm/qemu" ) func Example() { diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go index 6b0195e2bb..8a97fd1d54 100644 --- a/qemu/qemu_test.go +++ b/qemu/qemu_test.go @@ -21,10 +21,11 @@ import ( "os" "strings" "testing" - - "github.com/ciao-project/ciao/testutil" ) +const agentUUID = "4cb19522-1e18-439a-883a-f9b2a3a95f5e" +const volumeUUID = "67d86208-b46c-4465-9018-e14187d4010" + func testAppend(structure interface{}, expected string, t *testing.T) { var config Config @@ -141,8 +142,8 @@ func TestAppendDeviceNetwork(t *testing.T) { var deviceNetworkStringMq = "-netdev tap,id=tap0,vhost=on,fds=3:4 -device driver=virtio-net-pci,netdev=tap0,mac=01:02:de:ad:be:ef,disable-modern=true,mq=on,vectors=6" func TestAppendDeviceNetworkMq(t *testing.T) { - foo, _ := ioutil.TempFile(os.TempDir(), "qemu-ciao-test") - bar, _ := ioutil.TempFile(os.TempDir(), "qemu-ciao-test") + foo, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") + bar, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") defer func() { foo.Close() @@ -191,8 +192,8 @@ func TestAppendDeviceNetworkPCI(t *testing.T) { var deviceNetworkPCIStringMq = "-netdev tap,id=tap0,vhost=on,fds=3:4 -device driver=virtio-net-pci,netdev=tap0,mac=01:02:de:ad:be:ef,bus=/pci-bus/pcie.0,addr=ff,disable-modern=true,mq=on,vectors=6" func TestAppendDeviceNetworkPCIMq(t *testing.T) { - foo, _ := ioutil.TempFile(os.TempDir(), "qemu-ciao-test") - bar, _ := ioutil.TempFile(os.TempDir(), "qemu-ciao-test") + foo, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") + bar, _ := ioutil.TempFile(os.TempDir(), "govmm-qemu-test") defer func() { foo.Close() @@ -246,13 +247,13 @@ func TestAppendDeviceSerialPort(t *testing.T) { testAppend(chardev, deviceSerialPortString, t) } -var deviceBlockString = "-device virtio-blk,disable-modern=true,drive=hd0,scsi=off,config-wce=off -drive id=hd0,file=/var/lib/ciao.img,aio=threads,format=qcow2,if=none" +var deviceBlockString = "-device virtio-blk,disable-modern=true,drive=hd0,scsi=off,config-wce=off -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none" func TestAppendDeviceBlock(t *testing.T) { blkdev := BlockDevice{ Driver: VirtioBlock, ID: "hd0", - File: "/var/lib/ciao.img", + File: "/var/lib/vm.img", AIO: Threads, Format: QCOW2, Interface: NoInterface, @@ -413,13 +414,13 @@ func TestAppendQMPSocketServer(t *testing.T) { testAppend(qmp, qmpSocketServerString, t) } -var qemuString = "-name cc-qemu -cpu host -uuid " + testutil.AgentUUID +var qemuString = "-name cc-qemu -cpu host -uuid " + agentUUID func TestAppendStrings(t *testing.T) { config := Config{ Path: "qemu", Name: "cc-qemu", - UUID: testutil.AgentUUID, + UUID: agentUUID, CPUModel: "host", } diff --git a/qemu/qmp_test.go b/qemu/qmp_test.go index 21b5e968de..9b87fbcc5d 100644 --- a/qemu/qmp_test.go +++ b/qemu/qmp_test.go @@ -28,8 +28,6 @@ import ( "time" "context" - - "github.com/ciao-project/ciao/testutil" ) const ( @@ -358,7 +356,7 @@ func TestQMPBlockdevAdd(t *testing.T) { q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) q.version = checkVersion(t, connectedCh) err := q.ExecuteBlockdevAdd(context.Background(), "/dev/rbd0", - fmt.Sprintf("drive_%s", testutil.VolumeUUID)) + fmt.Sprintf("drive_%s", volumeUUID)) if err != nil { t.Fatalf("Unexpected error %v", err) } @@ -380,8 +378,8 @@ func TestQMPDeviceAdd(t *testing.T) { cfg := QMPConfig{Logger: qmpTestLogger{}} q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) checkVersion(t, connectedCh) - blockdevID := fmt.Sprintf("drive_%s", testutil.VolumeUUID) - devID := fmt.Sprintf("device_%s", testutil.VolumeUUID) + blockdevID := fmt.Sprintf("drive_%s", volumeUUID) + devID := fmt.Sprintf("device_%s", volumeUUID) err := q.ExecuteDeviceAdd(context.Background(), blockdevID, devID, "virtio-blk-pci", "") if err != nil { @@ -406,7 +404,7 @@ func TestQMPXBlockdevDel(t *testing.T) { q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) q.version = checkVersion(t, connectedCh) err := q.ExecuteBlockdevDel(context.Background(), - fmt.Sprintf("drive_%s", testutil.VolumeUUID)) + fmt.Sprintf("drive_%s", volumeUUID)) if err != nil { t.Fatalf("Unexpected error %v", err) } @@ -427,7 +425,7 @@ func TestQMPDeviceDel(t *testing.T) { seconds = 1352167040730 microsecondsEv1 = 123456 microsecondsEv2 = 123556 - device = "device_" + testutil.VolumeUUID + device = "device_" + volumeUUID path = "/dev/rbd0" ) @@ -470,7 +468,7 @@ func TestQMPDeviceDel(t *testing.T) { checkVersion(t, connectedCh) buf.startEventLoop(&wg) err := q.ExecuteDeviceDel(context.Background(), - fmt.Sprintf("device_%s", testutil.VolumeUUID)) + fmt.Sprintf("device_%s", volumeUUID)) if err != nil { t.Fatalf("Unexpected error %v", err) } @@ -499,7 +497,7 @@ func TestQMPDeviceDelTimeout(t *testing.T) { checkVersion(t, connectedCh) ctx, cancel := context.WithTimeout(context.Background(), time.Second) err := q.ExecuteDeviceDel(ctx, - fmt.Sprintf("device_%s", testutil.VolumeUUID)) + fmt.Sprintf("device_%s", volumeUUID)) cancel() if err != context.DeadlineExceeded { t.Fatalf("Timeout expected found %v", err) @@ -683,7 +681,7 @@ func TestQMPEvents(t *testing.T) { seconds = 1352167040730 microsecondsEv1 = 123456 microsecondsEv2 = 123556 - device = "device_" + testutil.VolumeUUID + device = "device_" + volumeUUID path = "/dev/rbd0" ) var wg sync.WaitGroup @@ -721,7 +719,7 @@ func TestQMPEvents(t *testing.T) { deviceName := ev.Data["device"].(string) if deviceName != device { t.Errorf("Unexpected device field. Expected %s, found %s", - "device_"+testutil.VolumeUUID, device) + "device_"+volumeUUID, device) } pathName := ev.Data["path"].(string) if pathName != path { @@ -798,8 +796,8 @@ func TestQMPPCIDeviceAdd(t *testing.T) { cfg := QMPConfig{Logger: qmpTestLogger{}} q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) checkVersion(t, connectedCh) - blockdevID := fmt.Sprintf("drive_%s", testutil.VolumeUUID) - devID := fmt.Sprintf("device_%s", testutil.VolumeUUID) + blockdevID := fmt.Sprintf("drive_%s", volumeUUID) + devID := fmt.Sprintf("device_%s", volumeUUID) err := q.ExecutePCIDeviceAdd(context.Background(), blockdevID, devID, "virtio-blk-pci", "0x1", "") if err != nil {