Created
December 16, 2011 14:12
-
-
Save primalmotion/1486180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iq_park(self, iq): | |
""" | |
Park virtual machine | |
@type iq: xmpp.Protocol.Iq | |
@param iq: the received IQ | |
@rtype: xmpp.Protocol.Iq | |
@return: a ready to send IQ containing the result of the action | |
""" | |
#try: | |
if True: | |
items = iq.getTag("query").getTag("archipel").getTags("item") | |
for item in items: | |
vm_uuid = item.getAttr("uuid") | |
force_destroy = False | |
print "ICI %s" % item.getAttr("force") | |
if item.getAttr("force") and item.getAttr("force").lower() in ("yes", "y", "true", "1"): | |
force_destroy = True | |
print "OK %s" % str(force_destroy) | |
self.park(vm_uuid, iq.getFrom(), force=force_destroy) | |
reply = iq.buildReply("result") | |
# except Exception as ex: | |
# reply = build_error_iq(self, ex, iq, ARCHIPEL_ERROR_CODE_VMPARK_PARK) | |
return reply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment