Beispiel #1
0
 def _test_attributes(self):
     host = self.store.host
     assert util.is_str_int(host.id) or util.is_str_uuid(host.id)
     assert util.is_str(host.href) and host.href.endswith(host.id)
     assert util.is_str(host.name) and len(host.name) > 0
     assert host.status in ( 'DOWN', 'ERROR', 'INITIALIZING', 'INSTALLING',
             'INSTALL_FAILED', 'MAINTENANCE', 'NON_OPERATIONAL',
             'NON_RESPONSIVE', 'PENDING_APPROVAL',
             'PREPARING_FOR_MAINTENANCE', 'PROBLEMATIC', 'REBOOT',
             'UNASSIGNED', 'UP')
     assert host.type in ('RHEV_H', 'RHEL')  # BUG: missing
     assert util.is_str_ip(host.address)  # BUG: missing
     assert util.is_str_int(host.cluster.id) or util.is_str_uuid(host.cluster.id)
     assert util.is_int(host.port) and host.port > 0
     assert host.root_password is None
     assert host.power_management is not None
     assert util.is_bool(host.power_management.enabled)
     if host.power_management.enabled:
         assert util.is_str_ip(host.power_management.address)
         assert util.is_str(host.power_management.username)
         assert host.power_management.password is None
         if host.power_management.options:
             opts = host.power_management.options.option
             for opt in opts:
                 assert util.is_str(opt.name) and len(opt.name) > 0
                 assert util.is_str(opt.value_)
     assert util.is_bool(host.storage_manager)
     assert isinstance(host.summary.vms.count, int)  # BUG: missing
     assert isinstance(host.summary.vms.active, int)  # BUG: missing
     assert isinstance(host.summary.vms.migrating, int)  # BUG: missing
Beispiel #2
0
 def test_attributes(self):
     tag = self.api.reload(self.store.tag)
     assert isinstance(tag, schema.Tag)
     assert util.is_str_int(tag.id) or util.is_str_uuid(tag.id)
     assert util.is_str_href(tag.href)
     assert util.is_str(tag.name) and tag.name
     if tag.description:
         assert util.is_str(tag.description)
     assert tag.parent is not None
     assert isinstance(tag.parent.tag, schema.Tag)
     assert util.is_str_int(tag.parent.tag.id) or \
             util.is_str_uuid(tag.parent.tag.id)
Beispiel #3
0
 def _test_attributes(self):
     cluster = self.store.cluster
     assert util.is_str_uuid(cluster.id) or util.is_str_int(cluster.id)
     assert util.is_str(cluster.href) and cluster.href.endswith(cluster.id)
     assert util.is_str(cluster.name) and len(cluster.name) > 0
     assert cluster.description is None or util.is_str(cluster.description)
     assert cluster.data_center is not None
     assert util.is_str_uuid(cluster.data_center.id)
     assert cluster.version is not None
     assert util.is_int(cluster.version.major) and cluster.version.major > 0
     assert util.is_int(cluster.version.minor)
     assert cluster.supported_versions is not None
     for version in cluster.supported_versions.version:
         assert util.is_int(version.major) and version.major > 0
         assert util.is_int(version.minor)
     assert cluster.cpu is not None
     assert util.is_str(cluster.cpu.id)
     assert cluster.memory_policy is not None
     assert util.is_int(cluster.memory_policy.overcommit.percent)
     if cluster.scheduling_policy:
         assert cluster.scheduling_policy.policy in \
                     ('EVEN_DISTRIBUTION', 'POWER_SAVING')
         assert util.is_int(cluster.scheduling_policy.thresholds.low)
         assert util.is_int(cluster.scheduling_policy.thresholds.high)
         assert util.is_int(cluster.scheduling_policy.thresholds.duration)
Beispiel #4
0
 def _test_host_storage_attributes(self):
     host = self.store.host
     storage = self.api.get(schema.HostStorage, base=host)
     assert isinstance(storage, schema.HostStorage)
     for stor in storage:
         assert isinstance(stor, schema.Storage)
         assert util.is_str(stor.id)
         assert util.is_str_href(stor.href)
         assert stor.type in ('ISCSI', 'FCP')
         assert stor.host is not None
         assert util.is_str_int(stor.host.id) or \
                     util.is_str_uuid(stor.host.id)
         assert util.is_str_href(stor.host.href)
         assert bool(stor.logical_unit) != bool(stor.volume_group)
         if stor.logical_unit:
             assert stor.logical_unit.id == stor.id
         else:
             assert stor.volume_group.id == stor.id
         # BUG: missing attributes
         if stor.type == 'ISCSI':
             assert util.is_str(stor.target)
         assert util.is_int(stor.size)
         if stor.logical_unit:
             assert util.is_int(stor.multipathing)
         elif stor.volume_group:
             assert util.is_str(volume_group.name)
             assert volume_group.logical_unit is not None
