Commit Graph

15609 Commits

Author SHA1 Message Date
Archana Shinde
25a2dc8f6e qemu: Update blockdev-add qmp command to support newer qemu versions
With qemu 2.9, the qmp block-dev command was updated  from:
{ "execute": "blockdev-add", "arguments": { "options": { ... } } }

to:
{ "execute": "blockdev-add", "arguments": { ... } }

Also, instead of id, blockdev-add now requires a node-name for the
root node(https://wiki.qemu.org/index.php/ChangeLog/2.9)

Store the version information with QMPStart and use that to issue
qmp command for adding block devices in the correct format.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2017-08-08 08:53:05 -07:00
Rob Bradford
d4f77103be misc: Remove some of the code flagged by unused linter
Unfortunately the ununused linter is overzealous with some of the fields
that it things are unused as gophercloud relies on their values. So go
ahead with the most straightforward removals but do not enable unused on
travis builds.

ciao-image/datastore/datastore_test.go:28:5⚠️ var metaDsTables is unused (U1000) (unused)
ciao-controller/api/api_test.go:39:6⚠️ func myHostname is unused (U1000) (unused)
ciao-cli/identity.go:58:3⚠️ field Description is unused (U1000) (unused)
ciao-cli/identity.go:59:3⚠️ field DomainID is unused (U1000) (unused)
ciao-cli/identity.go:60:3⚠️ field Enabled is unused (U1000) (unused)
ciao-cli/identity.go:62:3⚠️ field ParentID is unused (U1000) (unused)
ciao-cli/identity.go:63:3⚠️ field Links is unused (U1000) (unused)
ciao-cli/identity.go:70:3⚠️ field Self is unused (U1000) (unused)
ciao-cli/identity.go:71:3⚠️ field Previous is unused (U1000) (unused)
ciao-cli/identity.go:72:3⚠️ field Next is unused (U1000) (unused)
ciao-cli/identity.go:207:3⚠️ field Next is unused (U1000) (unused)
ciao-cli/identity.go:208:3⚠️ field Previous is unused (U1000) (unused)
ciao-cli/identity.go:209:3⚠️ field Self is unused (U1000) (unused)
ciao-cli/identity.go:213:3⚠️ field Description is unused (U1000) (unused)
ciao-cli/identity.go:214:3⚠️ field DomainID is unused (U1000) (unused)
ciao-cli/identity.go:215:3⚠️ field Enabled is unused (U1000) (unused)
ciao-cli/identity.go:217:3⚠️ field Links is unused (U1000) (unused)
ciao-cli/identity.go:221:3⚠️ field ParentID is unused (U1000) (unused)
ciao-cli/main.go:105:6⚠️ type action is unused (U1000) (unused)
ciao-cli/volume.go:37:6⚠️ type customVolumeExt is unused (U1000) (unused)
ciao-cli/volume.go:39:2⚠️ field customVolumeExt is unused (U1000) (unused)
networking/ciao-cnci-agent/network.go:98:8⚠️ const maxKey is unused (U1000) (unused)
networking/libsnnet/tests/parallel/parallel_test.go:371:6⚠️ func dockerNetList is unused (U1000) (unused)
networking/libsnnet/tests/parallel/parallel_test.go:379:6⚠️ func dockerNetInfo is unused (U1000) (unused)
openstack/compute/api.go:308:2⚠️ const limit is unused (U1000) (unused)
openstack/compute/api.go:309:2⚠️ const marker is unused (U1000) (unused)
openstack/compute/api.go:312:6⚠️ type pager is unused (U1000) (unused)
openstack/compute/api.go:313:2⚠️ func pager.filter is unused (U1000) (unused)
openstack/compute/api.go:314:2⚠️ func pager.nextPage is unused (U1000) (unused)
openstack/compute/api_test.go:34:6⚠️ func myHostname is unused (U1000) (unused)
ciao-controller/api.go:72:2⚠️ const statusFilter is unused (U1000) (unused)
ciao-controller/api.go:75:6⚠️ type pager is unused (U1000) (unused)
ciao-controller/api.go:76:2⚠️ func pager.filter is unused (U1000) (unused)
ciao-controller/api.go:77:2⚠️ func pager.nextPage is unused (U1000) (unused)
ciao-controller/api.go:136:25⚠️ func (*nodePager).filter is unused (U1000) (unused)
ciao-controller/api.go:198:31⚠️ func (*nodeServerPager).filter is unused (U1000) (unused)
ciao-controller/controller_test.go:107:6⚠️ func addTestTenantNoCNCI is unused (U1000) (unused)
ciao-controller/controller_test.go:1104:6⚠️ func startTestWorkload is unused (U1000) (unused)
ciao-controller/controller_test.go:1123:6⚠️ func testStartWorkloadLaunchCNCI is unused (U1000) (unused)
ciao-controller/openstack_compute.go:552:5⚠️ field Links is unused (U1000) (unused)
qemu/qmp_test.go:493:3⚠️ const seconds is unused (U1000) (unused)
qemu/qmp_test.go:494:3⚠️ const microsecondsEv1 is unused (U1000) (unused)
qemu/qmp_test.go:495:3⚠️ const device is unused (U1000) (unused)
qemu/qmp_test.go:496:3⚠️ const path is unused (U1000) (unused)
templateutils/example_test.go:53:3⚠️ field hidden is unused (U1000) (unused)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2017-07-19 10:23:46 +01:00
Rob Bradford
a1600dc15b misc: Remove unused fields identified by structcheck
Add structcheck to the list of linters used on travis runs.

ciao-cli/event.go:109:2⚠️ unused struct field github.com/01org/ciao/ciao-cli.eventDeleteCommand.all (structcheck)
ciao-cli/event.go:110:2⚠️ unused struct field github.com/01org/ciao/ciao-cli.eventDeleteCommand.tenant (structcheck)
ciao-cli/external_ips.go:636:2⚠️ unused struct field github.com/01org/ciao/ciao-cli.poolAddCommand.ips (structcheck)
ciao-cli/node.go:43:2⚠️ unused struct field github.com/01org/ciao/ciao-cli.nodeListCommand.nodeID (structcheck)
ciao-controller/client_wrapper_test.go:29:2⚠️ unused struct field github.com/01org/ciao/ciao-controller.ssntpClientWrapper.ctl (structcheck)
qemu/qmp.go:111:2⚠️ unused struct field github.com/01org/ciao/qemu.qmpResult.data (structcheck)
ssntp/ssntp_test.go:193:2⚠️ unused struct field github.com/01org/ciao/ssntp_test.ssntpClient.evtTracedChannel (structcheck)
ssntp/ssntp_test.go:192:2⚠️ unused struct field github.com/01org/ciao/ssntp_test.ssntpClient.staTracedChannel (structcheck)
ssntp/ssntp_test.go:194:2⚠️ unused struct field github.com/01org/ciao/ssntp_test.ssntpClient.errTracedChannel (structcheck)
ssntp/server.go:75:2⚠️ unused struct field github.com/01org/ciao/ssntp.Server.roleVerify (structcheck)
networking/ciao-cnci-agent/client.go:97:2⚠️ unused struct field github.com/01org/ciao/networking/ciao-cnci-agent.agentClient.netCh (structcheck)
testutil/agent.go:37:2⚠️ unused struct field github.com/01org/ciao/testutil.SsntpTestClient.ticker (structcheck)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2017-07-13 14:52:16 +01:00
Rob Bradford
58a835e6a6 misc: Remove unused variables identified by varcheck
And add varcheck to the list of linters used on travis runs (with an
increased deadline.)

ciao-launcher/qemu_test.go:31:5⚠️ unused variable or constant imageInfoTestGood (varcheck)
ciao-launcher/qemu_test.go:44:5⚠️ unused variable or constant imageInfoTestMissingBytes (varcheck)
ciao-launcher/qemu_test.go:57:5⚠️ unused variable or constant imageInfoTestMissingLine (varcheck)
ciao-launcher/qemu_test.go:69:5⚠️ unused variable or constant imageInfoTooBig (varcheck)
ciao-launcher/qemu_test.go:82:5⚠️ unused variable or constant imageInfoBadBytes (varcheck)
configuration/configuration_test.go:35:7⚠️ unused variable or constant glanceURL (varcheck)
ciao-controller/controller_test.go:1918:5⚠️ unused variable or constant testClients (varcheck)
qemu/qmp_test.go:44:2⚠️ unused variable or constant qmpSuccess (varcheck)
qemu/qmp_test.go:45:2⚠️ unused variable or constant qmpFailure (varcheck)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2017-07-13 14:52:16 +01:00
Sebastien Boeuf
d48b5b5f48 qemu: Add PCI option to the NetDevice
The existing NetDevice relies on virtio-net driver, but there is a
useful PCI variant which was not available: virtio-net-pci.
This patch adds this new driver and adds two parameters specific to
this: "bus" and "addr".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-03-09 14:54:11 -08:00
Mark Ryan
a84228ae99 qemu: Document how cancelling works.
The code that handles the serialization and cancelling of QMP commands
is a little complex and it took me some time to remember how it actually
works and why it works in this particular way.  For this reason I've
added some comments which will hopefully make the next bug fix in this
area a little less painful.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2017-02-16 09:49:44 +00:00
Mark Ryan
1e7202a5a6 qemu: Fix spelling error in qmp_test.go
Command only has two ms.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2017-02-16 09:49:44 +00:00
Mark Ryan
c6f334533a qemu: Fix command cancelling.
There was a bug with the cancelling of commands that meant that when
an attempt was made to cancel a command and then to issue a second
command, the first, cancelled command was re-issued.  This commit
fixes the issue and adds a new test case to check that cancelling
of commands does indeed work.  There was also an issue with the
test harness which meant that tests that issued more than one command
were not actually testing the second and third commands.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2017-02-16 09:49:44 +00:00
Mark Ryan
a8a798b0c0 qemu, ciao-launcher: Move ConfigDrive ISO creation code to qemu
Launcher's ConfigDrive ISO creation function, createCloudInitISO has
been moved to the qemu package so that it can be re-used by ciao-down.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2017-02-06 12:16:09 +00:00
Sebastien Boeuf
30cf11632c Add missing bus parameter for a CharDevice
When creating a CharDevice, we need to add a "bus" parameter
so that it can match the serial pci device previously created.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2016-10-21 16:04:22 -07:00
Samuel Ortiz
2aa5f5a3c0 qemu: Add support for serial port addition
We add a new device driver, and also a name to the CharDev structure
this is needed for qemu to actually create the serial port on
the guest.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-10-13 17:56:31 +02:00
Samuel Ortiz
6fe338d604 qemu: Support creating multiple QMP sockets
The QMP socket implementation does not support multiple clients sending
and receiving QMP commands. As a consequence we need to be able to
create multiple QMP sockets from the qemu package, so that at least we
can support a fixed number of QMP clients.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-10-11 14:32:41 +02:00
Samuel Ortiz
992b861ec5 qemu: Add the daemonize qemu option to the Knobs structure
This way callers can choose if they want the qemu process to be a daemon
or not.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-30 15:56:28 +02:00
Samuel Ortiz
997cb23399 qemu: Remove dead code
appendCharDevice() got replaced by the CharDevice's QemuParams method
but never got deleted.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-30 15:46:57 +02:00
Samuel Ortiz
e555f565f4 qemu: Add support for socket based consoles
When we get no virtual console to plug into, we may want qemu to create
a socket where we can asynchronously connect to.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-30 15:46:40 +02:00
Samuel Ortiz
eae8fae0e7 qemu: Fix security model typo
The right qemu parameter is "security_model", not "security-model".

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-21 17:48:47 +02:00
Samuel Ortiz
db067857bd qemu: Make Config's FDs field private
All file descriptors will come from specific devices configurations, so
this patch:

1) Make the Config FDs file private
2) Provide an appendFDs() method for Config, that takes a slice of
os.File pointers and
   a) Adds them to the Config private fd slice
   b) Return a slice of ints that represent the file descriptors for
      these device specific files, as seen by the qemu process.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-19 12:43:03 +02:00
