Skip to content

Commit 7b74988

Browse files
committed
Merge branch 'master' into dev
* master: server: add conditions for custom offerings (apache#4540) vr: Ensuring dnsmasq.leases file is populated (apache#4529) template: Ensuring template is cross zone if type changed to system (apache#4522) storage: Fix hypervisor type cast to string (apache#4516) db upgrade: fix sql exception: Access denied; you need (at least one of) the SUPER privilege(s) for this operation (apache#4533) CLOUDSTACK-10423:Potential sensitive information disclosure (apache#4536) jobs: The patch remove the password from resultObject and make it be humanreadable (apache#4538) listphysicalnetworks: Honouring keyword parameter (apache#4511) Fix NPE when Volume exists on secondary store but doesn't have a download URL (apache#4530) apidoc issue (apache#4532) db: Fix description of volume.stats.interval which is in milliseconds not seconds (apache#4526) kvm: set cpu topology only if cpucore per socket is positive value (apache#4527) xenserver: check and eject patch vbd for systemvms (apache#4525) Fix warning when setup cloudstack-common (apache#4523) kvm: FIX cpucorespersocket is not working on KVM (apache#4497) change debug to warn for unknown exceptions (apache#4521) Fix failure in validating IP address in case of multiple Management Servers (apache#4507) Update log output for FirstFitPlanner (apache#4515) ui: deprecate old UI and move to legacy to be served at /client/legacy (apache#4518)
2 parents 71956b7 + 874c7be commit 7b74988

File tree

305 files changed

+2165
-2072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+2165
-2072
lines changed

engine/schema/src/main/resources/META-INF/db/schema-410to420.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2);
12881288
UPDATE `cloud_usage`.`account` SET `default`=1 WHERE id IN (1,2);
12891289
UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2);
12901290

1291-
ALTER VIEW `cloud`.`user_view` AS
1291+
CREATE OR REPLACE VIEW `cloud`.`user_view` AS
12921292
select
12931293
user.id,
12941294
user.uuid,

engine/schema/src/main/resources/META-INF/db/schema-41120to41200.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ alter table `cloud`.`disk_offering` add `iops_read_rate_max_length` bigint(20) d
6060
alter table `cloud`.`disk_offering` add `iops_write_rate_max` bigint(20) default null after `iops_write_rate`;
6161
alter table `cloud`.`disk_offering` add `iops_write_rate_max_length` bigint(20) default null after `iops_write_rate_max`;
6262

63-
ALTER VIEW `cloud`.`disk_offering_view` AS
63+
CREATE OR REPLACE VIEW `cloud`.`disk_offering_view` AS
6464
SELECT
6565
`disk_offering`.`id` AS `id`,
6666
`disk_offering`.`uuid` AS `uuid`,
@@ -105,7 +105,7 @@ ALTER VIEW `cloud`.`disk_offering_view` AS
105105
(`disk_offering`.`state` = 'ACTIVE');
106106

107107

108-
ALTER VIEW `cloud`.`service_offering_view` AS
108+
CREATE OR REPLACE VIEW `cloud`.`service_offering_view` AS
109109
SELECT
110110
`service_offering`.`id` AS `id`,
111111
`disk_offering`.`uuid` AS `uuid`,
@@ -159,4 +159,4 @@ ALTER VIEW `cloud`.`service_offering_view` AS
159159
(`disk_offering`.`state` = 'Active');
160160

161161
-- PR#2578 New column for listManagementServers API call
162-
ALTER TABLE `mshost` ADD COLUMN `uuid` varchar(40) AFTER `name`;
162+
ALTER TABLE `mshost` ADD COLUMN `uuid` varchar(40) AFTER `name`;

engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,3 +840,6 @@ ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT N
840840

841841
-- Fix Zones are returned in a random order (#3934)
842842
UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;
843+
844+
-- Fix description of volume.stats.interval which is in milliseconds not seconds
845+
UPDATE `cloud`.`configuration` SET `description` = 'Interval (in milliseconds) to report volume statistics' WHERE `name` = 'volume.stats.interval';

engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/VolumeServiceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public void testCreatePrimaryStorage() {
276276
params.put("path", uri.getPath());
277277
params.put("protocol", StoragePoolType.NetworkFilesystem);
278278
params.put("dcId", dcId.toString());
279+
params.put("hypervisorType", HypervisorType.None);
279280
params.put("clusterId", clusterId.toString());
280281
params.put("name", this.primaryName);
281282
params.put("port", "1");
@@ -318,6 +319,7 @@ public DataStore createPrimaryDataStore() {
318319
params.put("path", uri.getPath());
319320
params.put("protocol", Storage.StoragePoolType.NetworkFilesystem);
320321
params.put("dcId", dcId.toString());
322+
params.put("hypervisorType", HypervisorType.None);
321323
params.put("clusterId", clusterId.toString());
322324
params.put("name", this.primaryName);
323325
params.put("port", "1");

framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ public Long doInTransaction(TransactionStatus status) {
257257
@Override
258258
@DB
259259
public void completeAsyncJob(final long jobId, final Status jobStatus, final int resultCode, final String resultObject) {
260+
String resultObj = null;
260261
if (s_logger.isDebugEnabled()) {
261-
String resultObj = obfuscatePassword(resultObject, HidePassword.value());
262-
resultObj = convertHumanReadableJson(resultObj);
262+
resultObj = convertHumanReadableJson(obfuscatePassword(resultObject, HidePassword.value()));
263263
s_logger.debug("Complete async job-" + jobId + ", jobStatus: " + jobStatus + ", resultCode: " + resultCode + ", result: " + resultObj);
264264
}
265265

@@ -268,7 +268,7 @@ public void completeAsyncJob(final long jobId, final Status jobStatus, final int
268268
if (job == null) {
269269
if (s_logger.isDebugEnabled()) {
270270
s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
271-
resultObject);
271+
resultObj);
272272
}
273273
// still purge item from queue to avoid any blocking
274274
_queueMgr.purgeAsyncJobQueueItemId(jobId);

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,14 +2302,7 @@ public LibvirtVMDef createVMFromSpec(final VirtualMachineTO vmTO) {
23022302
if (vmTO.getType() == VirtualMachine.Type.User) {
23032303
cmd.setFeatures(_cpuFeatures);
23042304
}
2305-
// multi cores per socket, for larger core configs
2306-
if (vcpus % 6 == 0) {
2307-
final int sockets = vcpus / 6;
2308-
cmd.setTopology(6, sockets);
2309-
} else if (vcpus % 4 == 0) {
2310-
final int sockets = vcpus / 4;
2311-
cmd.setTopology(4, sockets);
2312-
}
2305+
setCpuTopology(cmd, vcpus, vmTO.getDetails());
23132306
vm.addComp(cmd);
23142307
}
23152308

@@ -4230,4 +4223,26 @@ public boolean isSecureMode(String bootMode) {
42304223

42314224
return false;
42324225
}
4226+
4227+
private void setCpuTopology(CpuModeDef cmd, int vcpus, Map<String, String> details) {
4228+
// multi cores per socket, for larger core configs
4229+
int numCoresPerSocket = -1;
4230+
if (details != null) {
4231+
final String coresPerSocket = details.get(VmDetailConstants.CPU_CORE_PER_SOCKET);
4232+
final int intCoresPerSocket = NumbersUtil.parseInt(coresPerSocket, numCoresPerSocket);
4233+
if (intCoresPerSocket > 0 && vcpus % intCoresPerSocket == 0) {
4234+
numCoresPerSocket = intCoresPerSocket;
4235+
}
4236+
}
4237+
if (numCoresPerSocket <= 0) {
4238+
if (vcpus % 6 == 0) {
4239+
numCoresPerSocket = 6;
4240+
} else if (vcpus % 4 == 0) {
4241+
numCoresPerSocket = 4;
4242+
}
4243+
}
4244+
if (numCoresPerSocket > 0) {
4245+
cmd.setTopology(numCoresPerSocket, vcpus / numCoresPerSocket);
4246+
}
4247+
}
42334248
}

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ protected boolean poolHasHotFix(Connection conn, String hostIp, String hotFixUui
369369
s_logger.warn("Unable to resolve the host name", e);
370370
return null;
371371
} catch (Exception e) {
372-
s_logger.debug("other exceptions: " + e.toString(), e);
372+
s_logger.warn("other exceptions: " + e.toString(), e);
373373
return null;
374374
}
375375
return resources;

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,33 +1063,46 @@ protected SR createNfsSRbyURI(final Connection conn, final URI uri, final boolea
10631063
}
10641064
}
10651065

1066-
public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException {
1066+
public SR findPatchIsoSR(final Connection conn) throws XmlRpcException, XenAPIException {
1067+
Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
1068+
if (srs.size() != 1) {
1069+
s_logger.debug("Failed to find SR by name 'XenServer Tools', will try to find 'XCP-ng Tools' SR");
1070+
srs = SR.getByNameLabel(conn, "XCP-ng Tools");
1071+
}
1072+
if (srs.size() != 1) {
1073+
s_logger.debug("Failed to find SR by name 'XenServer Tools' or 'XCP-ng Tools', will try to find 'Citrix Hypervisor' SR");
1074+
srs = SR.getByNameLabel(conn, "Citrix Hypervisor Tools");
1075+
}
1076+
if (srs.size() != 1) {
1077+
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools or XCP-ng Tools or Citrix Hypervisor Tools");
1078+
}
1079+
final SR sr = srs.iterator().next();
1080+
sr.scan(conn);
1081+
return sr;
1082+
}
10671083

1068-
if (_host.getSystemvmisouuid() == null) {
1069-
Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
1070-
if (srs.size() != 1) {
1071-
s_logger.debug("Failed to find SR by name 'XenServer Tools', will try to find 'XCP-ng Tools' SR");
1072-
srs = SR.getByNameLabel(conn, "XCP-ng Tools");
1073-
}
1074-
if (srs.size() != 1) {
1075-
s_logger.debug("Failed to find SR by name 'XenServer Tools' or 'XCP-ng Tools', will try to find 'Citrix Hypervisor' SR");
1076-
srs = SR.getByNameLabel(conn, "Citrix Hypervisor Tools");
1077-
}
1078-
if (srs.size() != 1) {
1079-
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools or XCP-ng Tools or Citrix Hypervisor Tools");
1084+
public VDI findPatchIsoVDI(final Connection conn, final SR sr) throws XmlRpcException, XenAPIException {
1085+
if (sr == null) {
1086+
return null;
1087+
}
1088+
final SR.Record srr = sr.getRecord(conn);
1089+
for (final VDI vdi : srr.VDIs) {
1090+
final VDI.Record vdir = vdi.getRecord(conn);
1091+
if (vdir.nameLabel.contains("systemvm.iso")) {
1092+
return vdi;
10801093
}
1081-
final SR sr = srs.iterator().next();
1082-
sr.scan(conn);
1094+
}
1095+
return null;
1096+
}
10831097

1084-
final SR.Record srr = sr.getRecord(conn);
1098+
public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException {
10851099

1100+
if (_host.getSystemvmisouuid() == null) {
1101+
final SR sr = findPatchIsoSR(conn);
10861102
if (_host.getSystemvmisouuid() == null) {
1087-
for (final VDI vdi : srr.VDIs) {
1088-
final VDI.Record vdir = vdi.getRecord(conn);
1089-
if (vdir.nameLabel.contains("systemvm.iso")) {
1090-
_host.setSystemvmisouuid(vdir.uuid);
1091-
break;
1092-
}
1103+
final VDI vdi = findPatchIsoVDI(conn, sr);
1104+
if (vdi != null) {
1105+
_host.setSystemvmisouuid(vdi.getRecord(conn).uuid);
10931106
}
10941107
}
10951108
if (_host.getSystemvmisouuid() == null) {
@@ -1489,24 +1502,33 @@ protected String deleteSnapshotBackup(final Connection conn, final Long dcId, fi
14891502
return result;
14901503
}
14911504

1492-
public void destroyPatchVbd(final Connection conn, final String vmName) throws XmlRpcException, XenAPIException {
1493-
try {
1494-
if (!vmName.startsWith("r-") && !vmName.startsWith("s-") && !vmName.startsWith("v-")) {
1495-
return;
1496-
}
1497-
final Set<VM> vms = VM.getByNameLabel(conn, vmName);
1498-
for (final VM vm : vms) {
1505+
public void destroyPatchVbd(final Connection conn, final Set<VM> vms) throws XmlRpcException, XenAPIException {
1506+
final SR sr = findPatchIsoSR(conn);
1507+
final VDI patchVDI = findPatchIsoVDI(conn, sr);
1508+
for (final VM vm : vms) {
1509+
final String vmName = vm.getNameLabel(conn);
1510+
try {
1511+
if (!vmName.startsWith("r-") && !vmName.startsWith("s-") && !vmName.startsWith("v-")) {
1512+
return;
1513+
}
14991514
final Set<VBD> vbds = vm.getVBDs(conn);
15001515
for (final VBD vbd : vbds) {
1501-
if (vbd.getType(conn) == Types.VbdType.CD) {
1502-
vbd.eject(conn);
1516+
if (Types.VbdType.CD.equals(vbd.getType(conn))) {
1517+
if (!vbd.getEmpty(conn)) {
1518+
vbd.eject(conn);
1519+
}
1520+
// Workaround for any file descriptor caching issue
1521+
if (patchVDI != null) {
1522+
vbd.insert(conn, patchVDI);
1523+
vbd.eject(conn);
1524+
}
15031525
vbd.destroy(conn);
15041526
break;
15051527
}
15061528
}
1529+
} catch (final Exception e) {
1530+
s_logger.debug("Cannot destroy CD-ROM device for VM " + vmName + " due to " + e.toString(), e);
15071531
}
1508-
} catch (final Exception e) {
1509-
s_logger.debug("Cannot destory CD-ROM device for VM " + vmName + " due to " + e.toString(), e);
15101532
}
15111533
}
15121534

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixReadyCommandWrapper.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ public Answer execute(final ReadyCommand command, final CitrixResourceBase citri
5454
try {
5555
final Host host = Host.getByUuid(conn, citrixResourceBase.getHost().getUuid());
5656
final Set<VM> vms = host.getResidentVMs(conn);
57-
for (final VM vm : vms) {
58-
citrixResourceBase.destroyPatchVbd(conn, vm.getNameLabel(conn));
59-
}
57+
citrixResourceBase.destroyPatchVbd(conn, vms);
6058
} catch (final Exception e) {
6159
}
6260
try {

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixSetupCommandWrapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public Answer execute(final SetupCommand command, final CitrixResourceBase citri
7777

7878
}
7979

80-
8180
final boolean r = citrixResourceBase.launchHeartBeat(conn);
8281
if (!r) {
8382
return null;

0 commit comments

Comments
 (0)