Beispiel #5
0
 def test_attributes(self):
     template = self.store.template
     template = self.api.reload(template)
     assert util.is_str_uuid(template.id)
     assert util.is_str_href(template.href)
     assert util.is_str(template.name) and template.name
     if template.description:
         assert util.is_str(template.description)
     assert template.type in ('SERVER', 'DESKTOP')
     assert template.status in ('ILLEGAL', 'LOCKED', 'OK')
     assert template.origin in ('RHEV', 'VMWARE', 'XEN')
     assert isinstance(template.creation_time, datetime.datetime)
     assert util.is_int(template.memory)
     assert template.memory > 0
     assert template.cpu is not None
     assert template.cpu.topology is not None
     assert util.is_int(template.cpu.topology.cores)
     assert template.cpu.topology.cores > 0
     assert util.is_int(template.cpu.topology.sockets)
     assert template.cpu.topology.sockets > 0
     assert template.display is not None
     assert template.display.type in ('VNC', 'SPICE')
     assert util.is_int(template.display.monitors)
     assert template.display.monitors > 0
     assert template.os is not None
     assert util.is_str(template.os.type)
     assert template.os.boot is not None
     # Upper case?
     for dev in template.os.boot:
         assert dev.dev in ('cdrom', 'hd', 'network')
     assert util.is_bool(template.stateless)
     assert template.cluster is not None
     assert util.is_str_int(template.cluster.id) or util.is_str_uuid(template.cluster.id)
Beispiel #6
0
 def test_attributes(self):
     pool = self.store.pool
     pool = self.api.reload(pool)
     assert util.is_str_int(pool.id) or util.is_str_uuid(pool.id)
     assert util.is_str_href(pool.href)
     assert util.is_str(pool.name) and pool.name
     if pool.description:
         assert util.is_str(pool.description)
Beispiel #7
0
 def test_attributes(self):
     vm = self.store.vm
     vm = self.api.reload(vm)
     assert util.is_str_uuid(vm.id)
     assert util.is_str_href(vm.href)
     assert util.is_str(vm.name)
     assert vm.description is None or util.is_str(vm.description)
     assert vm.type in ('SERVER', 'DESKTOP')
     assert vm.status in ('UNASSIGNED', 'DOWN', 'UP', 'POWERING_UP',
             'POWERED_DOWN', 'PAUSED', 'MIGRATING_FROM', 'MIGRATING_TO',
             'UNKNOWN', 'NOT_RESPONDING', 'WAIT_FOR_LAUNCH',
             'REBOOT_IN_PROGRESS', 'SAVING_STATE', 'RESTORING_STATE',
             'SUSPENDED', 'IMAGE_ILLEGAL', 'IMAGE_LOCKED', 'POWERING_DOWN')
     assert vm.origin in ('RHEV', 'VMWARE', 'XEN')
     assert util.is_date(vm.creation_time)
     assert util.is_int(vm.memory) and vm.memory > 0
     assert vm.cpu is not None
     assert vm.cpu.topology is not None
     assert util.is_int(vm.cpu.topology.cores)
     assert vm.cpu.topology.cores > 0
     assert util.is_int(vm.cpu.topology.sockets)
     assert vm.cpu.topology.sockets > 0
     assert vm.display is not None
     assert vm.display.type in ('VNC', 'SPICE')
     if vm.status == 'UP':
         assert util.is_int(vm.display.port)
         assert vm.display.port > 0
         assert util.is_str_host(vm.display.address)
     assert util.is_int(vm.display.monitors)
     assert vm.display.monitors > 0
     assert vm.os is not None
     assert util.is_str(vm.os.type)
     assert vm.os.boot is not None
     for dev in vm.os.boot:
         assert dev.dev in ('cdrom', 'hd', 'network')
     assert util.is_bool(vm.stateless)
     if vm.host is not None:
         assert util.is_str_int(vm.host.id) or util.is_str_uuid(vm.host.id)
     assert vm.cluster is not None
     assert util.is_str_int(vm.cluster.id) or util.is_str_uuid(vm.cluster.id)
     assert vm.template is not None
     assert util.is_str_uuid(vm.template.id)
     if vm.vmpool is not None:
         assert util.is_str_uuid(vm.vmpool.id)
Beispiel #8
0
 def _test_attributes(self):
     nic = self.store.nic
     assert nic is not None
     assert util.is_str_uuid(nic.id)
     assert util.is_str(nic.href) and nic.href.endswith(nic.id)
     assert util.is_str(nic.name) and len(nic.name) > 0
     assert nic.status in ('UP', 'DOWN')  # BUG: missing
     assert util.is_str_int(nic.host.id) or util.is_str_uuid(nic.host.id)
     assert util.is_str_uuid(nic.network.id)
     assert util.is_str_mac(nic.mac.address)
     assert util.is_str_ip(nic.ip.address)
     assert util.is_str_ip(nic.ip.netmask)
     assert util.is_str_ip(nic.ip.gateway)
     if nic.vlan is not None:
         assert util.is_int(nic.vlan.id) and nic.vlan.id > 0
     assert util.is_int(nic.speed)  # BUG: missing
     assert nic.boot_protocol in ('DHCP', 'STATIC', 'NONE')  # BUG: missing
     assert isinstance(nic.check_connectivity, bool)  # BUG: missing