Samuel Ortiz
12f6ebe389 qemu: Embed the qemu parameters into the Config structure
It is a private field now, and all append*() routines are now
Config methods instead of private qemu functions.

Since we will have to carry a kernelParams private field as well,
this change will keep all built parameters internal and make things
consistent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-19 12:41:40 +02:00
Samuel Ortiz
e193a77b8d qemu: Add support for block devices
For now we only support QCOW2 backed block devices.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 01:08:31 +02:00
Samuel Ortiz
3908185ccd qemu: Add MACVTAP support
The networking device structure now supports MACVTAP.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:43:49 +02:00
Samuel Ortiz
6d7dfa04bf qemu: Get rid of the Driver structure
By adding QemuParams() to the Device interface, we can get rid of the
driver structure and simplify further the appendDevices() routine.

With that implementation we can generate the following qemu parameters:

"-device virtio-9p-pci,fsdev=foo,mount_tag=rootfs -fsdev local,id=foo,path=/bar/foo,security-model=none"

from these single structures:

        fsdev := FSDevice{
                Driver:        Virtio9P
                FSDriver:      Local,
                ID:            "foo",
                Path:          "/bar/foo",
                MountTag:      "rootfs",
                SecurityModel: None,
        }

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:43:41 +02:00
Samuel Ortiz
cc9cb33a5d qemu: Add QMPSocket specific type
Instead of open coding the QMP socket type, we now have a specific type
for it.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
2d736d7173 qemu: Add RTC specific types
Instead of open coding the RTC fields, we now have specific types for
it.
We also have a RTC unit test now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
e543c3383d qemu: Probe each qemu device with a driver
Having separate structures for the qemu driver definitions
and each possible device definitions is confusing and error prone as one
needs to be very careful using matching IDs and names in both
structures.

