1960 Commits

Author SHA1 Message Date
Remi Bergsma
c0fde9a12b Merge pull request #731 from remibergsma/centos7-kvm
CLOUDSTACK-8443: Support CentOS 7 as KVM hypervisorThis adds support for CentOS 7 as a KVM hypervisor. As discussed in the Jira issue, the root cause of the issue was the `cloudstack-setup-agent` script that added this line to `/etc/libvirt/qemu.conf`:

`cgroup_controllers=["cpu"]`

On CentOS 6 this 'works', but since by default no cgroups are mounted, this setting is ignored by `libvirtd`. On CentOS 7 is does not work, because the `cpu` and `cpuacct` are 'co-mounted'. This simpy means you cannot use one without the order. The config line above instructs `libvirtd` to only use the `cpu` cgroup, which it can't.

There was code added to make sure the `cpu` cgroup was not co-mounted. It did this with a shell script, but after a reboot it was gone. It wasn't reliable and not even a solution at all. I went ahead and removed the code, because the co-mounted cgroups work fine. The real issue was the config line we put in `/etc/libvirt/qemu.conf` so much better to fix that instead.

The default for `libvirtd` is to use only cgroups that are mounted. When you remove the 'cgroup_controllers' line, the default kicks in. According to the `qemu.conf` file, the default is:

`cgroup_controllers = ["cpu", "devices", "memory", "blkio", "cpuacct", "net_cls"]`

Then again, if it's not mounted, it's not used. So, that's a nice way to control it.
This works just fine for both RHEL/CentOS 6 and RHEL/CentOS 7.

Along the debugging, I came across some small issues here and there which I also fixed in this PR.

If you test this, be sure to build RPMs from this branch and install those on the KVM hypervisor.

At Schuberg Philis we run KVM hypervisors on CentOS 7 for months with these fixes. Now I took the time to fix the issues in CloudStack, rather than work around them.

@bhaisaab @karuturi could you please review this? Thanks!

Please note:
The next step is to fix CLOUDSTACK-8625 (Systemd profile for KVM Agent) as currently a sysvinit script is still used. Although it works, we do not have any systemd benefits. As it is a separate issue, I'll try to address it in a separate PR.

* pr/731:
  CLOUDSTACK-8443: detect CentOS 7.x as RHEL 7 alike
  CLOUDSTACK-8443: mention the correct logfile
  CLOUDSTACK-8443: display the right hypervisor type
  CLOUDSTACK-8443: don't try to fix co-mounted cgroups

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-08-25 10:32:27 +02:00
Remi Bergsma
87fdb521f0 CLOUDSTACK-8443: don't try to fix co-mounted cgroups
This setting works on CentOS 6 / RHEL 6 but does nothing, as
"cpu" cgroup is not mounted. On CentOS 7 / RHEL 7 systemd does
mount cgroups and "cpu" is co-mounted with "cpuacc". Hence, if
we specify "cpu" then this results in an error because it can
only use them both, or none.

By removing the setting, we rely on the default of qemu, which
is:
cgroup_controllers = ["cpu", "devices", "memory", "blkio", "cpuacct", "net_cls"]

Only if they are really mounted, they will be used. So, this will
work on both version 6 and 7.

The 'fix script' didn't work well, as after a reboot you'd still have qemu
throwing errors. Now we can handle the co-mountedcgroups.
2015-08-24 15:49:40 +02:00
Wei Zhou
92344c006d CLOUDSTACK-5863: revert volume snapshot for KVM/QCOW2 2015-08-24 11:01:50 +02:00
Miguel Ferreira
82df5b156b Add UUIDs to constructors (fixing syntax error from 2a6c7f3)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #722
2015-08-24 14:12:49 +05:30
Miguel Ferreira
20be6c24f7 Formatting class CitrixRequestWrapperTest
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-24 14:12:49 +05:30
Remi Bergsma
614ee494ee Merge pull request #700 from rafaelweingartner/master-lrg-cs-hackday-001
Removed duplicate code in CitrixResourceBase and its subclassesRemoved unnecessary duplicated code by having the body of the getPatchFiles method only in the CitrixResourceBase superclass. Given that all of its implementations consisted of the same code except for the path which contains the necessary file for that implementation. An abstract method getPatchFilePath was created in the CitrixResourceBase superclass so that each implementation may return the path containing the specific file needed by that implementation.

