You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sh...@apache.org on 2024/02/26 06:53:58 UTC

(cloudstack) branch main updated (8f6721ed4c4 -> 0926e5c15a9)

This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


    from 8f6721ed4c4 Improve some UserVmManagerImpl's methods name and docs (#8673)
     add e9416c4987e Move views into separate files for easier modification (#8647)
     add e74a72b4ef8 test: fix test_guest_os.py failure on xcpng82 (#8659)
     add 275abaff6bc Refactor updateDiskOffering API (#8446)
     add 1a1131154ef Fixup vm powerstate update (#8545)
     add ed579bfeca5 UI: remove duplicated section for backup (#8678)
     add 3aafb286b9d Fixed deleteVlanIpRange API description (#8700)
     add 8d4b4dcec42 CKS: add kube config path in extra control nodes (#8658)
     add af942e2260f vpc: optimize createMonitorServiceCommand() execution (#8385)
     add e09fd2e26b9 Fixup: Optimize getRouterHealthChecksConfig method (#8677)
     add 2a56c61adea Merge remote-tracking branch 'apache/4.18' into 4.19
     new 0926e5c15a9 Merge remote-tracking branch 'apache/4.19'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../command/admin/vlan/DeleteVlanIpRangeCmd.java   |   2 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |   5 +-
 .../java/com/cloud/vm/dao/VMInstanceDaoImpl.java   |  23 ++-
 .../cloud.account_netstats_view.sql}               |  24 ++-
 .../cloud.account_vmstats_view.sql}                |  28 +--
 .../db/views/cloud.affinity_group_view.sql         |  60 ++++++
 .../META-INF/db/views/cloud.event_view.sql         |  63 +++++++
 .../cloud.free_ip_view.sql}                        |  18 +-
 .../META-INF/db/views/cloud.image_store_view.sql   |  45 +++++
 .../db/views/cloud.instance_group_view.sql         |  48 +++++
 .../cloud.last_annotation_view.sql}                |  31 ++-
 .../META-INF/db/views/cloud.mshost_view.sql        |  46 +++++
 .../db/views/cloud.project_account_view.sql        |  54 ++++++
 .../db/views/cloud.project_invitation_view.sql     |  52 ++++++
 .../META-INF/db/views/cloud.project_view.sql       |  50 +++++
 .../META-INF/db/views/cloud.resource_tag_view.sql  |  51 +++++
 .../db/views/cloud.security_group_view.sql         |  79 ++++++++
 .../META-INF/db/views/cloud.volume_view.sql        | 156 ++++++++++++++++
 .../META-INF/db/views/cloud.vpc_offering_view.sql  |  63 +++++++
 .../com/cloud/vm/dao/VMInstanceDaoImplTest.java    | 152 +++++++++++++--
 .../main/resources/conf/k8s-control-node-add.yml   |   4 +
 .../configuration/ConfigurationManagerImpl.java    | 208 +++++++++++++--------
 .../router/VirtualNetworkApplianceManagerImpl.java |  21 +--
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   7 +-
 .../ConfigurationManagerImplTest.java              | 157 ++++++++++++++++
 test/integration/smoke/test_guest_os.py            |   2 +-
 ui/src/config/section/storage.js                   |  54 ------
 27 files changed, 1298 insertions(+), 205 deletions(-)
 copy engine/schema/src/main/resources/META-INF/db/{schema-442to450-cleanup.sql => views/cloud.account_netstats_view.sql} (61%)
 copy engine/schema/src/main/resources/META-INF/db/{schema-442to450-cleanup.sql => views/cloud.account_vmstats_view.sql} (64%)
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.affinity_group_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.event_view.sql
 copy engine/schema/src/main/resources/META-INF/db/{schema-4930to41000-cleanup.sql => views/cloud.free_ip_view.sql} (68%)
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.image_store_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.instance_group_view.sql
 copy engine/schema/src/main/resources/META-INF/db/{schema-41310to41400-cleanup.sql => views/cloud.last_annotation_view.sql} (53%)
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.mshost_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.project_account_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.project_invitation_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.project_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.resource_tag_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.security_group_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.volume_view.sql
 create mode 100644 engine/schema/src/main/resources/META-INF/db/views/cloud.vpc_offering_view.sql


(cloudstack) 01/01: Merge remote-tracking branch 'apache/4.19'

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 0926e5c15a985d5f26f30a84d74a5b77c8055e82
Merge: 8f6721ed4c4 2a56c61adea
Author: Abhishek Kumar <ab...@gmail.com>
AuthorDate: Mon Feb 26 12:23:34 2024 +0530

    Merge remote-tracking branch 'apache/4.19'

 .../command/admin/vlan/DeleteVlanIpRangeCmd.java   |   2 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |   5 +-
 .../java/com/cloud/vm/dao/VMInstanceDaoImpl.java   |  23 ++-
 .../db/views/cloud.account_netstats_view.sql       |  31 +++
 .../db/views/cloud.account_vmstats_view.sql        |  35 ++++
 .../db/views/cloud.affinity_group_view.sql         |  60 ++++++
 .../META-INF/db/views/cloud.event_view.sql         |  63 +++++++
 .../META-INF/db/views/cloud.free_ip_view.sql       |  32 ++++
 .../META-INF/db/views/cloud.image_store_view.sql   |  45 +++++
 .../db/views/cloud.instance_group_view.sql         |  48 +++++
 .../db/views/cloud.last_annotation_view.sql        |  43 +++++
 .../META-INF/db/views/cloud.mshost_view.sql        |  46 +++++
 .../db/views/cloud.project_account_view.sql        |  54 ++++++
 .../db/views/cloud.project_invitation_view.sql     |  52 ++++++
 .../META-INF/db/views/cloud.project_view.sql       |  50 +++++
 .../META-INF/db/views/cloud.resource_tag_view.sql  |  51 +++++
 .../db/views/cloud.security_group_view.sql         |  79 ++++++++
 .../META-INF/db/views/cloud.volume_view.sql        | 156 ++++++++++++++++
 .../META-INF/db/views/cloud.vpc_offering_view.sql  |  63 +++++++
 .../com/cloud/vm/dao/VMInstanceDaoImplTest.java    | 152 +++++++++++++--
 .../main/resources/conf/k8s-control-node-add.yml   |   4 +
 .../configuration/ConfigurationManagerImpl.java    | 208 +++++++++++++--------
 .../router/VirtualNetworkApplianceManagerImpl.java |  21 +--
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   7 +-
 .../ConfigurationManagerImplTest.java              | 157 ++++++++++++++++
 test/integration/smoke/test_guest_os.py            |   2 +-
 ui/src/config/section/storage.js                   |  54 ------
 27 files changed, 1377 insertions(+), 166 deletions(-)

diff --cc api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
index 7f583fe225a,390759c2c06..7ab0b053004
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
@@@ -28,9 -29,10 +28,9 @@@ import org.apache.cloudstack.api.respon
  
  import com.cloud.user.Account;
  
- @APICommand(name = "deleteVlanIpRange", description = "Creates a VLAN IP range.", responseObject = SuccessResponse.class,
+ @APICommand(name = "deleteVlanIpRange", description = "Deletes a VLAN IP range.", responseObject = SuccessResponse.class,
          requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
  public class DeleteVlanIpRangeCmd extends BaseCmd {
 -    public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
  
  
      /////////////////////////////////////////////////////
diff --cc engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index b5fc2e7c3a9,59d129bc065..f3ec3dd4761
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@@ -2206,10 -2208,11 +2206,12 @@@ public class VirtualMachineManagerImpl 
  
              boolean result = stateTransitTo(vm, Event.OperationSucceeded, null);
              if (result) {
+                 vm.setPowerState(PowerState.PowerOff);
+                 _vmDao.update(vm.getId(), vm);
                  if (VirtualMachine.Type.User.equals(vm.type) && ResourceCountRunningVMsonly.value()) {
                      ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
 -                    resourceCountDecrement(vm.getAccountId(), offering.getCpu().longValue(), offering.getRamSize().longValue());
 +                    VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId());
 +                    _resourceLimitMgr.decrementVmResourceCount(vm.getAccountId(), vm.isDisplay(), offering, template);
                  }
              } else {
                  throw new CloudRuntimeException("unable to stop " + vm);
diff --cc engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
index cc82813b412,322895f0ec5..b7b787b0045
--- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@@ -64,7 -65,8 +64,7 @@@ import com.cloud.vm.VirtualMachine.Type
  @Component
  public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implements VMInstanceDao {
  
-     private static final int MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT = 3;
 -    public static final Logger s_logger = Logger.getLogger(VMInstanceDaoImpl.class);
+     static final int MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT = 3;
  
      protected SearchBuilder<VMInstanceVO> VMClusterSearch;
      protected SearchBuilder<VMInstanceVO> LHVMClusterSearch;
@@@ -927,6 -931,17 +929,17 @@@
          });
      }
  
+     private boolean isPowerStateInSyncWithInstanceState(final VirtualMachine.PowerState powerState, final long powerHostId, final VMInstanceVO instance) {
+         State instanceState = instance.getState();
+         if ((powerState == VirtualMachine.PowerState.PowerOff && instanceState == State.Running)
+                 || (powerState == VirtualMachine.PowerState.PowerOn && instanceState == State.Stopped)) {
 -            s_logger.debug(String.format("VM id: %d on host id: %d and power host id: %d is in %s state, but power state is %s",
++            logger.debug(String.format("VM id: %d on host id: %d and power host id: %d is in %s state, but power state is %s",
+                     instance.getId(), instance.getHostId(), powerHostId, instanceState, powerState));
+             return false;
+         }
+         return true;
+     }
+ 
      @Override
      public boolean isPowerStateUpToDate(final long instanceId) {
          VMInstanceVO instance = findById(instanceId);
diff --cc engine/schema/src/test/java/com/cloud/vm/dao/VMInstanceDaoImplTest.java
index 00eae3b78d4,9dc773cd7d6..4a32dc08359
--- a/engine/schema/src/test/java/com/cloud/vm/dao/VMInstanceDaoImplTest.java
+++ b/engine/schema/src/test/java/com/cloud/vm/dao/VMInstanceDaoImplTest.java
@@@ -17,20 -17,25 +17,26 @@@
  
  package com.cloud.vm.dao;
  
- import com.cloud.utils.Pair;
- import com.cloud.vm.VirtualMachine;
+ import static com.cloud.vm.VirtualMachine.State.Running;
+ import static com.cloud.vm.VirtualMachine.State.Stopped;
+ import static com.cloud.vm.dao.VMInstanceDaoImpl.MAX_CONSECUTIVE_SAME_STATE_UPDATE_COUNT;
+ import static org.junit.Assert.assertFalse;
+ import static org.junit.Assert.assertTrue;
+ import static org.mockito.ArgumentMatchers.any;
+ import static org.mockito.ArgumentMatchers.anyLong;
+ import static org.mockito.Mockito.doReturn;
+ import static org.mockito.Mockito.never;
+ import static org.mockito.Mockito.times;
+ import static org.mockito.Mockito.verify;
+ import static org.mockito.Mockito.when;
+ 
+ import java.util.Date;
+ 
  import org.joda.time.DateTime;
 +import org.junit.After;
  import org.junit.Before;
  import org.junit.Test;
- import org.junit.Assert;
  import org.mockito.Mock;
- 
- import static com.cloud.vm.VirtualMachine.State.Running;
- import static com.cloud.vm.VirtualMachine.State.Stopped;
- 
- import static org.mockito.Mockito.when;
- import com.cloud.vm.VMInstanceVO;
  import org.mockito.MockitoAnnotations;
  import org.mockito.Spy;
  
@@@ -57,15 -64,10 +67,15 @@@ public class VMInstanceDaoImplTest 
          when(vm.getUpdateTime()).thenReturn(DateTime.now().toDate());
      }
  
 +    @After
 +    public void tearDown() throws Exception {
 +        closeable.close();
 +    }
 +
      @Test
-     public void testUpdateState() throws Exception {
+     public void testUpdateState() {
          Long destHostId = null;
-         Pair<Long, Long> opaqueMock = new Pair<Long, Long>(new Long(1), destHostId);
+         Pair<Long, Long> opaqueMock = new Pair<>(1L, destHostId);
          vmInstanceDao.updateState(Stopped, VirtualMachine.Event.FollowAgentPowerOffReport, Stopped, vm , opaqueMock);
      }
  
diff --cc server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 8467e6a3d4c,dd27c938d8e..a5c5c8a3e08
--- a/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@@ -1625,13 -1627,13 +1625,13 @@@ Configurable, StateListener<VirtualMach
              return false;
          }
  
 -        s_logger.info("Updating data for router health checks for router " + router.getUuid());
 +        logger.info("Updating data for router health checks for router " + router.getUuid());
          Answer origAnswer = null;
          try {
-             SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true);
+             SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true, getRouterHealthChecksConfig(router));
              origAnswer = _agentMgr.easySend(router.getHostId(), command);
          } catch (final Exception e) {
 -            s_logger.error("Error while sending update data for health check to router: " + router.getInstanceName(), e);
 +            logger.error("Error while sending update data for health check to router: " + router.getInstanceName(), e);
              return false;
          }