Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

HV: kata-runtime support for ACRN hypervisor #1779

Merged
merged 6 commits into from
Jul 11, 2019

Conversation

vijaydhanraj
Copy link
Contributor

Add ACRN as a supported hypervisor in kata-runtime.

Fixes: #1778
Signed-off-by: Vijay Dhanraj [email protected]

@amshinde
Copy link
Member

amshinde commented Jun 7, 2019

Thanks @vijaydhanraj for the PR.
Do you think you can split the PR into separate commits, so that it is easier to review this PR.

@vijaydhanraj
Copy link
Contributor Author

Thanks @vijaydhanraj for the PR.
Do you think you can split the PR into separate commits, so that it is easier to review this PR.

Sure, will split the patches and update.

@vijaydhanraj vijaydhanraj force-pushed the ACRN-Runtime branch 2 times, most recently from 898556c to cdd14c2 Compare June 9, 2019 06:10
Copy link

@devimc devimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj thanks for the pull request 😃

@@ -0,0 +1,368 @@
# Copyright (c) 2017-2019 Intel Corporation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is auto-generated, can you remove it?

Copy link
Contributor Author

@vijaydhanraj vijaydhanraj Jun 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj power is failing in travis, could you add the equivalent or dummy (if not supported or to be added in the future ) implementation like you did in acrn_amd64.go

@jcvenegas Thanks for point out!. Instead of adding dummy functions/ interfaces for each arch, should I move virtcontainers/acrn_amd64.go file to vendor/govmm/intel/acrn. Please suggest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vijaydhanraj - I think you are right - the acrn support should be added to https://github.com/intel/govmm and then the runtime can leverage acrn support via the vendored in version of govmm. But let's see what @markdryan thinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @markdryan any thoughts on adding virtcontainers/acrn_amd64.go file to vendor/govmm/intel/acrn to avoid adding dummy functions to for unsupported architecture?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem correct to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just spoke with @amshinde. Will remove acrn_amd64.go as there is nothing specific to amd64. Will add the code to acrn_arch_base.go.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you still interested in adding acrn support to govmm? If so, I need a bit more context and an explanation of what exactly would be added and how. For example, does acrn use qmp or does it have a totally different protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @markdryan, I don't think the support is needed. But I do use "acrnctl" (this another binary) for interacting with the ACRN-DM. It works using sockets underneath but this is abstracted from the user (application). The user(or app) just uses the command it exposes. For example to hot-plug container rootfs, the command will be acrnctl blkrescan vm_name slot,newpath. (similar to Firecracker use case)


const int ioctl_KVM_CREATE_VM = KVM_CREATE_VM;

//TODO; Have IOCTL request until ACRN patches are upstreamed.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind raising an issue and mentioning it here?, that way we can track it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed TODO and raised #1784.

if errno == syscall.EBUSY {
fieldLogger.WithField("reason", "another hypervisor running").Error("cannot create VM")
}
fieldLogger.Infof("ACRN IOCTL Errno=%d", errno)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use WithField instead of Errno=%d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
}

//TODO: Need to trim this config specific to ACRN
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise an issue and mention it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trimmed HV config passed to ACRN and removed TODO.

@@ -0,0 +1,624 @@
// Copyright (c) 2016 Intel Corporation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Params: a.kernelParameters(),
}

//TODO: acrn currently supports only known UUIDs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised #1785 to track the issue.


args := []string{"blkrescan", a.acrnConfig.Name, fmt.Sprintf("%d,%s", slot, drive.File)}

a.Logger().WithFields(logrus.Fields{"drive": drive}).Infof("udpateBlockDevice with acrnctl path=%s", a.config.HypervisorCtlPath)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use format specifiers, use WithField or WithFields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// Not supported. return success
}

/*TODO: Is this required for ACRN*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? please add more details or raise an issue and mention it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is getThreadIDs() implementation mandatory to support ACRN with kata. If not, I can leave it as it is and just return success.
Please suggest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not supported, so just returning success. Removed the TODO.

Copy link
Member

@egernst egernst Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to have a generic 'not supported' error returned? . existing implementation would work fine. getThreadIds is only used for applying appropriate cgroups on host, which isn't relevant here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done

@@ -0,0 +1,456 @@
// Copyright (c) 2016 Intel Corporation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,318 @@
// Copyright (c) 2018 Intel Corporation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@jcvenegas jcvenegas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj power is failing in travis, could you add the equivalent or dummy (if not supported or to be added in the future ) implementation like you did in acrn_amd64.go

@egernst egernst added the feature New functionality label Jun 11, 2019
@vijaydhanraj vijaydhanraj force-pushed the ACRN-Runtime branch 2 times, most recently from 75c12ba to addf7ec Compare June 12, 2019 23:49
@WeiZhang555
Copy link
Member

We have another Hypervisor support now 😄

0x86U, 0x4eU, 0xcbU, 0x7aU, 0x18U, 0xb3U, 0x46U, 0x43U}
};
*/
import "C"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cgo? All you need are the two data structures and the ioctl number. You can easily define them in go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bergwolf, 1) without cgo is it still possible to ensure that the address of the struct will be 8-byte memory aligned? Not sure what is the replacement for attribute(aligned(8)). 2) I only need to initialize UUID to check if a VM can be created using ACRN but declaring acrn_create_vm as go struct results in make-check failing with unused parameter error for other variables in the struct. 3) Would like to retain the same name of the member variables as defined in the kernel, but declaring the struct as go, requires we remove "_" from member names.