Test cases were created for each implementation, simple as they may be. One assert is made to verify that the path returned by each implementation corresponds to the path that was previously specified on each getPatchFiles implementation.

* pr/700:
  Removed duplicate code in CitrixResourceBase.getPatchFiles

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-08-20 11:20:00 +02:00
Rohit Yadav
3fd35dd4a7 CLOUDSTACK-8749: KVM - cleanup linklocal interface based on names
This tries to avoid cleaning by a device name.

This closes #718

(cherry picked from commit 74f697a2dd6e2630fa1fa5949e41c7d539015fbf)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-19 21:43:24 +05:30
Boris Schrijver
c30ba1df0b Refactored Nic.java for readability.
Changed methodnames according to Nic.java refactor.

Fixed NicVO.java due to regression from Nic.java refactor.

Fixed VmWareGuru.java after Nic.java refactor.

See issue CLOUDSTACK-8736 for ongoing effort to clean up network code.
2015-08-18 14:04:48 +02:00
weingartner
ec8976f802 Removed duplicate code in CitrixResourceBase.getPatchFiles
@cristofolini comments:
Removed unnecessary duplicated code by having the body of the
getPatchFiles method only in the
CitrixResourceBase superclass. Given that all of its implementations
consisted of the same code
except for the path which contains the necessary file for that
implementation. An abstract method
getPatchFilePath was created in the CitrixResourceBase superclass so
that each implementation may
return the path containing the specific file needed by that
implementation.

Test cases were created for each implementation, simple as they may be.
One assert is made to verify
that the path returned by each implementation corresponds to the path
that was previously specified
on each getPatchFiles implementation.

removed trailing whitespace
2015-08-17 13:26:25 -03:00
Boris Schrijver
5db3371840 Refactored NicProfile.java for readability.
See issue CLOUDSTACK-8736 for ongoing effort to clean up network code.
2015-08-17 14:12:10 +02:00
Remi Bergsma
caa524b01b Merge pull request #630 from manuiiit/pull-2
Fixed Coverity issue "Dereference null return value"Fixed Coverity issue "Dereference null return value"

* pr/630:
  Fixed Coverity issue "Dereference null return value"

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-08-17 08:38:38 +02:00
manuiiit
3cc0fecccc Fixed Coverity issue "Dereference null return value" 2015-08-15 01:34:24 +05:30
Remi Bergsma
64ff67da55 Merge pull request #654 from DaanHoogland/CLOUDSTACK-8656
Cloudstack 8656: do away with more silently ignoring exceptions.a lot of messages added.
some restructuring for test exception assertions and try-with-resource blocks

* pr/654: (29 commits)
  CLOUDSTACK-8656: more logging instead of sysout
  CLOUDSTACK-8656: use catch block for validation
  CLOUDSTACK-8656: class in json specified not found
  CLOUDSTACK-8656: removed unused classes
  CLOUDSTACK-8656: restructure of tests
  CLOUDSTACK-8656: reorganise sychronized block
  CLOUDSTACK-8656: restructure tests to ensure exception throwing
  CLOUDSTACK-8656: validate the throwing of ServerApiException
  CLOUDSTACK-8656: logging ignored exceptions
  CLOUDSTACK-8656: try-w-r removes need for empty catch block
  CLOUDSTACK-8656: try-w-r instead of clunckey close-except
  CLOUDSTACK-8656: deal with empty SQLException catch block by try-w-r
  CLOUDSTACK-8656: unnecessary close construct removed
  CLOUDSTACK-8656: message about timed buffer logging
  CLOUDSTACK-8656: message about invalid number from store
  CLOUDSTACK-8656: move cli test tool to separate file
  CLOUDSTACK-8656: exception is the rule for some tests
  CLOUDSTACK-8656: network related exception logging
  CLOUDSTACK-8656: reporting ignored exceptions in server
  CLOUDSTACK-8656: log in case we are on a platform not supporting UTF8
  ...

