Пример #1
0
 def execute_for_one(self, session, host):
     id=self.find_vm(session, host)  # @ReservedAssignment
     session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_KEY)
     session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_KEY, bool2str(True))
     if self.args.batch:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
         session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_BATCH, self.args.batch)
     else:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
Пример #2
0
 def execute_for_each(self, session, host):
     all_vms = session.xenapi.VM.get_all_records()
     for vm_id in all_vms:
         vm = all_vms[vm_id]
         if not vm['is_a_template'] and not vm['is_control_domain'] and not vm['is_a_snapshot']:
             vm_name=vm['name_label']
             self.result[vm_name]=[host['name'],vm_name, 
                 vm['power_state'],
                 bool2str(vm['other_config'].get(AUTOBACKUP_KEY, False)),
                 vm['other_config'].get(AUTOBACKUP_BATCH) ]
Пример #3
0
 def execute_for_one(self, session, host):
     id = self.find_vm(session, host)  # @ReservedAssignment
     session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_KEY)
     session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_KEY,
                                           bool2str(True))
     if self.args.batch:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
         session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_BATCH,
                                               self.args.batch)
     else:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
Пример #4
0
 def execute_for_one(self, session, host):
     ids=session.xenapi.VM.get_by_name_label(self.args.vm)
     log.debug('Found this VMs %s', ids)
     if not ids:
         raise CommandError('VM %s not found on server %s' % (self.args.vm, host['name']))
     elif len(ids)>1:
         raise CommandError('Name %s is not unique, please fix'% self.args.vm)
     id=ids[0]  # @ReservedAssignment
     session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_KEY)
     session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_KEY, bool2str(True))
     if self.args.batch:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
         session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_BATCH, self.args.batch)
     else:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
Пример #5
0
 def execute_for_one(self, session, host):
     ids = session.xenapi.VM.get_by_name_label(self.args.vm)
     log.debug('Found this VMs %s', ids)
     if not ids:
         raise CommandError('VM %s not found on server %s' %
                            (self.args.vm, host['name']))
     elif len(ids) > 1:
         raise CommandError('Name %s is not unique, please fix' %
                            self.args.vm)
     id = ids[0]  # @ReservedAssignment
     session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_KEY)
     session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_KEY,
                                           bool2str(True))
     if self.args.batch:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)
         session.xenapi.VM.add_to_other_config(id, AUTOBACKUP_BATCH,
                                               self.args.batch)
     else:
         session.xenapi.VM.remove_from_other_config(id, AUTOBACKUP_BATCH)