**** CubicPower OpenStack Study ****
def get_from_instance(instance):
mode = instance['vm_mode']
return name(mode)
**** CubicPower OpenStack Study ****
def name(mode):
if mode is None:
return None
mode = mode.lower()
# For compatibility with pre-Folsom deployments
if mode == "pv":
mode = XEN
if mode == "hv":
mode = HVM
if mode not in ALL:
raise exception.Invalid("Unknown vm mode '%s'" % mode)
return mode