Signed-off-by: Remi Bergsma <github@remi.nl>
2015-08-14 21:38:49 +02:00
Daan Hoogland
384a2e9cee CLOUDSTACK-8656: class in json specified not found 2015-08-14 16:29:21 +02:00
Aaron Brady
77a96ed1f7 Default to notify only script to handle non-CLVM/QCOW cases.
Before this commit the call to `getResizeScriptType` would throw
an exception (earlier versions returned `null`, which was fine) -
this caused the RBD case to fail. By changing the default to
notify only we fix the case for any non-CLVM and non-QCOW cases.

This is RBD for now, but this should extend to new storage
types suppored by Libvirt natively in future.
2015-08-14 12:15:07 +01:00
Rohit Yadav
869a83f8f8 plugins: fix test case, interface usage and checkstyle import issue
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-14 12:23:50 +05:30
Rohit Yadav
5d29b63cfa CLOUDSTACK-8613, CLOUDSTACK-6301: Dump KVM domain XML with secure flag
When dumping XML use appropriate flags:

1, VIR_DOMAIN_XML_SECURE (dump security sensitive information too)
8, VIR_DOMAIN_XML_MIGRATABLE (dump XML suitable for migration)

Source:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags

This fixes CVE 2015-3252: VNC password lost during VM migration across KVM
hosts. The issue is also seen when a VM is rebooted.