Copy link
Member

@bergwolf bergwolf Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj
1). The go specification requires that

  1. For a variable x of struct type: unsafe.Alignof(x) is the largest of all the values unsafe.Alignof(x.f) for each field f of x, but at least 1.

So the acrn_create_vm struct is 8-byte aligned on 64 bit architectures as it has uint64_t in it.

2). you can use //nolint to disable it, see https://github.com/golangci/golangci-lint#nolint

Copy link
Contributor

@markdryan markdryan Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(updating my comment as it wasn't very helpful, updates in italics)

without cgo is it still possible to ensure that the address of the struct will be 8-byte memory aligned? Not sure what is the replacement for attribute(aligned(8)).

It also depends on where and how the struct variable is defined. From the go docs

The first word in a variable or in an allocated struct, array, or slice can be relied upon to be 64-bit aligned.

Apart from that there's currently no "safe" way to request an arbitrary alignment for a variable. However, as @bergwolf there is a way to request 8-byte alignment for structs, which is all you need.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bergwolf , @markdryan. Have removed the cgo and created go structs. Have also used nolint to suppress few variable names.

zklei pushed a commit to zklei/runtime that referenced this pull request Jun 13, 2019
This updates grpc-go vendor package to v1.11.3 release, to fix server.Stop()
handling so that server.Serve() does not wait blindly.

Full commit list:
d11072e (tag: v1.11.3) Change version to 1.11.3
d06e756 clientconn: add support for unix network in DialContext. (kata-containers#1883)
452c2a7 Change version to 1.11.3-dev
d89cded (tag: v1.11.2) Change version to 1.11.2
98ac976 server: add grpc.Method function for extracting method from context (kata-containers#1961)
0f5fa28 Change version to 1.11.2-dev
1e2570b (tag: v1.11.1) Change version to 1.11.1
d28faca client: Fix race when using both client-side default CallOptions and per-call CallOptions (kata-containers#1948)
48b7669 Change version to 1.11.1-dev
afc05b9 (tag: v1.11.0) Change version to 1.11.0
f2620c3 resolver: keep full unparsed target string if scheme in parsed target is not registered (kata-containers#1943)
9d2250f status: rename Status to GRPCStatus to avoid name conflicts (kata-containers#1944)
2756956 status: Allow external packages to produce status-compatible errors (kata-containers#1927)
0ff1b76 routeguide: reimplement distance calculation
dfbefc6 service reflection can lookup enum, enum val, oneof, and field symbols (kata-containers#1910)
32d9ffa Documentation: Fix broken link in rpc-errors.md (kata-containers#1935)
d5126f9 Correct Go 1.6 support policy (kata-containers#1934)
5415d18 Add documentation and example of adding details to errors (kata-containers#1915)
57640c0 Allow storing alternate transport.ServerStream implementations in context (kata-containers#1904)
031ee13 Fix Test: Update the deadline since small deadlines are prone to flakes on Travis. (kata-containers#1932)
2249df6 gzip: Add ability to set compression level (kata-containers#1891)
8124abf credentials/alts: Remove the enable_untrusted_alts flag (kata-containers#1931)
b96718f metadata: Fix bug where AppendToOutgoingContext could modify another context's metadata (kata-containers#1930)
738eb6b fix minor typos and remove grpc.Codec related code in TestInterceptorCanAccessCallOptions (kata-containers#1929)
211a7b7 credentials/alts: Update ALTS "New" APIs (kata-containers#1921)
fa28bef client: export types implementing CallOptions for access by interceptors (kata-containers#1902)
ec9275b travis: add Go 1.10 and run vet there instead of 1.9 (kata-containers#1913)
13975c0 stream: split per-attempt data from clientStream (kata-containers#1900)
2c2d834 stats: add BeginTime to stats.End (kata-containers#1907)
3a9e1ba Reset ping strike counter right before sending out data. (kata-containers#1905)
90dca43 resolver: always fall back to default resolver when target does not follow URI scheme (kata-containers#1889)
9aba044 server: Convert all non-status errors to codes.Unknown (kata-containers#1881)
efcc755 credentials/alts: change ALTS protos to match the golden version (kata-containers#1908)
0843fd0 credentials/alts: fix infinite recursion bug [in custom error type] (kata-containers#1906)
207e276 Fix test race: Atomically access minConnecTimout in testing environment. (kata-containers#1897)
3ae2a61 interop: Add use_alts flag to client and server binaries (kata-containers#1896)
5190b06 ALTS: Simplify "New" APIs (kata-containers#1895)
7c5299d Fix flaky test: TestCloseConnectionWhenServerPrefaceNotReceived (kata-containers#1870)
f0a1202 examples: Replace context.Background with context.WithTimeout (kata-containers#1877)
a1de3b2 alts: Change ALTS proto package name (kata-containers#1886)
2e7e633 Add ALTS code (kata-containers#1865)
583a630 Expunge error codes that shouldn't be returned from library (kata-containers#1875)
2759199 Small spelling fixes (unknow -> unknown) (kata-containers#1868)
12da026 clientconn: fix a typo in GetMethodConfig documentation (kata-containers#1867)
dfa1834 Change version to 1.11.0-dev (kata-containers#1863)
46fd263 benchmarks: add flag to benchmain to use bufconn instead of network (kata-containers#1837)
3926816 addrConn: Report underlying connection error in RPC error (kata-containers#1855)
445b728 Fix data race in TestServerGoAwayPendingRPC (kata-containers#1862)
e014063 addrConn: keep retrying even on non-temporary errors (kata-containers#1856)
484b3eb transport: fix race causing flow control discrepancy when sending messages over server limit (kata-containers#1859)
6c48c7f interop test: Expect io.EOF from stream.Send() (kata-containers#1858)
08d6261 metadata: provide AppendToOutgoingContext interface (kata-containers#1794)
d50734d Add status.Convert convenience function (kata-containers#1848)
365770f streams: Stop cleaning up after orphaned streams (kata-containers#1854)
7646b53 transport: support stats.Handler in serverHandlerTransport (kata-containers#1840)
104054a Fix connection drain error message (kata-containers#1844)
d09ec43 Implement unary functionality using streams (kata-containers#1835)
37346e3 Revert "Add WithResolverUserOptions for custom resolver build options" (kata-containers#1839)
424e3e9 Stream: do not cancel ctx created with service config timeout (kata-containers#1838)
f9628db Fix lint error and typo (kata-containers#1843)
0bd008f stats: Fix bug causing trailers-only responses to be reported as headers (kata-containers#1817)
5769e02 transport: remove unnecessary rstReceived (kata-containers#1834)
0848a09 transport: remove redundant check of stream state in Write (kata-containers#1833)
c22018a client: send RST_STREAM on client-side errors to prevent server from blocking (kata-containers#1823)
82e9f61 Use keyed fields for struct initializers (kata-containers#1829)
5ba054b encoding: Introduce new method for registering and choosing codecs (kata-containers#1813)
4f7a2c7 compare atomic and mutex performance in case of contention. (kata-containers#1788)
b71aced transport: Fix a data race when headers are received while the stream is being closed (kata-containers#1814)
46bef23 Write should fail when the stream was done but context wasn't cancelled. (kata-containers#1792)
10598f3 Explain target format in DialContext's documentation (kata-containers#1785)
08b7bd3 gzip: add Name const to avoid typos in usage (kata-containers#1804)
8b02d69 remove .please-update (kata-containers#1800)
1cd2346 Documentation: update broken wire.html link in metadata package. (kata-containers#1791)
6913ad5 Document that all errors from RPCs are status errors (kata-containers#1782)
8a8ac82 update const order (kata-containers#1770)
e975017 Don't set reconnect parameters when the server has already responded. (kata-containers#1779)
7aea499 credentials: return Unavailable instead of Internal for per-RPC creds errors (kata-containers#1776)
c998149 Avoid copying headers/trailers in unary RPCs unless requested by CallOptions (kata-containers#1775)
8246210 Update version to 1.10.0-dev (kata-containers#1777)
17c6e90 compare atomic and mutex performance for incrementing/storing one variable (kata-containers#1757)
65c901e Fix flakey test. (kata-containers#1771)
7f2472b grpclb: Remove duplicate init() (kata-containers#1764)
09fc336 server: fix bug preventing Serve from exiting when Listener is closed (kata-containers#1765)
035eb47 Fix TestGracefulStop flakiness (kata-containers#1767)
2720857 server: fix race between GracefulStop and new incoming connections (kata-containers#1745)
0547980 Notify parent ClientConn to re-resolve in grpclb (kata-containers#1699)
e6549e6 Add dial option to set balancer (kata-containers#1697)
6610f9a Fix test: Data race while resetting global var. (kata-containers#1748)
f4b5237 status: add Code convenience function (kata-containers#1754)
47bddd7 vet: run golint on _string files (kata-containers#1749)
45088c2 examples: fix concurrent map accesses in route_guide server (kata-containers#1752)
4e393e0 grpc: fix deprecation comments to conform to standard (kata-containers#1691)
0b24825 Adjust keepalive paramenters in the test such that scheduling delays don't cause false failures too often. (kata-containers#1730)
f9390a7 fix typo (kata-containers#1746)
6ef45d3 fix stats flaky test (kata-containers#1740)
98b17f2 relocate check for shutdown in ac.tearDown() (kata-containers#1723)
5ff10c3 fix flaky TestPickfirstOneAddressRemoval (kata-containers#1731)
2625f03 bufconn: allow readers to receive data after writers close (kata-containers#1739)
b0e0950 After sending second goaway close conn if idle. (kata-containers#1736)
b8cf13e Make sure all goroutines have ended before restoring global vars. (kata-containers#1732)
4742c42 client: fix race between server response and stream context cancellation (kata-containers#1729)
8fba5fc In gracefull stop close server transport only after flushing status of the last stream. (kata-containers#1734)
d1fc8fa Deflake tests that rely on Stop() then Dial() not reconnecting (kata-containers#1728)
dba60db Switch balancer to grpclb when at least one address is grpclb address (kata-containers#1692)
ca1b23b Update CONTRIBUTING.md to CNCF CLA
2941ee1 codes: Add UnmarshalJSON support to Code type (kata-containers#1720)
ec61302 naming: Fix build constraints for go1.6 and go1.7 (kata-containers#1718)
b8191e5 remove stringer and go generate (kata-containers#1715)
ff1be3f Add WithResolverUserOptions for custom resolver build options (kata-containers#1711)
580defa Fix grpc basics link in route_guide example (kata-containers#1713)
b7dc71e Optimize codes.String() method using a switch instead of a slice of indexes (kata-containers#1712)
1fc873d Disable ccBalancerWrapper when it is closed (kata-containers#1698)
bf35f1b Refactor roundrobin to support custom picker (kata-containers#1707)
4308342 Change parseTimeout to not handle non-second durations (kata-containers#1706)
be07790 make load balancing policy name string case-insensitive (kata-containers#1708)
cd563b8 protoCodec: avoid buffer allocations if proto.Marshaler/Unmarshaler (kata-containers#1689)
61c6740 Add comments to ClientConn/SubConn interfaces to indicate new methods may be added (kata-containers#1680)
ddbb27e client: backoff before reconnecting if an HTTP2 server preface was not received (kata-containers#1648)
a4bf341 use the request context with net/http handler (kata-containers#1696)
c6b4608 transport: fix race sending RPC status that could lead to a panic (kata-containers#1687)
00383af Fix misleading default resolver scheme comments (kata-containers#1703)
a62701e Eliminate data race in ccBalancerWrapper (kata-containers#1688)
1e1a47f Re-resolve target when one connection becomes TransientFailure (kata-containers#1679)
2ef021f New grpclb implementation (kata-containers#1558)
10873b3 Fix panics on balancer and resolver updates (kata-containers#1684)
646f701 Change version to 1.9.0-dev (kata-containers#1682)

Fixes: kata-containers#307

Signed-off-by: Peng Tao <[email protected]>
@@ -9,6 +9,7 @@
package katautils

var defaultHypervisorPath = "/usr/bin/qemu-lite-system-x86_64"
var defaultHypervisorCtlPath = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only available for ACRN. Since it is not the default hypervisor, set it to be empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am asking because, below you are checking if h.Path is empty and assigning it to defaultHypervisorCtlPath if its empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This should have been h.CtlPath instead of h.path.

@@ -1084,7 +1083,12 @@ func (k *kataAgent) buildContainerRootfs(sandbox *Sandbox, c *Container, rootPat
rootfs.Source = blockDrive.VirtPath
} else if sandbox.config.HypervisorConfig.BlockDeviceDriver == config.VirtioBlock {
rootfs.Driver = kataBlkDevType
rootfs.Source = blockDrive.PCIAddr
if blockDrive.PCIAddr == "" {
rootfs.Source = blockDrive.VirtPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you want to provide the virtpath instead of PCIAddr here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change corresponds to kata-containers/agent#574. In the runtime, since the virpath is known (as the container rootfs in not hot-plugged but a dummy one is created and later updated), it is better to provide this information to the agent directly, rather than providing PCIAddr and then agent finding out the virtpath.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

# XXX: Name: @PROJECT_NAME@
# XXX: Type: @PROJECT_TYPE@

[hypervisor.acrn]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ACRN hypervisor support following features (as they are listed in the config file)?

  1. block device cache control
  2. 9pfs
  3. vsock
  4. vfio passthrough
  5. vm template

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACRN currently doesn't support these options. I have removed them.

func archHostCanCreateVMContainer(onVMM bool) error {

if onVMM {
return acrnIsUsable()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would effectively invalidate kvm check when vmVMM is true. Please do not assume acrn is the only hypervisor we support inside a guest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 2 options here,
Option 1: If onVMM is true, first check if ACRN is supported. If that fails, try KVM.
Option 2: Open the configuration.toml and check the hypervisor currently being used. Based on the hypervisor, check if the VM container can be created.

Let me know which is preferred. If you have any other suggestions, please let me know.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another options is to always check if kvm is usable. And if that fails, check if we are on vmm and if acrn is usable.

Since it becomes hypervisor specific, your option 2 might be better. @jodh-intel wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jodh-intel any thoughts on the above approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 2 options here,
Option 1: If onVMM is true, first check if ACRN is supported. If that fails, try KVM.
Option 2: Open the configuration.toml and check the hypervisor currently being used. Based on the hypervisor, check if the VM container can be created.

Let me know which is preferred. If you have any other suggestions, please let me know.

Hi @jodh-intel I was referring to this. I have implemented option#2 for now as it seemed generic. But please let me know if you have something else in mind.

if hypervisor == "acrn" {
//With ACRN the rootfs for the VM itself
//sits at /dev/vda and consumes the first index.
globalIdx = index + 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case acrn should increase its BlockIndex when launching the guest, instead of hacking the index number on hotplug.

Copy link
Contributor Author

@vijaydhanraj vijaydhanraj Jun 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

globalIdx here is used to find the corresponding virtpath (/dev/vdX) starting with /dev/vda. Not sure how to get this information in ACRN which doesn't maintain the global mapping. This approach is very similar to the Firecracker approach. I believe this issue (#1061) should address this workaround as well. Let me know if I misunderstood.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj index is maintained at the sandbox level and there are helper functions for ACRN to use. You can call getAndSetSandboxBlockIndex() to bump it once and for all when launching the guest ensuring that the first index is taken by the vm rootfs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thanks @bergwolf . I am bumping the index using getAndSetSandboxBlockIndex when acrn appendImage() is called and have left the globalIdx unmodified.

@@ -33,6 +63,8 @@ const (
cpuTypeUnknown = -1
)

var acrnDevice = "/dev/acrn_vhm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const? Or maybe retain as var if you add tests that need to change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made this as a const.

"sse4_1": "SSE4.1",
}
archRequiredCPUAttribs = map[string]string{
archGenuineIntel: "Intel Architecture CPU",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a var/const for the value here as it's now used multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created const for all the values

archRequiredCPUFlags = map[string]string{
"vmx": "Virtualization support",
"lm": "64Bit CPU",
"sse4_1": "SSE4.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, it might be worth creating variables for these duplicated strings too (although not strictly required for this PR since they are already duplicated in master).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created const for all the values

if errno == syscall.EBUSY {
fieldLogger.WithField("reason", "another hypervisor running").Error("cannot create VM")
}
fieldLogger.Infof("ACRN IOCTL Errno=%d", errno)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems redundant as the following line is logging it in structured format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah missed removing the earlier log. done.

}

func archHostCanCreateVMContainer(onVMM bool) error {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: extraneous blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -81,6 +81,7 @@ BINDIR := $(EXEC_PREFIX)/bin
NEMUBINDIR := $(PREFIXDEPS)/bin
QEMUBINDIR := $(PREFIXDEPS)/bin
FCBINDIR := $(PREFIXDEPS)/bin
ACRNBINDIR := $(PREFIXDEPS)/bin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra line of output when you run make:

 $(CONFIG_QEMU) $(CONFIG_NEMU) $(CONFIG_FC) $(CONFIG_ACRN)     # <--- What is this? :)
     GENERATE data/kata-collect-data.sh
     GENERATE cli/config-generated.go
kata-runtime - version 1.8.0-alpha1 (commit addf7ec37319a15e7b6e7a52ad470d0dcdc421e0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, that was a debug print. Removed it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vijaydhanraj - thanks, but I think you may have forgotten to re-push?

Copy link
Contributor Author

@vijaydhanraj vijaydhanraj Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jodh-intel I was looking for your thoughts on (#1779) before pushing. But now have implemented option#2 and have pushed the changes. Please let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Do you mean the proxy PR? 😕

@caoruidong
Copy link
Member

/test

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vijaydhanraj - I've picked over this a little more. I think we need @mcastelino and/or @amshinde to tal at the networking parts.

A general comment: this is a big code change. Can you add some unit tests to support it?

reserved0 uint16 //nolint
vcpu_num uint16 //nolint
reserved1 uint16 //nolint
uuid [16]uint8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be nolint too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added nolint to suppress unused variables. uuid is used when creating VM. Please ref to lines 228-238 in the file.

}
}

devices, err = a.createdummyVirtiBlkDev(devices)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, have added comments.

// Until this support is available, Kata is limited to
// launch 1 VM (using the default UUID).
// https://github.com/kata-containers/runtime/issues/1785
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all commented out code and add back if necessary in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retained the comments and removed the commented code.

return nil
}

func (a *acrn) createdummyVirtiBlkDev(devices []Device) ([]Device, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called createDummyVirtBlkDev (capital D and no i)? A comment explaining the point of this function would be useful imho.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this was a typo and I meticulously followed it everywhere :). Changed this to createDummyVirtioBlkDev


// Disabling UUID check until the below is fixed.
// https://github.com/kata-containers/runtime/issues/1785
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you retain the comment and the URL but remove the commented out code. We want to keep the code as clean as possible. Once that bug is fixed, re-introduce the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, retained the comment and removed the commented code.

if err != nil {
logger.Errorf("Unable to launch %s: %v", path, err)
errStr = stderr.String()
logger.Errorf("%s", errStr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to use one log call per issue. I think you can combine these two log calls by adding all the fields into a single call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need both logs here. "launching acrn with" log gives the params with which acrn is launched. This will be handy to check how the VM was launched. The other log is in case of error and it doesn't log the params.

if err != nil {
return nil, err
}
defer func() { _ = imageFile.Close() }()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify to:

defer imageFile.Close()

... but I'm confused - why are you opening this file? If you want to check it exists, can't you just stat it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used stat() here.

devices = append(devices,
LPCDevice{
Function: 0,
Emul: "lpc",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've used this string already above so I'd consider creating a const for it "just in case" it ever needs to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added const for "lpc". But this will not be changed.

return TAP
case NetXConnectMacVtapModel:
return MACVTAP
//case ModelEnlightened:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what is happening here - can you remove the case ModelEnlightened commented out code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the dead code/comment.

}

func (a *acrnArchBase) appendNetwork(devices []Device, endpoint Endpoint) []Device {
switch ep := endpoint.(type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a default case here (returning an error`)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appendNetwork() just returns a Device. The error will be an empty device or no device being added to the devices array. But did add default case and log indicating no support.

# Block storage driver to be used for the hypervisor in case the container
# rootfs is backed by a block device. This is virtio-scsi, virtio-blk
# or nvdimm.
block_device_driver = "@DEFBLOCKSTORAGEDRIVER_ACRN@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vijaydhanraj Does ACRN support virtio-scsi and nvdimm?
If ACRN does not support 9p, then I suppose it works only with devicemapper?. If so we need to document this here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't support virtio-scsi or nvdimm. Added a note in the toml file.

@@ -9,6 +9,7 @@
package katautils

var defaultHypervisorPath = "/usr/bin/qemu-lite-system-x86_64"
var defaultHypervisorCtlPath = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am asking because, below you are checking if h.Path is empty and assigning it to defaultHypervisorCtlPath if its empty.

devices = a.arch.appendBridges(devices)

//Add LPC device to the list of other devices.
devices = a.arch.appendLPC(devices)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add explanation for why this devices is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LPC device is nothing but UART. Will revisit and see if this can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @amshinde, if there will be no need for UART device, I can remove this. This is primarily used for guest OS serial console and IO(keyboard, mouse).
Does VM debug console require a serial device for its console?

return nil
}

func (a *acrn) createdummyVirtiBlkDev(devices []Device) ([]Device, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add documentation here explaining what this function does and why we need a pool of dummy devices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

switch netdev.Type {
case TAP:
return true
case MACVTAP:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are macvtap devices not supported? If so, how come you are handling macvtap devices in AcrnNetdevParam func above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macvtap is supported. changed to true. Good catch!


func (a *acrnArchBase) appendNetwork(devices []Device, endpoint Endpoint) []Device {
switch ep := endpoint.(type) {
case *VethEndpoint, *BridgedMacvlanEndpoint, *IPVlanEndpoint:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you support these in ACRN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACRN only supports VethEndpoint (bridge +Tap)and MACVTAP. Have removed BridgedMacvlanEndpoint and IPVlanEndpoint.

@@ -1084,7 +1083,12 @@ func (k *kataAgent) buildContainerRootfs(sandbox *Sandbox, c *Container, rootPat
rootfs.Source = blockDrive.VirtPath
} else if sandbox.config.HypervisorConfig.BlockDeviceDriver == config.VirtioBlock {
rootfs.Driver = kataBlkDevType
rootfs.Source = blockDrive.PCIAddr
if blockDrive.PCIAddr == "" {
rootfs.Source = blockDrive.VirtPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

@vijaydhanraj
Copy link
Contributor Author

d some unit tests to support it?

yes will work on adding few unit tests.

@jodh-intel
Copy link
Contributor

We now have https://github.com/kata-containers/tests/blob/master/Unit-Test-Advice.md to help wrt adding unit tests.

@vijaydhanraj
Copy link
Contributor Author

We now have https://github.com/kata-containers/tests/blob/master/Unit-Test-Advice.md to help wrt adding unit tests.

Thanks @jodh-intel

@vijaydhanraj
Copy link
Contributor Author

We now have https://github.com/kata-containers/tests/blob/master/Unit-Test-Advice.md to help wrt adding unit tests.

Thanks @jodh-intel

Hi @jodh-intel I have added the test cases for acrn. Please let me know if anything else is needed.

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vijaydhanraj !

lgtm

@devimc
Copy link

devimc commented Jun 28, 2019

/test

@GabyCT
Copy link
Contributor

GabyCT commented Jul 9, 2019

/test

@vijaydhanraj
Copy link
Contributor Author

Hi @amshinde, @jodh-intel: Even with suggested change in using c.App.Metadata["runtimeConfig"] instead of directly using loadconfiguration, I see the firecracker and nemu tests are failing. Am I missing anything here?

Failure:
07:50:13 time="2019-07-09T14:50:13Z" level=error msg="/usr/share/defaults/kata-containers/configuration-qemu.toml: file /usr/bin/qemu-system-x86_64 does not exist" arch=amd64 name=kata-runtime pid=31316 source=runtime
07:50:13 /usr/share/defaults/kata-containers/configuration-qemu.toml: file /usr/bin/qemu-system-x86_64 does not exist
07:50:13 Failed at 44: sudo -E PATH=$PATH "$kata_runtime_path" kata-check
07:50:13 Failed at 41: "${cidir}/install_runtime.sh"

@jodh-intel
Copy link
Contributor

@vijaydhanraj - I think you may be hitting #1779 (comment) now; the runtime will load configuration.toml and the default packaged version of that file specifies qemu as the hypervisor. Hence, we prolly need to update install_runtime.sh to switch configuration.toml to link to configuration-acrn.toml.

@vijaydhanraj
Copy link
Contributor Author

@vijaydhanraj - I think you may be hitting #1779 (comment) now; the runtime will load configuration.toml and the default packaged version of that file specifies qemu as the hypervisor. Hence, we prolly need to update install_runtime.sh to switch configuration.toml to link to configuration-acrn.toml.

Hi @jodh-intel, should I update for acrn here https://github.com/kata-containers/tests/blob/master/.ci/install_runtime.sh#L54..L62?
Also, the error seems to happen at https://github.com/kata-containers/tests/blob/1e98659a8695521a337fa67306e6fc679d1fe4a6/.ci/install_runtime.sh#L44 before the hypervisor check.

@jodh-intel
Copy link
Contributor

Not sure without digging into this. Any thoughts @chavafg?

@vijaydhanraj
Copy link
Contributor Author

vijaydhanraj commented Jul 9, 2019

thanks @chavafg @amshinde @jodh-intel : Root caused the failures to the recent change in beforeSubcommands() function. When installing_runtime (qemu, firecracker and nemu), the script first calls kata-check and then loads the appropriate configuration.toml file. This was not an issue earlier as beforeSubCommands() would just return nil if the command was kata-check without calling LoadConfiguration() function. So the failure wasn't seen with firecracker or nemu. But now even for kata-check LoadConfiguration() is called by beforeSubComamnds() which works fine for qemu as it is default but fails for firecracker or nemu.

Fix:

diff --git a/.ci/install_runtime.sh b/.ci/install_runtime.sh
index 06968be..fe0c8cf 100755
--- a/.ci/install_runtime.sh
+++ b/.ci/install_runtime.sh
@@ -39,6 +39,21 @@ NEW_RUNTIME_CONFIG="${PKGDEFAULTSDIR}/configuration.toml"
 # Note: This will also install the config file.
 build_and_install "github.com/kata-containers/runtime" "" "true"
 
+if [ "$KATA_HYPERVISOR" = "firecracker" ]; then
+       echo "Enable firecracker configuration.toml"
+       sudo mv "${PKGDEFAULTSDIR}/configuration-fc.toml" "${PKGDEFAULTSDIR}/configuration.toml"
+fi
+
+if [ "$KATA_HYPERVISOR" = "nemu" ]; then
+       echo "Enable nemu configuration.toml"
+       sudo mv "${PKGDEFAULTSDIR}/configuration-nemu.toml" "${PKGDEFAULTSDIR}/configuration.toml"
+fi
+
+if [ "$KATA_HYPERVISOR" = "acrn" ]; then
+       echo "Enable acrn configuration.toml"
+       sudo mv "${PKGDEFAULTSDIR}/configuration-acrn.toml" "${PKGDEFAULTSDIR}/configuration.toml"
+fi
+
 # Check system supports running Kata Containers
 kata_runtime_path=$(command -v kata-runtime)
 sudo -E PATH=$PATH "$kata_runtime_path" kata-check
@@ -51,16 +66,6 @@ if [ -e "${NEW_RUNTIME_CONFIG}" ]; then
        runtime_config_path="${NEW_RUNTIME_CONFIG}"
 fi
 
-if [ "$KATA_HYPERVISOR" = "firecracker" ]; then
-       echo "Enable firecracker configuration.toml"
-       sudo mv "${PKGDEFAULTSDIR}/configuration-fc.toml" "${PKGDEFAULTSDIR}/configuration.toml"
-fi
-
-if [ "$KATA_HYPERVISOR" = "nemu" ]; then
-       echo "Enable nemu configuration.toml"
-       sudo mv "${PKGDEFAULTSDIR}/configuration-nemu.toml" "${PKGDEFAULTSDIR}/configuration.toml"
-fi
-
 if [ -z "${METRICS_CI}" ]; then
        echo "Enabling all debug options in file ${runtime_config_path}"
        sudo sed -i -e 's/^#\(enable_debug\).*=.*$/\1 = true/g' "${runtime_config_path}"

@chavafg: Can you please help with this change?

chavafg added a commit to chavafg/tests-1 that referenced this pull request Jul 10, 2019
Once kata-containers/runtime#1779 is merged, we will be able
to run CI using acrn hypervisor. Add support for running
with its correct configuration file.

Signed-off-by: Salvador Fuentes <[email protected]>
chavafg added a commit to chavafg/tests-1 that referenced this pull request Jul 10, 2019
Once kata-containers/runtime#1779 is merged, we will be able
to run CI using acrn hypervisor. Add support for running kata
with acrn using its dedicated configuration file.

Signed-off-by: Salvador Fuentes <[email protected]>
@chavafg
Copy link
Contributor

chavafg commented Jul 10, 2019

Hi @vijaydhanraj, opened kata-containers/tests#1793 to address the nemu and fc issues.

@vijaydhanraj
Copy link
Contributor Author

Hi @vijaydhanraj, opened kata-containers/tests#1793 to address the nemu and fc issues.

Thanks @chavafg!!

This patch covers the following aspects,
1. Add ACRN as a supported hypervisor for amd64 architecture.
2. Build and install configuration file for ACRN hypervisor.

v1->v2:
1. Deleted autogenerated configuration-acrn.toml.
2. Trimmed configuration options not used by ACRN.

Fixes: kata-containers#1778

Signed-off-by: Vijay Dhanraj <[email protected]>
ACRN hypervisor is a type-1 hypervisor and this patch
adds support to check and validate if the system is
capable of running kata containers with ACRN hypervisor.

Depends-on: github.com/kata-containers/tests#1793

v3->v4:
Implemented a generic way to identify hypervisor and
test VM creation.

v2->v3:
1. Removed cgo structs and defined go structs.
2. Suppressed lint warnings due to unused createVM struct.

v1->v2:
1. Created an issue kata-containers#1784 to address TODO item.
2. Fixed formatting of the log message.
3. Currently ACRN is only supported on amd64. So
   moved ACRN specific code to kata-check_amd64.go.

Fixes: kata-containers#1778

Signed-off-by: Vijay Dhanraj <[email protected]>
This patch adds support for,
1. Extracting and configuring ACRN hypervisor from toml.
2. Add ACRN hypervisor ctl for controlling ACRN hypervisor.
This will be used for updating virtio-blk based
container rootfs using blk rescan feature.

v2->v3:
Fixed acrnctl path.

v1->v2:
Trimmed hypervisor config options as needed by ACRN.

Fixes: kata-containers#1778

Signed-off-by: Vijay Dhanraj <[email protected]>
This patch adds the following,
1. Implement Sandbox management APIs for ACRN.
2. Implement Sandbox operation APIs for ACRN.
3. Add support for hot-plugging virtio-blk based
(using blk rescan feature) container rootfs to ACRN.
4. Prime devices, image and kernel parameters for
launching VM using ACRN.

v2->v3:
Incrementing index to keep track of virtio-blk devices
created. This change removes the workaround introduced
in block.go.

v1->v2:
1. Created issue kata-containers#1785 to address the UUID TODO item.
2. Removed dead code.
3. Fixed formatting of log messages.
4. Fixed year in copyright message.
5. Removed acrn_amd64.go file as there are no amd64 specific
   changes. Moved the code to acrn_arch_base.go.

Fixes: kata-containers#1778

Signed-off-by: Vijay Dhanraj <[email protected]>
…ootfs

Thist patch adds the following,
1. ACRN only supports virtio-blk and so the rootfs for the VM
   sits at /dev/vda. So to get the container rootfs increment the
   globalIndex by 1.
2. ACRN doesn't hot-plug container rootfs (but uses blkrescan) to
   update the container rootfs. So the agent can be provided the virtpath
   rather than the PCIaddr avoiding unneccessary rescaning to find the
   virthpath.

v1->v2:
Removed the workaround of incrementing index for
virtio-blk device and addressed it acrn.

Fixes: kata-containers#1778

Signed-off-by: Vijay Dhanraj <[email protected]>
This patch adds unit test cases for acrn specific changes.

Fixes: kata-containers#1778
Signed-off-by: Vijay Dhanraj <[email protected]>
@chavafg
Copy link
Contributor

chavafg commented Jul 10, 2019

/test

@amshinde
Copy link
Member

@chavafg @GabyCT The fc job seems to not been triggered. Can you take a look here?

@chavafg
Copy link
Contributor

chavafg commented Jul 10, 2019

@GabyCT recently changed the name of the job, so it is now shown as jenkins-ci-ubuntu-1804-firecracker and passed correctly.

@amshinde
Copy link
Member

Thanks @chavafg.
@bergwolf @devimc Does this PR look good to you?

@amshinde amshinde merged commit 5e67e04 into kata-containers:master Jul 11, 2019
GabyCT pushed a commit to GabyCT/tests-1 that referenced this pull request Jul 17, 2019
Once kata-containers/runtime#1779 is merged, we will be able
to run CI using acrn hypervisor. Add support for running kata
with acrn using its dedicated configuration file.

Signed-off-by: Salvador Fuentes <[email protected]>
Copy link
Member

@WeiZhang555 WeiZhang555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

if err = a.store.Load(store.Hypervisor, &a.info); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you stored a.info, but before this you just Load and Store a.state, so which one do you really mean to save? a.info or a.state ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @WeiZhang555 @amshinde @bergwolf , plan is to store both a.state and a.info. As a part a.state UUID related information will be stored. Since this is WIP, removed the code and just added comment and issue ID in its place. Once the issue is addressed through a new PR, this will not be the case.
Ref: #1785

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you must save and load same information always, if you save/load a.info here and save/load a.state there, it will bring chaos.

If you plan to store both a.state and a.info, then you should merge them and save them together.

@vijaydhanraj

}

//Store VMM information
return a.store.Store(store.Hypervisor, a.info)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you stored a.info again. I guess a.info is the real data you want to save?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HV: Add kata-runtime support for ACRN hypervisor