As the driver parameter can be derived from the device
ones, this patch changes the Device and Driver structures to be linked
together, i.e. each driver needs to have its corresponding device.

For example this allows us to build the following 9pfs qemu parameters:

"-fsdev local,id=foo,path=/bar/foo,security-model=none -device virtio-9p-pci,fsdev=foo,mount_tag=rootfs"

from these structures:

	fsdev := FSDevice{
		Driver:        Local,
		ID:            "foo",
		Path:          "/bar/foo",
		MountTag:      "rootfs",
		SecurityModel: None,
	}

	driver := Driver{
		Driver: Virtio9P,
		Device: fsdev,
	}

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
eda8607cc6 qemu: Add netdev options to the Device structure
With the NetDev and MACAddress strings, we can now create networking
device drivers.
We also add a unit test for netdev Device creation.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
4780e2371f qemu: Add multi-queue and vhost definitions to NetDevice
We can now specify if we want vhost to be enabled and wich fds we should
use for multiqueue support.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
137e7c7242 qemu: Add a NetDevice slice to the Config structure
The NetDevice structure represents a network device to be emulated by
qemu.
We also add the corresponding unit test.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
c0e2aacad2 qemu: Add one unit test for the Config strings
Here we test that name, UUID and the CPU model are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
5ba8ef79df qemu: Add QMP socket unit tests
We test that the QMP socket parameter is properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
7b2f7eb5d8 qemu: Add Memory and SMP unit tests
We test that the memory and SMP configuration parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
2ea9b9a385 qemu: Add a Kernel unit test
We test that the kernel path and the kernel parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8e495f6eff qemu: Add a Knobs unit test
We test that all true and all false knobs parameters are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8aeb3d45aa qemu: Add an Object unit test
We test that memory-backend-file and empty objects parameters are
properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
38e041dc9d qemu: Add Device unit tests
We add a NVDIMM, a filesystem and an empty device.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
54d32c2414 qemu: Add parameters adding unit tests
We only test the Machine parameters for now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
ebfa382d2e qemu: Add a Knobs field to the Config structure
The Knobs structure groups all qemu isolated boolean settings.
For now this is -no-user-config, -no-defaults and -nographic.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
fe1bdcd2f7 qemu: Remove the extra parameters field from the Config structure
The extraParams is confusing and can conflict with the rest of the
Config structure definitions.
We remove it and will add new fields to that structure as needed.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
15bce61a90 qemu: Group all machine configurations into one structure
Here we group the machine type and acceleration together as they are
defined through the same qemu parameter (-machine).

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
d94b5af875 qemu: Add a VGA parameter field to the Config structure
The VGA string represents the type of VGA card qemu should emulate.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
4892d041e7 qemu: Add a Global parameter field to the Config structure
The Global string represents the set of default Device driver properties
we want qemu to use. This is mostly useful for automatically created
devices.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
612a5a9e5d qemu: Add a RTC field to the Config structure
The RTC structure represents the guest Real Time Clock configuration.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
c63ec0965a qemu: Add a SMP field to the Config structure
The SMP structure defines the amount of virtual CPUs, sockets, and
threads per CPU that is made available to the guest.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
7cf386a81c qemu: Add a Memory field to the Config structure
The Memory field holds the guest memory configuration.
It is used to define the current and maximum RAM is made available to
the guest and how this amount of RAM is splitted into several slots.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
b198bc67e7 qemu: Add a UUID field to the Config structure
The qemu UUID will be used to set the guest system UUID.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
6239e846b7 qemu: Add a Character Devices slice field to the Config structure
Qemu character devices typically allow for sending traffic from the
guest to the host by emulating a console, a tty, a serial device for
example.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
73e2d53c9a qemu: Add a Filesystem Devices slice field to the Config structure
Each Filesystem device should have a corresponding "virtio-9p-pci"
Device driver. They represent a filesystem to be exported through 9pfs.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
518ba627b1 qemu: Add a Kernel field to the Config structure
The Kernel structure holds the guest kernel configuration: its path and
its parameters. This is the kernel qemu will boot the VM from.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
b973bc59fb qemu: Add an Object slice field to the Config structure
The Object slice tells qemu which specific object to create.
Qemu objects can represent memory backend files, random number
generators, TLS credentials, etc...

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8744dfe85e qemu: Add a Device slice field to the Config structure
We may need to support a large range of devices in the qemu created VM
and the Device slice allows us to define which drivers are needed.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
5458de70ad qemu: Add a QMP socket field to the Config structure
QMP sockets are used to send qemu specific commands to the running qemu
process.
The QMPSocket structure allows us to define the socket type we want,
along with its name.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00