(cherry picked from commit cb2aca751630ea60ad2fffed3d12e3fa2a5e93b5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-08-14 10:57:36 +05:30
Mike Tutkowski
8b0266d12e Merge branch 'pr/547'
* pr/547:
  CLOUDSTACK-8601. VMFS storage added as local storage can be re-added as shared storage. Fail addition of a VMFS shared storage pool in case it has already been added as local storage in CS.

Signed-off-by: Mike Tutkowski <mike.tutkowski@solidfire.com>
2015-08-10 19:00:53 -06:00
Daan Hoogland
ed6e261521 CLOUDSTACK-8656: t-w-r on socket channel
like previous in hyperv now in vmware
2015-08-04 14:24:04 +02:00
Daan Hoogland
55df06779b CLOUDSTACK-8656: try-with resource on socket channel 2015-08-04 14:12:01 +02:00
Daan Hoogland
e2b6237464 CLOUDSTACK-8656: debug messages on interupted exceptions 2015-07-30 16:03:10 +02:00
Daan Hoogland
85e002b230 CLOUDSTACK-8656: filling empty catch block with info messages
using regexp "catch\s*\(\s*(Exception|Throwable)\s*\w*\)\s*\{\s*\}"
2015-07-30 15:51:52 +02:00
Maneesha P
1f09b8c3bf Fixed Coverity issue "Dereference null return value"
added a not null check and a CloudRuntimeException in case of null

Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>

This closes #617
2015-07-23 15:46:17 +05:30
Wido den Hollander
d1f76a2a84 CLOUDSTACK-8628: kvm: Disable Fencing when no NFS storage pools are present
On NFS we write a heartbeat, but without those we can not safely
fence off a host.

If we fence without knowing about a heartbeat we can cause a split-brain situation.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2015-07-17 12:33:11 +02:00
Likitha Shetty
f5ed824ea2 CLOUDSTACK-8598. CS reports volume migration as successful but the volume is not migrated in vCenter.. For the following disk operations - migration, snapshot creation, resize, detach and template creation, CS should do an exact disk match between volume path and vCenter disk name. If the exact matching fails to find a disk, CS should fall back to the old method of partial matching on a trimmed disk.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #543
2015-07-16 10:44:58 +02:00
Funs
ca68bb0ef7 xenserver: Improved message for peeples to actually see what the problem is.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #576
2015-07-15 18:24:39 +05:30
Daan Hoogland
e62d952375 coverity 1311706: to generic exeption handling on xapi call
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-07-14 13:41:09 +02:00
Daan Hoogland
c53959513e findbugs: create wrapper to deal with static field
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #573
2015-07-14 11:50:39 +02:00
Daan Hoogland
10853bfa8a adhere to naming conventions for enums
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-07-14 11:50:39 +02:00
Wido den Hollander
63688e70a0 kvm: More verbose logging around storage pools in the Agent 2015-07-13 16:53:26 +02:00
Wido den Hollander
24f8e66e93 kvm: Write Libvirt instead of LibVirt 2015-07-13 16:22:33 +02:00
Wido den Hollander
7c37ba73a3 kvm: Add more verbose logging about what is happening with Libvirt connections 2015-07-13 16:21:41 +02:00
Jayapal
deb694c201 CLOUDSTACK-8324: Added migration changes for config drive 2015-07-10 09:39:27 +05:30
Daan Hoogland
6376503fe3 coverity 1308118: more resources being opened only one closed on exception nothing was closed
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-07-09 21:30:23 +02:00
Daan Hoogland
bcc8182f2f findbugs: write to static from instance these are the trivial cases of ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD as reported by findbugs
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #539
2015-07-09 15:01:58 +02:00
weingartner
25e9918c57 Amend last commit, used 4 spaces in code formatting instead of 1 tab character.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #560
2015-07-09 13:37:59 +02:00
weingartner
50c4836c9f Cleaned class “com.cloud.hypervisor.xenserver.resource.XcpOssResource” that seemed to be forgotten during the evolution of the ACS. It was removed a few methods that were already coded properly in its parent class “com.cloud.hypervisor.xenserver.resource.CitrixResourceBase”. It was also removed some methods that seemed to cause weird behaviors. The methods removed/fixed are detailed as follows: • com.cloud.hypervisor.xenserver.resource.XcpOssResource.fillHostInfo(Connection, StartupRoutingCommand) – it was removed, because it always added the string “, hvm” to the host capabilities. Therefore, if one uses XCP hypervisor it could cause a lot of trouble when deploying HVM virtual machines in an environment that has PV and HVM clusters. The method is already properly coded in parent class. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.launchHeartBeat(Connection) – It was removed. It was not performing anything and always returns a true value. The method of parent class is properly coded and works for XCP environments. The heartbeat plugin exists in XCP environment. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.initializeLocalSR(Connection) – it was removed. The method of the parent class works properly for XCP environments. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.createPatchVbd(Connection, String, VM) – It was removed. This method causes a bug in XCP environments, because of its half-implementation, it was not possible to migrate system VMs. The parent class implementation works properly for XCP. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.execute(NetworkUsageCommand) – removed, hence it was already coded into parent class and its respective wrappers (“com.cloud.hypervisor.xenserver.resource.wrapper.xcp.XcpServerNetworkUsageCommandWrapper”). BTW: I noticed that the class XcpServerNetworkUsageCommandWrapper and XenServer56NetworkUsageCommandWrapper are almost the same, with the exception that XenServer56NetworkUsageCommandWrapper deals with VPC. I believe that those wrappers could be converted into one, and moved to parent. I am not doing that here because I do not have a XCP environment with advanced networking to test it. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.executeRequest(Command) – removed, hence it is not needed anymor. • com.cloud.hypervisor.xenserver.resource.XcpOssResource.execute(StopCommand) – I did not understand that method. It seemed weird and its removal did not change any behavior of the environment I tested it with.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-07-09 13:37:59 +02:00
Daan Hoogland
31c6b14dd4 Merge branch 'improvement/CLOUDSTACK-8607' change the host password on the host itself via the updateHostPassword API
- Make sure the new password replaces the old one in the queue
    - Updated the patch files for XenServer
    - Updated the script path on LibvirtComputing class
    - Adding update_host_passwd to VRScripts
    - Add implementation to CitrixUpdateHostPasswordCommandWrapper
    - Improve testUpdateHostPasswordCommand() unit test on CitrixRequestWrapperTest
    - Adding update_host_passwd.sh script
    - Adding the host IP address as an instance variable on UpdateHostPasswordCommand
    - Improving the Unit Test (LibvirtComputingResourceTest) to get it covering the new code
    - Make sure doUpdateHostPassword() doesn't get called if flag is set to false
    - Do not update XenServer hosts if the cluster ID is not informed

    This closes #559
2015-07-06 16:15:22 +02:00
wilderrodrigues
e348e76eee CLOUDSTACK-8607 - Improving unit tests
- Adding more unit tests as suggested by Daan and Rajani.
   - Mocking SshHelper and the Script classes, used by Citrix and Libvirt resources respectively.
2015-07-06 14:58:17 +02:00
wilderrodrigues
86297e70be CLOUDSTACK-8607 - Make sure the new password replaces the old one in the queue
- Added log info to show details of the operation
   - Renamed the addPwdToQueue to replaceOldPasswdInQueue
2015-07-04 11:33:52 +02:00
wilderrodrigues
efa34361df CLOUDSTACK-8607 - Changed update script to return exit code based on the result
- Changed location of the update_host_passwd script
   - Updated the patch files for XenServer
   - Updated the script path on LibvirtComputing class
   - Removed the hostIP from the LibvirtUpdateHostPasswordCommandWrapper execute() method
2015-07-03 14:29:57 +02:00
Kishan Kavala
3a19a8916e BUG-ID:CLOUDSTACK-7472: kvmclock fix for LXC is not required after fixing CLOUDSTACK-8177
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #557
2015-07-03 15:21:18 +05:30
wilderrodrigues
0dd02ce043 CLOUDSTACK-8607 - Adding support to update host passwd on XenServer hypervisors
- Adding update_host_passwd to VRScripts
   - Add accessor method to host password on CitrixResourceBase
   - Add implementation to CitrixUpdateHostPasswordCommandWrapper
   - Improve testUpdateHostPasswordCommand() unit test on CitrixRequestWrapperTest
   - Add line to patch files on xenserver directory

Concerning the LibVirt change:

   - I forgot to assing the return of the getDefaultHypervisorScriptsDir() method to the hypervisorScriptsDir variable
2015-07-03 10:24:44 +02:00
wilderrodrigues
47c7a1083f CLOUDSTACK-8607 - Adding update_host_passwd.sh script
- Modifying the LibvirtUpdateHostPasswordCommandWrapper in order to execute the script on the host
   - Adding the script path to LibvirtComputingResource
   - Adding the host IP address as an instance variable on UpdateHostPasswordCommand
   - Improving the Unit Test (LibvirtComputingResourceTest) to get it covering the new code
2015-07-02 14:54:51 +02:00
Likitha Shetty
9463356ca6 CLOUDSTACK-8600. Upon detaching a disk, delete VM folder if empty.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #545
2015-07-01 14:53:23 +02:00
Likitha Shetty
299c07c3e1 CLOUDSTACK-8597. Failed to migrate volume from zone-wide to cluster-wide storage. While live migrating a volume, CS chooses the endpoint to perform the migration by selecting any host that has the storage containing the volume mounted on it. Instead, if the volume is attached to a running VM, the endpoint chosen by CS should be the host that contains the VM.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #541
2015-07-01 12:33:26 +02:00
Likitha Shetty
13a98dd196 CLOUDSTACK-8601. VMFS storage added as local storage can be re-added as shared storage.
Fail addition of a VMFS shared storage pool in case it has already been added as local storage in CS.
2015-07-01 10:47:36 +05:30
wilderrodrigues
527d6ee77b Making possible to update KVM hosts password in the database via the API
- Make sure the doUpdateHostPassword() method returns the result from the answer, not always true
   - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent
     That's will be further implemented in the future. The command will avoid the agent to complain about Unsupported command
   - Added a test to make sure the current implementation of the comment works
     - If changes in the future, it will also require changes. In that way, we make sure nobody will break it

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #527
2015-06-29 09:59:12 +02:00
Daan Hoogland
8a8849354c findbugs: masking fields removed 2015-06-24 12:24:12 +02:00
Daan Hoogland
e8984d16ed findbugs: move assert to a place where it still makes sense
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-23 23:27:03 +02:00