Skip to content

Commit

Permalink
Merge pull request #443 from libhe/master
Browse files Browse the repository at this point in the history
Increase default memory for openshift.yaml to avoid kdump service fail.
  • Loading branch information
libhe authored Sep 26, 2024
2 parents 7ec3add + fbaf97b commit 1c319bf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion os_tests/cfg/openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ VM:
Flavor:
name: small
cpu: 1
memory: 1
memory: 1.5
size: 10G
virt: kvm
40 changes: 39 additions & 1 deletion os_tests/libs/resources_libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ def floating_ip(self):
if v["addrs"]:
for ipaddr in v["addrs"]:
f_ip = ipaddr["addr"]

if not f_ip:
LOG.warning(f"No floating IP found for VM {self.vm_name}. Checking VM status.")
state, reason = self.get_state()
state_str = self._get_state_string(state)
reason_str = self._get_reason_string(state, reason)
LOG.info(f"VM {self.vm_name} - State: {state_str}, Reason: {reason_str}")

LOG.info("ip is %s" % f_ip)
return f_ip

@property
Expand Down Expand Up @@ -224,7 +233,36 @@ def _get_status(self):
self.data = self.vm_name
dom = self.conn.lookupByUUIDString(self.data.get("uuid"))
state, reason = dom.state()
return state
state_str = self._get_state_string(state)
reason_str = self._get_reason_string(state, reason)
LOG.info(f"VM {self.vm_name} - State: {state_str}, Reason: {reason_str}")
return state, reason

def _get_state_string(self, state):
state_dict = {
libvirt.VIR_DOMAIN_RUNNING: "Running",
libvirt.VIR_DOMAIN_SHUTDOWN: "Shutdown",
libvirt.VIR_DOMAIN_SHUTOFF: "Shutoff",
libvirt.VIR_DOMAIN_PAUSED: "Paused",
libvirt.VIR_DOMAIN_CRASHED: "Crashed",
libvirt.VIR_DOMAIN_PMSUSPENDED: "Suspended",
}
return state_dict.get(state, f"Unknown ({state})")

def _get_reason_string(self, state, reason):
reason_dict = {
libvirt.VIR_DOMAIN_RUNNING: {
libvirt.VIR_DOMAIN_RUNNING_BOOTED: "Booted",
libvirt.VIR_DOMAIN_RUNNING_MIGRATED: "Migrated",
libvirt.VIR_DOMAIN_RUNNING_RESTORED: "Restored",
},
libvirt.VIR_DOMAIN_SHUTOFF: {
libvirt.VIR_DOMAIN_SHUTOFF_DESTROYED: "Destroyed",
libvirt.VIR_DOMAIN_SHUTOFF_CRASHED: "Crashed",
libvirt.VIR_DOMAIN_SHUTOFF_SHUTDOWN: "Shutdown",
},
}
return reason_dict.get(state, {}).get(reason, f"Unknown ({reason})")

def get_state(self):
return self._get_status()
Expand Down
2 changes: 2 additions & 0 deletions os_tests/tests/test_rhel_guest_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def test_check_partitions(self):
product_id = utils_lib.get_product_id(self)
if float(product_id) >= 10.0:
expected_partitions = 4
if utils_lib.is_arch(self, arch='aarch64') or utils_lib.is_arch(self, arch='ppc64le'):
expected_partitions = 3
elif float(product_id) >= 9.0:
expected_partitions = 5
if utils_lib.is_arch(self, arch='s390x'):
Expand Down

0 comments on commit 1c319bf

Please sign in to comment.