@attr(tags=['advanced', 'eip', 'advancedns', 'basic', 'sg'])
def test_04_deploy_startvm_false_attach_volume(self):
    'Test Deploy Virtual Machine with startVM=false and attach volume\n        '
    self.debug(('Deploying instance in the account: %s' % self.account.name))
    self.virtual_machine = VirtualMachine.create(self.apiclient, self.services['virtual_machine'], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, startvm=False, diskofferingid=self.disk_offering.id)
    self.debug(('Deployed instance in account: %s' % self.account.name))
    list_vm_response = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
    self.debug(('Verify listVirtualMachines response for virtual machine: %s' % self.virtual_machine.id))
    self.assertEqual(isinstance(list_vm_response, list), True, 'Check list response returns a valid list')
    vm_response = list_vm_response[0]
    self.assertEqual(vm_response.state, 'Stopped', 'VM should be in Stopped state after deployment with startvm=false')
    self.debug(('Creating a volume in account: %s' % self.account.name))
    volume = Volume.create(self.apiclient, self.services['volume'], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, diskofferingid=self.disk_offering.id)
    self.debug(('Created volume in account: %s' % self.account.name))
    self.debug(('Attaching volume to instance: %s' % self.virtual_machine.name))
    try:
        self.virtual_machine.attach_volume(self.apiclient, volume)
    except Exception as e:
        self.fail('Attach volume failed!')
    return
Test Deploy Virtual Machine with startVM=false and attach volume
@attr(tags=['advanced', 'eip', 'advancedns', 'basic', 'sg'])
def test_04_deploy_startvm_false_attach_volume(self):
    '\n        '
    self.debug(('Deploying instance in the account: %s' % self.account.name))
    self.virtual_machine = VirtualMachine.create(self.apiclient, self.services['virtual_machine'], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, startvm=False, diskofferingid=self.disk_offering.id)
    self.debug(('Deployed instance in account: %s' % self.account.name))
    list_vm_response = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
    self.debug(('Verify listVirtualMachines response for virtual machine: %s' % self.virtual_machine.id))
    self.assertEqual(isinstance(list_vm_response, list), True, 'Check list response returns a valid list')
    vm_response = list_vm_response[0]
    self.assertEqual(vm_response.state, 'Stopped', 'VM should be in Stopped state after deployment with startvm=false')
    self.debug(('Creating a volume in account: %s' % self.account.name))
    volume = Volume.create(self.apiclient, self.services['volume'], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, diskofferingid=self.disk_offering.id)
    self.debug(('Created volume in account: %s' % self.account.name))
    self.debug(('Attaching volume to instance: %s' % self.virtual_machine.name))
    try:
        self.virtual_machine.attach_volume(self.apiclient, volume)
    except Exception as e:
        self.fail('Attach volume failed!')
    return